src/Entity/Otpusk/ImagesCategory.php line 20

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Otpusk;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. /**
  7.  * @ORM\Entity(repositoryClass="App\Repository\Otpusk\ImagesCategoryRepository")
  8.  *
  9.  * @ORM\Table(
  10.  *     name="imagesCategory",
  11.  *     options={
  12.  *          "charset":"utf8",
  13.  *          "engine": "InnoDB"
  14.  *      }
  15.  * )
  16.  */
  17. class ImagesCategory
  18. {
  19.     /**
  20.      * @ORM\Id()
  21.      * @ORM\GeneratedValue()
  22.      * @ORM\Column(type="smallint", options={"unsigned"=true})
  23.      */
  24.     private $id;
  25.     /**
  26.      * @ORM\Column(name="fName", type="string", length=255)
  27.      */
  28.     private $name;
  29.     /**
  30.      * @ORM\OneToMany(targetEntity="App\Entity\Otpusk\Image", mappedBy="category", cascade={"persist"})
  31.      */
  32.     private $images;
  33.     /**
  34.      * @ORM\Column(name="fNameUkr", type="string", length=255)
  35.      */
  36.     private $nameUkr;
  37.     public function __construct()
  38.     {
  39.         $this->images = new ArrayCollection();
  40.     }
  41.     public function getId(): ?int
  42.     {
  43.         return $this->id;
  44.     }
  45.     public function getName(): ?string
  46.     {
  47.         return $this->name;
  48.     }
  49.     public function setName(string $name): self
  50.     {
  51.         $this->name $name;
  52.         return $this;
  53.     }
  54.     /**
  55.      * @return Collection|Image[]
  56.      */
  57.     public function getImages(): Collection
  58.     {
  59.         return $this->images;
  60.     }
  61.     public function addImage(Image $image): self
  62.     {
  63.         if (!$this->images->contains($image)) {
  64.             $this->images[] = $image;
  65.             $image->setCategory($this);
  66.         }
  67.         return $this;
  68.     }
  69.     public function removeImage(Image $image): self
  70.     {
  71.         if ($this->images->contains($image)) {
  72.             $this->images->removeElement($image);
  73.             // set the owning side to null (unless already changed)
  74.             if ($image->getCategory() === $this) {
  75.                 $image->setCategory(null);
  76.             }
  77.         }
  78.         return $this;
  79.     }
  80.     public function __toString()
  81.     {
  82.         return $this->getName();
  83.     }
  84.     public function getNameUkr(): ?string
  85.     {
  86.         return $this->nameUkr;
  87.     }
  88.     public function setNameUkr(string $nameUkr): self
  89.     {
  90.         $this->nameUkr $nameUkr;
  91.         return $this;
  92.     }
  93. }