src/Entity/Gallery/Group.php line 23

  1. <?php
  2. namespace App\Entity\Gallery;
  3. use App\Entity\Common\File;
  4. use App\Entity\Common\Owner;
  5. use App\Entity\Traits\ActiveTrait;
  6. use App\Entity\Traits\TrackerFields;
  7. use App\Entity\Traits\UserCreatedInterface;
  8. use App\Entity\Traits\UserUpdatedInterface;
  9. use App\Entity\UUID\HaveUuidInterface;
  10. use App\Entity\UUID\UuidTrait;
  11. use App\Model\Common\HaveOwnerInterface;
  12. use App\Model\Translation\TranslatableTrait;
  13. use Doctrine\Common\Collections\ArrayCollection;
  14. use Doctrine\Common\Collections\Collection;
  15. use Doctrine\ORM\Mapping as ORM;
  16. use Knp\DoctrineBehaviors\Contract\Entity\TranslatableInterface;
  17. #[ORM\Table(name'gallery_group')]
  18. #[ORM\Entity(repositoryClass'App\Repository\Gallery\GroupRepository')]
  19. #[ORM\HasLifecycleCallbacks]
  20. class Group implements HaveOwnerInterfaceUserCreatedInterfaceUserUpdatedInterfaceTranslatableInterface
  21. {
  22.     use TrackerFields;
  23.     use TranslatableTrait;
  24.     use ActiveTrait;
  25.     #[ORM\Id]
  26.     #[ORM\GeneratedValue(strategy'AUTO')]
  27.     #[ORM\Column(type'integer')]
  28.     private ?int $id;
  29.     #[ORM\Column(type'integer')]
  30.     private int $weight 50;
  31.     #[ORM\Embedded(class: \App\Entity\Common\Owner::class)]
  32.     private Owner $owner;
  33.     #[ORM\OneToMany(mappedBy'group'targetEntity\App\Entity\Gallery\Album::class)]
  34.     private Collection $albums;
  35.     #[ORM\ManyToOne(targetEntity\App\Entity\Common\File::class, cascade: ['persist''remove'])]
  36.     #[ORM\JoinColumn(nullabletrue)]
  37.     private ?File $previewImage;
  38.     public function __construct()
  39.     {
  40.         $this->albums = new ArrayCollection();
  41.     }
  42.     /**
  43.      * @return Owner
  44.      */
  45.     public function getOwner(): Owner
  46.     {
  47.         return $this->owner;
  48.     }
  49.     /**
  50.      * @param Owner $owner
  51.      */
  52.     public function setOwner(Owner $owner): void
  53.     {
  54.         $this->owner $owner;
  55.     }
  56.     /**
  57.      * @return Collection
  58.      */
  59.     public function getAlbums(): Collection
  60.     {
  61.         return $this->albums;
  62.     }
  63.     /**
  64.      * @param Collection $albums
  65.      */
  66.     public function setAlbums(Collection $albums): void
  67.     {
  68.         $this->albums $albums;
  69.     }
  70.     /**
  71.      * @return int
  72.      */
  73.     public function getWeight(): int
  74.     {
  75.         return $this->weight;
  76.     }
  77.     /**
  78.      * @param int $weight
  79.      */
  80.     public function setWeight(int $weight): void
  81.     {
  82.         $this->weight $weight;
  83.     }
  84.     /**
  85.      * @return int|null
  86.      */
  87.     public function getId(): ?int
  88.     {
  89.         return $this->id;
  90.     }
  91.     /**
  92.      * @param int|null $id
  93.      */
  94.     public function setId(?int $id): void
  95.     {
  96.         $this->id $id;
  97.     }
  98.     public function getPreviewImage(): ?File
  99.     {
  100.         return $this->previewImage;
  101.     }
  102.     public function setPreviewImage(?File $previewImage): void
  103.     {
  104.         $this->previewImage $previewImage;
  105.     }
  106. }