|
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- <?php
-
- namespace Lc\PietroBundle\Model\Thematic;
-
- use Doctrine\Common\Collections\ArrayCollection;
- use Doctrine\Common\Collections\Collection;
- use Doctrine\ORM\Mapping as ORM;
- use Lc\PietroBundle\Model\Subthematic\SubthematicInterface;
- use Lc\SovBundle\Doctrine\EntityInterface;
-
- /**
- * @ORM\MappedSuperclass()
- */
- abstract class Thematic implements ThematicInterface, EntityInterface
- {
-
- /**
- * @ORM\Column(type="string", length=255)
- */
- protected $name;
-
- /**
- * @ORM\OneToMany(targetEntity="Lc\PietroBundle\Model\Subthematic\SubthematicInterface", mappedBy="thematic", cascade={"persist", "remove"})
- */
- protected $subthematic;
-
-
- public function __construct()
- {
- $this->subthematic = new ArrayCollection();
- }
-
- public function __toString()
- {
- return $this->name;
- }
-
- public function getName(): ?string
- {
- return $this->name;
- }
-
- public function setName(string $name): self
- {
- $this->name = $name;
-
- return $this;
- }
-
- /**
- * @return Collection|SubthematicInterface[]
- */
- public function getSubthematic(): Collection
- {
- return $this->subthematic;
- }
-
- public function addSubthematic(SubthematicInterface $subthematic): self
- {
- if (!$this->subthematic->contains($subthematic)) {
- $this->subthematic[] = $subthematic;
- $subthematic->setThematic($this);
- }
-
- return $this;
- }
-
- public function removeSubthematic(SubthematicInterface $subthematic): self
- {
- if ($this->subthematic->removeElement($subthematic)) {
- // set the owning side to null (unless already changed)
- if ($subthematic->getThematic() === $this) {
- $subthematic->setThematic(null);
- }
- }
-
- return $this;
- }
- }
|