<?php
namespace App\Entity;
use App\Repository\ValueDeclinationRepository;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use JsonSerializable;
/**
* @ORM\Entity(repositoryClass=ValueDeclinationRepository::class)
*/
class ValueDeclination implements JsonSerializable
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $name;
/**
* @ORM\ManyToOne(targetEntity=Declination::class, inversedBy="valueDeclinations")
*/
private $declination;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $code;
/**
* @ORM\OneToMany(targetEntity=ValueDeclination::class, mappedBy="parent")
*/
private $subValueDeclinations;
/**
* @ORM\ManyToOne(targetEntity=ValueDeclination::class, inversedBy="subValueDeclinations")
*/
private $parent;
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getDeclination(): ?Declination
{
return $this->declination;
}
public function setDeclination(?Declination $declination): self
{
$this->declination = $declination;
return $this;
}
public function getCode(): ?string
{
return $this->code;
}
public function setCode(?string $code): self
{
$this->code = $code;
return $this;
}
/**
* @return self[]
*/
public function getParent(): ?self
{
return $this->parent;
}
public function setParent(?self $parent): ?self
{
$this->parent = $parent;
return $this;
}
/**
* @return Collection|self[]
*/
public function getSubValueDeclinations(): Collection
{
return $this->subValueDeclinations;
}
public function jsonSerialize()
{
return array(
'id' => $this->getId(),
'name' => $this->getName(),
);
}
}