| @@ 18-60 (lines=43) @@ | ||
| 15 | * @ORM\Entity(repositoryClass="App\Repository\CategoryRepository") |
|
| 16 | * @UniqueEntity("slug") |
|
| 17 | */ |
|
| 18 | class Category |
|
| 19 | { |
|
| 20 | use EntityIdTrait; |
|
| 21 | use EntityNameTrait; |
|
| 22 | ||
| 23 | /** |
|
| 24 | * @ORM\OneToMany(targetEntity="App\Entity\Property", mappedBy="category") |
|
| 25 | */ |
|
| 26 | private $properties; |
|
| 27 | ||
| 28 | public function __construct() |
|
| 29 | { |
|
| 30 | $this->properties = new ArrayCollection(); |
|
| 31 | } |
|
| 32 | ||
| 33 | public function getProperties(): Collection |
|
| 34 | { |
|
| 35 | return $this->properties; |
|
| 36 | } |
|
| 37 | ||
| 38 | public function addProperty(Property $property): self |
|
| 39 | { |
|
| 40 | if (!$this->properties->contains($property)) { |
|
| 41 | $this->properties[] = $property; |
|
| 42 | $property->setCategory($this); |
|
| 43 | } |
|
| 44 | ||
| 45 | return $this; |
|
| 46 | } |
|
| 47 | ||
| 48 | public function removeProperty(Property $property): self |
|
| 49 | { |
|
| 50 | if ($this->properties->contains($property)) { |
|
| 51 | $this->properties->removeElement($property); |
|
| 52 | // set the owning side to null (unless already changed) |
|
| 53 | if ($property->getCategory() === $this) { |
|
| 54 | $property->setCategory(null); |
|
| 55 | } |
|
| 56 | } |
|
| 57 | ||
| 58 | return $this; |
|
| 59 | } |
|
| 60 | } |
|
| 61 | ||
| @@ 18-60 (lines=43) @@ | ||
| 15 | * @ORM\Entity(repositoryClass="App\Repository\DealTypeRepository") |
|
| 16 | * @UniqueEntity("slug") |
|
| 17 | */ |
|
| 18 | class DealType |
|
| 19 | { |
|
| 20 | use EntityIdTrait; |
|
| 21 | use EntityNameTrait; |
|
| 22 | ||
| 23 | /** |
|
| 24 | * @ORM\OneToMany(targetEntity="App\Entity\Property", mappedBy="deal_type") |
|
| 25 | */ |
|
| 26 | private $properties; |
|
| 27 | ||
| 28 | public function __construct() |
|
| 29 | { |
|
| 30 | $this->properties = new ArrayCollection(); |
|
| 31 | } |
|
| 32 | ||
| 33 | public function getProperties(): Collection |
|
| 34 | { |
|
| 35 | return $this->properties; |
|
| 36 | } |
|
| 37 | ||
| 38 | public function addProperty(Property $property): self |
|
| 39 | { |
|
| 40 | if (!$this->properties->contains($property)) { |
|
| 41 | $this->properties[] = $property; |
|
| 42 | $property->setDealType($this); |
|
| 43 | } |
|
| 44 | ||
| 45 | return $this; |
|
| 46 | } |
|
| 47 | ||
| 48 | public function removeProperty(Property $property): self |
|
| 49 | { |
|
| 50 | if ($this->properties->contains($property)) { |
|
| 51 | $this->properties->removeElement($property); |
|
| 52 | // set the owning side to null (unless already changed) |
|
| 53 | if ($property->getDealType() === $this) { |
|
| 54 | $property->setDealType(null); |
|
| 55 | } |
|
| 56 | } |
|
| 57 | ||
| 58 | return $this; |
|
| 59 | } |
|
| 60 | } |
|
| 61 | ||