From e88e9b1a6f26a58984d0d5d73133ea7dc8568a8a Mon Sep 17 00:00:00 2001 From: nobohan Date: Tue, 25 May 2021 14:38:09 +0200 Subject: [PATCH] addresses: add groups annotation to Country, postal code & address reference --- .../Entity/AddressReference.php | 9 +++++++++ src/Bundle/ChillMainBundle/Entity/Country.php | 19 ++++++++++++------- .../ChillMainBundle/Entity/PostalCode.php | 5 +++++ 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Entity/AddressReference.php b/src/Bundle/ChillMainBundle/Entity/AddressReference.php index b1fca205d..d13de4de9 100644 --- a/src/Bundle/ChillMainBundle/Entity/AddressReference.php +++ b/src/Bundle/ChillMainBundle/Entity/AddressReference.php @@ -4,6 +4,7 @@ namespace Chill\MainBundle\Entity; use Doctrine\ORM\Mapping as ORM; use Chill\MainBundle\Doctrine\Model\Point; +use Symfony\Component\Serializer\Annotation\Groups; /** * @ORM\Entity() @@ -16,21 +17,25 @@ class AddressReference * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") + * @groups({"read"}) */ private $id; /** * @ORM\Column(type="string", length=255) + * @groups({"read"}) */ private $refId; /** * @ORM\Column(type="string", length=255, nullable=true) + * @groups({"read"}) */ private $street; /** * @ORM\Column(type="string", length=255, nullable=true) + * @groups({"read"}) */ private $streetNumber; @@ -38,16 +43,19 @@ class AddressReference * @var PostalCode * * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\PostalCode") + * @groups({"read"}) */ private $postcode; /** * @ORM\Column(type="string", length=255, nullable=true) + * @groups({"read"}) */ private $municipalityCode; /** * @ORM\Column(type="string", length=255, nullable=true) + * @groups({"read"}) */ private $source; @@ -57,6 +65,7 @@ class AddressReference * @var Point * * @ORM\Column(type="point") + * @groups({"read"}) */ private $point; diff --git a/src/Bundle/ChillMainBundle/Entity/Country.php b/src/Bundle/ChillMainBundle/Entity/Country.php index f8f68c3f3..932944d03 100644 --- a/src/Bundle/ChillMainBundle/Entity/Country.php +++ b/src/Bundle/ChillMainBundle/Entity/Country.php @@ -3,6 +3,7 @@ namespace Chill\MainBundle\Entity; use Doctrine\ORM\Mapping as ORM; +use Symfony\Component\Serializer\Annotation\Groups; /** * Country @@ -20,6 +21,7 @@ class Country * @ORM\Id * @ORM\Column(name="id", type="integer") * @ORM\GeneratedValue(strategy="AUTO") + * @groups({"read"}) */ private $id; @@ -27,13 +29,16 @@ class Country * @var string * * @ORM\Column(type="json_array") + * @groups({"read"}) + * */ private $name; - + /** * @var string * * @ORM\Column(type="string", length=3) + * @groups({"read"}) */ private $countryCode; @@ -41,7 +46,7 @@ class Country /** * Get id * - * @return integer + * @return integer */ public function getId() { @@ -57,20 +62,20 @@ class Country public function setName($name) { $this->name = $name; - + return $this; } /** * Get name * - * @return string + * @return string */ public function getName() { return $this->name; } - + /** * @return string */ @@ -90,12 +95,12 @@ class Country /** * - * @param string $countryCode + * @param string $countryCode */ public function setCountryCode($countryCode) { $this->countryCode = $countryCode; return $this; } - + } diff --git a/src/Bundle/ChillMainBundle/Entity/PostalCode.php b/src/Bundle/ChillMainBundle/Entity/PostalCode.php index 3cff0a6bf..a70a955b8 100644 --- a/src/Bundle/ChillMainBundle/Entity/PostalCode.php +++ b/src/Bundle/ChillMainBundle/Entity/PostalCode.php @@ -3,6 +3,7 @@ namespace Chill\MainBundle\Entity; use Doctrine\ORM\Mapping as ORM; +use Symfony\Component\Serializer\Annotation\Groups; /** * PostalCode @@ -25,6 +26,7 @@ class PostalCode * @ORM\Id * @ORM\Column(name="id", type="integer") * @ORM\GeneratedValue(strategy="AUTO") + * @groups({"read"}) */ private $id; @@ -32,6 +34,7 @@ class PostalCode * @var string * * @ORM\Column(type="string", length=255, name="label") + * @groups({"read"}) */ private $name; @@ -39,6 +42,7 @@ class PostalCode * @var string * * @ORM\Column(type="string", length=100) + * @groups({"read"}) */ private $code; @@ -46,6 +50,7 @@ class PostalCode * @var Country * * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Country") + * @groups({"read"}) */ private $country;