From 8933d7c61d4c69b56cc7597970abd47f75c0a008 Mon Sep 17 00:00:00 2001 From: Tchama Date: Fri, 24 Jul 2020 18:17:55 +0200 Subject: [PATCH] sf4 deprecated, adding annotations in Entity --- Entity/ThirdParty.php | 53 +++++++++++++++++++++++++++++++------------ 1 file changed, 39 insertions(+), 14 deletions(-) diff --git a/Entity/ThirdParty.php b/Entity/ThirdParty.php index 2d01ff442..62d12694b 100644 --- a/Entity/ThirdParty.php +++ b/Entity/ThirdParty.php @@ -24,6 +24,7 @@ namespace Chill\ThirdPartyBundle\Entity; use Doctrine\ORM\Mapping as ORM; use Doctrine\Common\Collections\Collection; +use Doctrine\Common\Collections\ArrayCollection; use Chill\MainBundle\Entity\Center; use Symfony\Component\Validator\Constraints as Assert; use Chill\MainBundle\Entity\Address; @@ -92,14 +93,12 @@ class ThirdParty private $type; /** - * * @var boolean * @ORM\Column(name="active", type="boolean", options={"defaut": true}) */ private $active = true; /** - * * @var Collection instances of Center * @ORM\ManyToMany(targetEntity="\Chill\MainBundle\Entity\Center") * @ORM\JoinTable(name="chill_3party.party_center") @@ -108,17 +107,18 @@ class ThirdParty private $centers; /** - * * @var Address|null * @ORM\ManyToOne(targetEntity="\Chill\MainBundle\Entity\Address", * cascade={"persist", "remove"}) - * */ private $address; + /** + * ThirdParty constructor. + */ public function __construct() { - $this->centers = new \Doctrine\Common\Collections\ArrayCollection(); + $this->centers = new ArrayCollection(); } /** @@ -135,7 +135,6 @@ class ThirdParty * Set name. * * @param string $name - * * @return ThirdParty */ public function setName($name) @@ -159,7 +158,6 @@ class ThirdParty * Set telephone. * * @param string|null $telephone - * * @return ThirdParty */ public function setTelephone($telephone = null) @@ -183,7 +181,6 @@ class ThirdParty * Set email. * * @param string|null $email - * * @return ThirdParty */ public function setEmail($email = null) @@ -207,7 +204,6 @@ class ThirdParty * Set comment. * * @param string|null $comment - * * @return ThirdParty */ public function setComment($comment = null) @@ -231,7 +227,6 @@ class ThirdParty * Set type. * * @param array|null $type - * * @return ThirdParty */ public function setType(array $type = null) @@ -252,22 +247,35 @@ class ThirdParty return $this->type; } + /** + * @return bool + */ public function getActive(): bool { return $this->active; } - + + /** + * @return Collection + */ public function getCenters(): Collection { return $this->centers; } - + + /** + * @param bool $active + * @return $this + */ public function setActive(bool $active) { $this->active = $active; return $this; } + /** + * @param Center $center + */ public function addCenter(Center $center) { if (FALSE === $this->centers->contains($center)) { @@ -275,13 +283,20 @@ class ThirdParty } } + /** + * @param Center $center + */ public function removeCenter(Center $center) { if ($this->centers->contains($center)) { $this->centers->removeElement($center); } } - + + /** + * @param Collection $centers + * @return $this + */ public function setCenters(Collection $centers) { foreach ($centers as $center) { @@ -297,11 +312,18 @@ class ThirdParty return $this; } + /** + * @return Address|null + */ public function getAddress(): ?Address { return $this->address; } - + + /** + * @param Address $address + * @return $this + */ public function setAddress(Address $address) { $this->address = $address; @@ -309,6 +331,9 @@ class ThirdParty return $this; } + /** + * @return string + */ public function __toString() { return $this->getName();