sf4 deprecated, adding annotations in Entity

This commit is contained in:
Tchama 2020-07-24 18:17:55 +02:00
parent 4dc2aefb5b
commit 8933d7c61d

View File

@ -24,6 +24,7 @@ namespace Chill\ThirdPartyBundle\Entity;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\Collection;
use Doctrine\Common\Collections\ArrayCollection;
use Chill\MainBundle\Entity\Center; use Chill\MainBundle\Entity\Center;
use Symfony\Component\Validator\Constraints as Assert; use Symfony\Component\Validator\Constraints as Assert;
use Chill\MainBundle\Entity\Address; use Chill\MainBundle\Entity\Address;
@ -92,14 +93,12 @@ class ThirdParty
private $type; private $type;
/** /**
*
* @var boolean * @var boolean
* @ORM\Column(name="active", type="boolean", options={"defaut": true}) * @ORM\Column(name="active", type="boolean", options={"defaut": true})
*/ */
private $active = true; private $active = true;
/** /**
*
* @var Collection instances of Center * @var Collection instances of Center
* @ORM\ManyToMany(targetEntity="\Chill\MainBundle\Entity\Center") * @ORM\ManyToMany(targetEntity="\Chill\MainBundle\Entity\Center")
* @ORM\JoinTable(name="chill_3party.party_center") * @ORM\JoinTable(name="chill_3party.party_center")
@ -108,17 +107,18 @@ class ThirdParty
private $centers; private $centers;
/** /**
*
* @var Address|null * @var Address|null
* @ORM\ManyToOne(targetEntity="\Chill\MainBundle\Entity\Address", * @ORM\ManyToOne(targetEntity="\Chill\MainBundle\Entity\Address",
* cascade={"persist", "remove"}) * cascade={"persist", "remove"})
*
*/ */
private $address; private $address;
/**
* ThirdParty constructor.
*/
public function __construct() public function __construct()
{ {
$this->centers = new \Doctrine\Common\Collections\ArrayCollection(); $this->centers = new ArrayCollection();
} }
/** /**
@ -135,7 +135,6 @@ class ThirdParty
* Set name. * Set name.
* *
* @param string $name * @param string $name
*
* @return ThirdParty * @return ThirdParty
*/ */
public function setName($name) public function setName($name)
@ -159,7 +158,6 @@ class ThirdParty
* Set telephone. * Set telephone.
* *
* @param string|null $telephone * @param string|null $telephone
*
* @return ThirdParty * @return ThirdParty
*/ */
public function setTelephone($telephone = null) public function setTelephone($telephone = null)
@ -183,7 +181,6 @@ class ThirdParty
* Set email. * Set email.
* *
* @param string|null $email * @param string|null $email
*
* @return ThirdParty * @return ThirdParty
*/ */
public function setEmail($email = null) public function setEmail($email = null)
@ -207,7 +204,6 @@ class ThirdParty
* Set comment. * Set comment.
* *
* @param string|null $comment * @param string|null $comment
*
* @return ThirdParty * @return ThirdParty
*/ */
public function setComment($comment = null) public function setComment($comment = null)
@ -231,7 +227,6 @@ class ThirdParty
* Set type. * Set type.
* *
* @param array|null $type * @param array|null $type
*
* @return ThirdParty * @return ThirdParty
*/ */
public function setType(array $type = null) public function setType(array $type = null)
@ -252,22 +247,35 @@ class ThirdParty
return $this->type; return $this->type;
} }
/**
* @return bool
*/
public function getActive(): bool public function getActive(): bool
{ {
return $this->active; return $this->active;
} }
/**
* @return Collection
*/
public function getCenters(): Collection public function getCenters(): Collection
{ {
return $this->centers; return $this->centers;
} }
/**
* @param bool $active
* @return $this
*/
public function setActive(bool $active) public function setActive(bool $active)
{ {
$this->active = $active; $this->active = $active;
return $this; return $this;
} }
/**
* @param Center $center
*/
public function addCenter(Center $center) public function addCenter(Center $center)
{ {
if (FALSE === $this->centers->contains($center)) { if (FALSE === $this->centers->contains($center)) {
@ -275,13 +283,20 @@ class ThirdParty
} }
} }
/**
* @param Center $center
*/
public function removeCenter(Center $center) public function removeCenter(Center $center)
{ {
if ($this->centers->contains($center)) { if ($this->centers->contains($center)) {
$this->centers->removeElement($center); $this->centers->removeElement($center);
} }
} }
/**
* @param Collection $centers
* @return $this
*/
public function setCenters(Collection $centers) public function setCenters(Collection $centers)
{ {
foreach ($centers as $center) { foreach ($centers as $center) {
@ -297,11 +312,18 @@ class ThirdParty
return $this; return $this;
} }
/**
* @return Address|null
*/
public function getAddress(): ?Address public function getAddress(): ?Address
{ {
return $this->address; return $this->address;
} }
/**
* @param Address $address
* @return $this
*/
public function setAddress(Address $address) public function setAddress(Address $address)
{ {
$this->address = $address; $this->address = $address;
@ -309,6 +331,9 @@ class ThirdParty
return $this; return $this;
} }
/**
* @return string
*/
public function __toString() public function __toString()
{ {
return $this->getName(); return $this->getName();