src/Entity/Gallery/Album.php line 21
<?php
namespace App\Entity\Gallery;
use App\Entity\Common\File;
use App\Entity\Traits\ActiveTrait;
use App\Entity\Traits\TrackerFields;
use App\Entity\Traits\UserCreatedInterface;
use App\Entity\Traits\UserUpdatedInterface;
use App\Model\Translation\TranslatableTrait;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Knp\DoctrineBehaviors\Contract\Entity\TranslatableInterface;
#[ORM\Table(name: 'gallery_album')]
#[ORM\Entity(repositoryClass: \App\Repository\Gallery\AlbumRepository::class)]
#[ORM\HasLifecycleCallbacks]
class Album implements UserCreatedInterface, UserUpdatedInterface, TranslatableInterface
{
use TrackerFields;
use TranslatableTrait;
use ActiveTrait;
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'AUTO')]
#[ORM\Column(type: 'integer')]
private ?int $id;
#[ORM\Column(type: 'string', nullable: true)]
private ?string $caption;
#[ORM\Column(type: 'integer')]
private int $weight = 50;
#[ORM\ManyToOne(targetEntity: \App\Entity\Gallery\Group::class, inversedBy: 'albums')]
#[ORM\JoinColumn(nullable: false)]
private Group $group;
#[ORM\ManyToOne(targetEntity: \App\Entity\Common\File::class, cascade: ['persist', 'remove'])]
#[ORM\JoinColumn(nullable: true)]
private ?File $previewImage;
#[ORM\OneToMany(mappedBy: 'album', targetEntity: Photo::class)]
private Collection $photos;
#[ORM\Column(type: Types::BOOLEAN, options: ["default" => true,])]
private bool $publish = true;
public function __construct()
{
$this->photos = new ArrayCollection();
}
/**
* @return int|null
*/
public function getId(): ?int
{
return $this->id;
}
/**
* @param int|null $id
*/
public function setId(?int $id): void
{
$this->id = $id;
}
/**
* @return int
*/
public function getWeight(): int
{
return $this->weight;
}
/**
* @param int $weight
*/
public function setWeight(int $weight): void
{
$this->weight = $weight;
}
public function getPhotos(): Collection
{
return $this->photos;
}
public function setPhotos(Collection $photos): void
{
$this->photos = $photos;
}
/**
* @return Group
*/
public function getGroup(): Group
{
return $this->group;
}
/**
* @param Group $group
*/
public function setGroup(Group $group): void
{
$this->group = $group;
}
public function getPreviewImage(): ?File
{
return $this->previewImage;
}
public function setPreviewImage(?File $preview): void
{
$this->previewImage = $preview;
}
public function isPublish(): bool
{
return $this->publish;
}
public function setPublish(bool $publish): void
{
$this->publish = $publish;
}
}