src/Entity/Media/Quality.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Media;
  3. use App\Entity\Media\Document;
  4. use Gedmo\Mapping\Annotation as Gedmo;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Symfony\Component\Validator\Constraints as Assert;
  9. /**
  10.  * @ORM\Entity(repositoryClass="App\Repository\Media\QualityRepository")
  11.  * @ORM\Table(name="qualities")
  12.  */
  13. class Quality
  14. {
  15.     /**
  16.      * @ORM\Id
  17.      * @ORM\Column(type="integer")
  18.      * @ORM\GeneratedValue(strategy="AUTO")
  19.      */
  20.     private $id;
  21.     /**
  22.      * @ORM\Column(type="string", length=255, nullable=false)
  23.      * @Assert\NotBlank()
  24.      */
  25.     private $name;
  26.     
  27.     /**
  28.      * @ORM\Column(type="string", length=255, nullable=false)
  29.      * @Assert\NotBlank()
  30.      */
  31.     private $code;
  32.     /**
  33.      * @ORM\Column(type="datetime", nullable=false, name="created_date")
  34.      * @Gedmo\Timestampable(on="create")
  35.      */
  36.     private $createdDate;
  37.     /**
  38.      * @ORM\Column(type="datetime", nullable=true, name="updated_date")
  39.      * @Gedmo\Timestampable(on="update")
  40.      */
  41.     private $updatedDate;
  42.     
  43.     /**
  44.      * @ORM\OneToMany(targetEntity="App\Entity\Media\Document", mappedBy="quality")
  45.      */
  46.     private $documents;
  47.     /**
  48.      * @ORM\Column(type="integer", nullable=true, name="status")
  49.      */
  50.     private $status 1;
  51.     
  52.     /**
  53.      * @ORM\Column(type="integer", nullable=false, name="position")
  54.      */
  55.     private $position 1;
  56.    
  57.     public function __construct()
  58.     {
  59.         $this->documents = new ArrayCollection();
  60.     }
  61.     public function getId(): ?int
  62.     {
  63.         return $this->id;
  64.     }
  65.     public function getName(): ?string
  66.     {
  67.         return $this->name;
  68.     }
  69.     public function setName(string $name): self
  70.     {
  71.         $this->name $name;
  72.         return $this;
  73.     }
  74.     
  75.     public function getCode(): ?string
  76.     {
  77.         return $this->code;
  78.     }
  79.     
  80.     public function setCode(string $code): self
  81.     {
  82.         $this->code $code;
  83.         
  84.         return $this;
  85.     }
  86.     public function getCreatedDate(): ?\DateTimeInterface
  87.     {
  88.         return $this->createdDate;
  89.     }
  90.    
  91.     public function getUpdatedDate(): ?\DateTimeInterface
  92.     {
  93.         return $this->updatedDate;
  94.     }
  95.   
  96.     public function getStatus(): ?int
  97.     {
  98.         return $this->status;
  99.     }
  100.     public function setStatus(?int $status): self
  101.     {
  102.         $this->status $status;
  103.         return $this;
  104.     }
  105.     
  106.     public function getPosition(): ?int
  107.     {
  108.         return $this->position;
  109.     }
  110.     
  111.     public function setPosition(int $position): self
  112.     {
  113.         $this->position $position;
  114.         
  115.         return $this;
  116.     }
  117.     
  118.     /**
  119.      * @return Collection|Document[]
  120.      */
  121.     public function getDocuments(): Collection
  122.     {
  123.         return $this->documents;
  124.     }
  125.     
  126.     public function addDocument(Document $document): self
  127.     {
  128.         if (!$this->documents->contains($document)) {
  129.             $this->documents[] = $document;
  130.         }
  131.         
  132.         return $this;
  133.     }
  134.     
  135.     public function removeDocument(Document $document): self
  136.     {
  137.         if ($this->documents->contains($document)) {
  138.             $this->documents->removeElement($document);
  139.         }
  140.         
  141.         return $this;
  142.     }
  143.     
  144.     public function __toString()
  145.     {
  146.         return $this->getCode().' - '.$this->getName();
  147.     }
  148. }