src/Entity/Olympiad/Review.php line 19

  1. <?php
  2. namespace App\Entity\Olympiad;
  3. use App\Entity\Common\File;
  4. use App\Entity\Common\Owner;
  5. use App\Entity\Geo\Region;
  6. use App\Entity\Traits\TrackerFields;
  7. use App\Entity\Traits\UserCreatedInterface;
  8. use App\Entity\Traits\UserUpdatedInterface;
  9. use App\Model\Common\HaveOwnerInterface;
  10. use Doctrine\Common\Collections\ArrayCollection;
  11. use Doctrine\Common\Collections\Collection;
  12. use Doctrine\ORM\Mapping as ORM;
  13. #[ORM\Table(name'olympiad_reviews')]
  14. #[ORM\Entity(repositoryClass'App\Repository\Olympiad\ReviewRepository')]
  15. #[ORM\HasLifecycleCallbacks]
  16. class Review implements HaveOwnerInterfaceUserCreatedInterfaceUserUpdatedInterface
  17. {
  18.     use TrackerFields;
  19.     /**
  20.      * @var
  21.      */
  22.     #[ORM\Embedded(class: 'App\Entity\Common\Owner')]
  23.     private $owner;
  24.     #[ORM\Id]
  25.     #[ORM\GeneratedValue(strategy'AUTO')]
  26.     #[ORM\Column(type'integer')]
  27.     private $id;
  28.     /**
  29.      * @var bool
  30.      */
  31.     #[ORM\Column(type'boolean'name'is_published')]
  32.     private bool $published false;
  33.     #[ORM\Column(type'string'nullabletrue)]
  34.     private ?string $caption null;
  35.     #[ORM\Column(type'string'nullabletrue)]
  36.     private ?string $email null;
  37.     #[ORM\Column(type'string'nullabletrue)]
  38.     private ?string $eduOrg null;
  39.     #[ORM\ManyToOne(targetEntity'App\Entity\Geo\Region')]
  40.     private ?Region $region null;
  41.     /**
  42.      * @var File|null
  43.      */
  44.     #[ORM\ManyToOne(targetEntity'App\Entity\Common\File'cascade: ['remove''persist'])]
  45.     private ?File $photo;
  46.     #[ORM\JoinTable(name'olympiad_review_file_relation')]
  47.     #[ORM\ManyToMany(targetEntity'App\Entity\Common\File'cascade: ['remove''persist'])]
  48.     private Collection $photos;
  49.     /**
  50.      * @var
  51.      */
  52.     #[ORM\Column(type'text')]
  53.     private string $text;
  54.     public function __construct()
  55.     {
  56.         $this->owner = new Owner();
  57.         $this->photos = new ArrayCollection();
  58.     }
  59.     /**
  60.      * @return Owner
  61.      */
  62.     public function getOwner(): Owner
  63.     {
  64.         return $this->owner;
  65.     }
  66.     /**
  67.      * @param Owner $owner
  68.      */
  69.     public function setOwner(Owner $owner): void
  70.     {
  71.         $this->owner $owner;
  72.     }
  73.     /**
  74.      * @return mixed
  75.      */
  76.     public function getId()
  77.     {
  78.         return $this->id;
  79.     }
  80.     /**
  81.      * @param mixed $id
  82.      */
  83.     public function setId($id): void
  84.     {
  85.         $this->id $id;
  86.     }
  87.     /**
  88.      * @return bool
  89.      */
  90.     public function isPublished(): bool
  91.     {
  92.         return $this->published;
  93.     }
  94.     /**
  95.      * @param bool $published
  96.      */
  97.     public function setPublished(bool $published): void
  98.     {
  99.         $this->published $published;
  100.     }
  101.     /**
  102.      * @return string|null
  103.      */
  104.     public function getCaption(): ?string
  105.     {
  106.         return $this->caption;
  107.     }
  108.     /**
  109.      * @param string|null $caption
  110.      */
  111.     public function setCaption(?string $caption): void
  112.     {
  113.         $this->caption $caption;
  114.     }
  115.     /**
  116.      * @return string|null
  117.      */
  118.     public function getEduOrg(): ?string
  119.     {
  120.         return $this->eduOrg;
  121.     }
  122.     /**
  123.      * @param string|null $eduOrg
  124.      */
  125.     public function setEduOrg(?string $eduOrg): void
  126.     {
  127.         $this->eduOrg $eduOrg;
  128.     }
  129.     /**
  130.      * @return Region|null
  131.      */
  132.     public function getRegion(): ?Region
  133.     {
  134.         return $this->region;
  135.     }
  136.     /**
  137.      * @param Region|null $region
  138.      */
  139.     public function setRegion(?Region $region): void
  140.     {
  141.         $this->region $region;
  142.     }
  143.     /**
  144.      * @return mixed
  145.      */
  146.     public function getText(): string
  147.     {
  148.         return $this->text;
  149.     }
  150.     /**
  151.      * @param mixed $text
  152.      */
  153.     public function setText(string $text): void
  154.     {
  155.         $this->text $text;
  156.     }
  157.     /**
  158.      * @return string|null
  159.      */
  160.     public function getEmail(): ?string
  161.     {
  162.         return $this->email;
  163.     }
  164.     /**
  165.      * @param string|null $email
  166.      */
  167.     public function setEmail(?string $email): void
  168.     {
  169.         $this->email $email;
  170.     }
  171.     /**
  172.      * @return File|null
  173.      */
  174.     public function getPhoto(): ?File
  175.     {
  176.         return $this->photo;
  177.     }
  178.     /**
  179.      * @param File|null $photo
  180.      */
  181.     public function setPhoto(?File $photo): void
  182.     {
  183.         $this->photo $photo;
  184.     }
  185.     /**
  186.      * @return ArrayCollection|Collection
  187.      */
  188.     public function getPhotos()
  189.     {
  190.         return $this->photos;
  191.     }
  192.     /**
  193.      * @param ArrayCollection|Collection $photos
  194.      */
  195.     public function setPhotos($photos): void
  196.     {
  197.         $this->photos $photos;
  198.     }
  199.     public function addPhotoFile(File $file)
  200.     {
  201.         $this->photos->add($file);
  202.     }
  203. }