src/Entity/ValueDeclination.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ValueDeclinationRepository;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use JsonSerializable;
  7. /**
  8.  * @ORM\Entity(repositoryClass=ValueDeclinationRepository::class)
  9.  */
  10. class ValueDeclination implements JsonSerializable
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\Column(type="string", length=255)
  20.      */
  21.     private $name;
  22.     /**
  23.      * @ORM\ManyToOne(targetEntity=Declination::class, inversedBy="valueDeclinations")
  24.      */
  25.     private $declination;
  26.     /**
  27.      * @ORM\Column(type="string", length=255, nullable=true)
  28.      */
  29.     private $code;
  30.     /**
  31.      * @ORM\OneToMany(targetEntity=ValueDeclination::class, mappedBy="parent")
  32.      */
  33.     private $subValueDeclinations;
  34.     /**
  35.      * @ORM\ManyToOne(targetEntity=ValueDeclination::class, inversedBy="subValueDeclinations")
  36.      */
  37.     private $parent;
  38.     public function getId(): ?int
  39.     {
  40.         return $this->id;
  41.     }
  42.     public function getName(): ?string
  43.     {
  44.         return $this->name;
  45.     }
  46.     public function setName(string $name): self
  47.     {
  48.         $this->name $name;
  49.         return $this;
  50.     }
  51.     public function getDeclination(): ?Declination
  52.     {
  53.         return $this->declination;
  54.     }
  55.     public function setDeclination(?Declination $declination): self
  56.     {
  57.         $this->declination $declination;
  58.         return $this;
  59.     }
  60.     public function getCode(): ?string
  61.     {
  62.         return $this->code;
  63.     }
  64.     public function setCode(?string $code): self
  65.     {
  66.         $this->code $code;
  67.         return $this;
  68.     }
  69.     /**
  70.      * @return self[]
  71.      */
  72.     public function getParent(): ?self
  73.     {
  74.         return $this->parent;
  75.     }
  76.     public function setParent(?self $parent): ?self
  77.     {
  78.         $this->parent $parent;
  79.         return $this;
  80.     }
  81.     /**
  82.      * @return Collection|self[]
  83.      */
  84.     public function getSubValueDeclinations(): Collection
  85.     {
  86.         return $this->subValueDeclinations;
  87.     }
  88.     public function jsonSerialize()
  89.     {
  90.         return array(
  91.             'id' => $this->getId(),
  92.             'name' => $this->getName(),
  93.         );
  94.     }
  95. }