From d8ea4459e095e448e15a1c3151a94b4782ea5582 Mon Sep 17 00:00:00 2001 From: Sylry Date: Tue, 2 Aug 2022 18:37:09 +0200 Subject: [PATCH 01/16] Update php compatibility --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index b004316..24af97c 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ } ], "require": { - "php": "^7.2.8", + "php": ">=7.2.8", "commerceguys/addressing": "^1", "doctrine/orm": "^2.6", "symfony/form": "^4.4 | ^5.3", From 686317ff8ed472c207a02af230670819c598d6c4 Mon Sep 17 00:00:00 2001 From: Sylry Date: Tue, 14 Mar 2023 12:50:55 +0100 Subject: [PATCH 02/16] Add required attribute on form --- .../AddressEmbeddableTypeSubscriber.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Form/EventListener/AddressEmbeddableTypeSubscriber.php b/Form/EventListener/AddressEmbeddableTypeSubscriber.php index f78e63b..bd302e6 100644 --- a/Form/EventListener/AddressEmbeddableTypeSubscriber.php +++ b/Form/EventListener/AddressEmbeddableTypeSubscriber.php @@ -113,8 +113,18 @@ public function preSetData(FormEvent $event): void ], ]; } - foreach (AddressFormatHelper::getGroupedFields($addressFormat->getFormat(), $this->getFieldOverrides($form)) as $line_index => $line_fields) { + + $fieldOverrides = $this->getFieldOverrides($form); + $requiredFields = AddressFormatHelper::getRequiredFields($addressFormat, $fieldOverrides); + + foreach (AddressFormatHelper::getGroupedFields($addressFormat->getFormat(), $fieldOverrides) as $line_index => $line_fields) { foreach ($line_fields as $field_index => $field) { + if (in_array($field, $requiredFields)) { + $element_options['required'] = true; + } elseif (isset($element_options['required'])) { + unset($element_options['required']); + } + $form->add( $field, null, From b6c7e8fdbeeff9e70decd7455a05cac26237f435 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Stein?= Date: Fri, 23 Dec 2022 14:23:23 +0100 Subject: [PATCH 03/16] Update README.md --- README.md | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index b2173e6..d4f7871 100644 --- a/README.md +++ b/README.md @@ -69,32 +69,37 @@ You need to add an address field as an ORM Embedded property. namespace App\Entity; +use App\Repository\InstallationAddressRepository; use Daften\Bundle\AddressingBundle\Entity\AddressEmbeddable; use Daften\Bundle\AddressingBundle\Validator\Constraints as AddressingBundleAssert; use Doctrine\ORM\Mapping as ORM; -/** - * @ORM\Entity(repositoryClass="App\Repository\InstallationAddressRepository") - */ +#[ORM\Entity(repositoryClass: InstallationAddressRepository::class)] class AddressExample { - /** - * @ORM\Embedded(class="Daften\Bundle\AddressingBundle\Entity\AddressEmbeddable") - * @AddressingBundleAssert\EmbeddedAddressFormatConstraint(fields={ - * "locale", - * "addressLine1", - * "postalCode", - * "locality", - * "countryCode", - * }) - */ - private $address; + + #[ORM\Embedded(class: AddressEmbeddable::class)] + #[AddressingBundleAssert\EmbeddedAddressFormatConstraint(fields: [ + 'addressLine1' + 'postalCode' + 'locality' + 'organization' + 'givenName' + 'familyName' + 'addressLine2' + 'additionalName' + 'administrativeArea' + 'dependentLocality' + 'sortingCode' + ])] + private AddressEmbeddable $address; /** * AddressExample constructor. */ public function __construct() { + $this->address = new AddressEmbeddable(); } /** From 71b71317fc9058258e3e50692ddbe174f04c2709 Mon Sep 17 00:00:00 2001 From: Sylry Date: Fri, 17 Nov 2023 10:37:11 +0100 Subject: [PATCH 04/16] Fix changing country with different fields Example: from a country with a postal code to a country without postal code it will trigger an error for the postal code field when you submit the form: "This value should be blank" --- .../EventListener/AddressEmbeddableTypeSubscriber.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Form/EventListener/AddressEmbeddableTypeSubscriber.php b/Form/EventListener/AddressEmbeddableTypeSubscriber.php index bd302e6..5be5cc2 100644 --- a/Form/EventListener/AddressEmbeddableTypeSubscriber.php +++ b/Form/EventListener/AddressEmbeddableTypeSubscriber.php @@ -174,6 +174,17 @@ public function preSubmit(FormEvent $event): void foreach ($unused_fields as $field) { $form->remove($field); } + + if ($form->getData() !== $data) { + $addressEmbeddable = new AddressEmbeddable(); + foreach ($data as $field => $value) { + $method = 'set'.ucfirst($field); + if (method_exists($addressEmbeddable, $method)) { + $addressEmbeddable->{$method}($value); + } + } + $form->setData($addressEmbeddable); + } } private function getFieldOverrides(FormInterface $form) From 74af9afe7376e6a2f8a1e566ae93985e20b18a25 Mon Sep 17 00:00:00 2001 From: Rafal Kozlowski Date: Thu, 23 Nov 2023 13:37:31 +0100 Subject: [PATCH 05/16] Update dependencies versions --- composer.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.json b/composer.json index 24af97c..7b0f045 100644 --- a/composer.json +++ b/composer.json @@ -11,11 +11,11 @@ } ], "require": { - "php": ">=7.2.8", - "commerceguys/addressing": "^1", + "php": ">=7.2.8 | ^8.0", + "commerceguys/addressing": "^2", "doctrine/orm": "^2.6", - "symfony/form": "^4.4 | ^5.3", - "symfony/framework-bundle": "^4.4 | ^5.3" + "symfony/form": "^4.4 | ^5.3 | ^6.0", + "symfony/framework-bundle": "^4.4 | ^5.3 | ^6.0" }, "require-dev": { "friendsofphp/php-cs-fixer": "^2.10", @@ -32,7 +32,7 @@ }, "extra": { "branch-alias": { - "dev-develop": "1.0-dev" + "dev-develop": "1.1-dev" } } } From f1a49d73de125e19aff844147ecb353a351e760a Mon Sep 17 00:00:00 2001 From: Rafal Kozlowski Date: Mon, 27 Nov 2023 19:15:32 +0100 Subject: [PATCH 06/16] Update dependencies versions --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 7b0f045..a0024a4 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ "symfony/framework-bundle": "^4.4 | ^5.3 | ^6.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^2.10", + "friendsofphp/php-cs-fixer": "^3.0", "symfony/phpunit-bridge": "^4.0" }, "config": { From bfb888cac4d0f627cf5db627fc1a17c80beb75e2 Mon Sep 17 00:00:00 2001 From: Rafal Kozlowski Date: Tue, 28 Nov 2023 09:43:57 +0100 Subject: [PATCH 07/16] Change package name and add authors entry --- composer.json | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index a0024a4..939b24a 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "daften/addressing-bundle", + "name": "outofbox/addressing-bundle", "description": "Provides an integration between commerceguys addressing package and Symfony.", "type": "library", "license": "MIT", @@ -8,6 +8,11 @@ { "name": "daften", "email": "dieterblomme@gmail.com" + }, + { + "name": "Out Of Box Lab", + "email": "github@outofboxlab.com", + "homepage": "https://outofboxlab.com" } ], "require": { From c1bcee3440f5029637d6a65d1bc3fb954b137864 Mon Sep 17 00:00:00 2001 From: Rafal Kozlowski Date: Tue, 28 Nov 2023 10:05:45 +0100 Subject: [PATCH 08/16] fix typo in the package name --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 939b24a..5998777 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "outofbox/addressing-bundle", + "name": "outofboxlab/addressing-bundle", "description": "Provides an integration between commerceguys addressing package and Symfony.", "type": "library", "license": "MIT", From 9b617e721e6b7b9d3720438156e57ea1a8ac9f82 Mon Sep 17 00:00:00 2001 From: Rafal Kozlowski Date: Tue, 28 Nov 2023 13:26:31 +0100 Subject: [PATCH 09/16] Add missing type hints --- Entity/AddressEmbeddable.php | 52 ++++++++++++++++++------------------ composer.json | 4 +-- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/Entity/AddressEmbeddable.php b/Entity/AddressEmbeddable.php index 8b34a9d..5d6bc0c 100644 --- a/Entity/AddressEmbeddable.php +++ b/Entity/AddressEmbeddable.php @@ -13,67 +13,67 @@ class AddressEmbeddable extends Address /** * @ORM\Column(type="string", nullable=true) */ - protected $locale; + protected string $locale; /** * @ORM\Column(type="string", nullable=true) */ - protected $givenName; + protected string $givenName; /** * @ORM\Column(type="string", nullable=true) */ - protected $additionalName; + protected string $additionalName; /** * @ORM\Column(type="string", nullable=true) */ - protected $familyName; + protected string $familyName; /** * @ORM\Column(type="string", nullable=true) */ - protected $organization; + protected string $organization; /** * @ORM\Column(type="string", nullable=true) */ - protected $addressLine1; + protected string $addressLine1; /** * @ORM\Column(type="string", nullable=true) */ - protected $addressLine2; + protected string $addressLine2; /** * @ORM\Column(type="string", nullable=true) */ - protected $postalCode; + protected string $postalCode; /** * @ORM\Column(type="string", nullable=true) */ - protected $sortingCode; + protected string $sortingCode; /** * @ORM\Column(type="string", nullable=true) */ - protected $locality; + protected string $locality; /** * @ORM\Column(type="string", nullable=true) */ - protected $dependentLocality; + protected string $dependentLocality; /** * @ORM\Column(type="string", nullable=true) */ - protected $administrativeArea; + protected string $administrativeArea; /** * @ORM\Column(type="string", length=2, nullable=true) */ - protected $countryCode; + protected string $countryCode; public function __toString(): string { @@ -96,7 +96,7 @@ public function __toString(): string /** * @return string */ - public function getLocale(): ?string + public function getLocale(): string { return $this->locale; } @@ -112,7 +112,7 @@ public function setLocale(string $locale = null): void /** * @return string */ - public function getAdditionalName(): ?string + public function getAdditionalName(): string { return $this->additionalName; } @@ -128,7 +128,7 @@ public function setAdditionalName(string $additionalName = null): void /** * @return string */ - public function getGivenName(): ?string + public function getGivenName(): string { return $this->givenName; } @@ -144,7 +144,7 @@ public function setGivenName(string $givenName = null): void /** * @return string */ - public function getFamilyName(): ?string + public function getFamilyName(): string { return $this->familyName; } @@ -160,7 +160,7 @@ public function setFamilyName(string $familyName = null): void /** * @return string */ - public function getOrganization(): ?string + public function getOrganization(): string { return $this->organization; } @@ -176,7 +176,7 @@ public function setOrganization(string $organization = null): void /** * @return string */ - public function getAddressLine1(): ?string + public function getAddressLine1(): string { return $this->addressLine1; } @@ -192,7 +192,7 @@ public function setAddressLine1($addressLine1 = null): void /** * @return string */ - public function getAddressLine2(): ?string + public function getAddressLine2(): string { return $this->addressLine2; } @@ -208,7 +208,7 @@ public function setAddressLine2(string $addressLine2 = null): void /** * @return string */ - public function getPostalCode(): ?string + public function getPostalCode(): string { return $this->postalCode; } @@ -224,7 +224,7 @@ public function setPostalCode(string $postalCode = null): void /** * @return string */ - public function getSortingCode(): ?string + public function getSortingCode(): string { return $this->sortingCode; } @@ -240,7 +240,7 @@ public function setSortingCode(string $sortingCode = null): void /** * @return string */ - public function getLocality(): ?string + public function getLocality(): string { return $this->locality; } @@ -256,7 +256,7 @@ public function setLocality(string $locality = null): void /** * @return string */ - public function getDependentLocality(): ?string + public function getDependentLocality(): string { return $this->dependentLocality; } @@ -272,7 +272,7 @@ public function setDependentLocality(string $dependentLocality = null): void /** * @return string */ - public function getAdministrativeArea(): ?string + public function getAdministrativeArea(): string { return $this->administrativeArea; } @@ -288,7 +288,7 @@ public function setAdministrativeArea(string $administrativeArea = null): void /** * @return string */ - public function getCountryCode(): ?string + public function getCountryCode(): string { return $this->countryCode; } diff --git a/composer.json b/composer.json index 5998777..d29fe83 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=7.2.8 | ^8.0", + "php": "^7.4 | ^8.0", "commerceguys/addressing": "^2", "doctrine/orm": "^2.6", "symfony/form": "^4.4 | ^5.3 | ^6.0", @@ -37,7 +37,7 @@ }, "extra": { "branch-alias": { - "dev-develop": "1.1-dev" + "dev-develop": "1.1.1-dev" } } } From f4a4378aff3b83ff412f1f11fe9dc3d4846aa0ad Mon Sep 17 00:00:00 2001 From: Rafal Kozlowski Date: Tue, 28 Nov 2023 13:37:33 +0100 Subject: [PATCH 10/16] bump the version number --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index d29fe83..627d1dc 100644 --- a/composer.json +++ b/composer.json @@ -37,7 +37,7 @@ }, "extra": { "branch-alias": { - "dev-develop": "1.1.1-dev" + "dev-develop": "1.1.2-dev" } } } From 53d19e2a3d54c26e9e94ac7ecd7a30c64387fe1e Mon Sep 17 00:00:00 2001 From: Rafal Kozlowski Date: Thu, 7 Dec 2023 15:28:01 +0100 Subject: [PATCH 11/16] Add default values to Address fields --- Entity/AddressEmbeddable.php | 197 +++++------------------------------ composer.json | 2 +- 2 files changed, 29 insertions(+), 170 deletions(-) diff --git a/Entity/AddressEmbeddable.php b/Entity/AddressEmbeddable.php index 5d6bc0c..fbfe82a 100644 --- a/Entity/AddressEmbeddable.php +++ b/Entity/AddressEmbeddable.php @@ -13,67 +13,69 @@ class AddressEmbeddable extends Address /** * @ORM\Column(type="string", nullable=true) */ - protected string $locale; + protected string $locale = 'und'; /** * @ORM\Column(type="string", nullable=true) */ - protected string $givenName; + protected string $givenName = ''; /** * @ORM\Column(type="string", nullable=true) */ - protected string $additionalName; + protected string $additionalName = ''; /** * @ORM\Column(type="string", nullable=true) */ - protected string $familyName; + protected string $familyName = ''; /** * @ORM\Column(type="string", nullable=true) */ - protected string $organization; + protected string $organization = ''; /** * @ORM\Column(type="string", nullable=true) */ - protected string $addressLine1; + protected string $addressLine1 = ''; /** * @ORM\Column(type="string", nullable=true) */ - protected string $addressLine2; + protected string $addressLine2 = ''; + + protected string $addressLine3 = ''; /** * @ORM\Column(type="string", nullable=true) */ - protected string $postalCode; + protected string $postalCode = ''; /** * @ORM\Column(type="string", nullable=true) */ - protected string $sortingCode; + protected string $sortingCode = ''; /** * @ORM\Column(type="string", nullable=true) */ - protected string $locality; + protected string $locality = ''; /** * @ORM\Column(type="string", nullable=true) */ - protected string $dependentLocality; + protected string $dependentLocality = ''; /** * @ORM\Column(type="string", nullable=true) */ - protected string $administrativeArea; + protected string $administrativeArea = ''; /** * @ORM\Column(type="string", length=2, nullable=true) */ - protected string $countryCode; + protected string $countryCode = ''; public function __toString(): string { @@ -93,210 +95,67 @@ public function __toString(): string ])); } - /** - * @return string - */ - public function getLocale(): string - { - return $this->locale; - } - - /** - * @param string $locale - */ - public function setLocale(string $locale = null): void + public function setLocale(string $locale): void { $this->locale = $locale; } - /** - * @return string - */ - public function getAdditionalName(): string - { - return $this->additionalName; - } - - /** - * @param string $additionalName - */ - public function setAdditionalName(string $additionalName = null): void + public function setAdditionalName(string $additionalName): void { $this->additionalName = $additionalName; } - /** - * @return string - */ - public function getGivenName(): string - { - return $this->givenName; - } - - /** - * @param string $givenName - */ - public function setGivenName(string $givenName = null): void + public function setGivenName(string $givenName): void { $this->givenName = $givenName; } - /** - * @return string - */ - public function getFamilyName(): string - { - return $this->familyName; - } - - /** - * @param string $familyName - */ - public function setFamilyName(string $familyName = null): void + public function setFamilyName(string $familyName): void { $this->familyName = $familyName; } - /** - * @return string - */ - public function getOrganization(): string - { - return $this->organization; - } - - /** - * @param string $organization - */ - public function setOrganization(string $organization = null): void + public function setOrganization(string $organization): void { $this->organization = $organization; } - /** - * @return string - */ - public function getAddressLine1(): string - { - return $this->addressLine1; - } - - /** - * @param string $addressLine1 - */ - public function setAddressLine1($addressLine1 = null): void + public function setAddressLine1(string $addressLine1): void { $this->addressLine1 = $addressLine1; } - /** - * @return string - */ - public function getAddressLine2(): string - { - return $this->addressLine2; - } - - /** - * @param string $addressLine2 - */ - public function setAddressLine2(string $addressLine2 = null): void + public function setAddressLine2(string $addressLine2): void { $this->addressLine2 = $addressLine2; } - /** - * @return string - */ - public function getPostalCode(): string - { - return $this->postalCode; - } - - /** - * @param string $postalCode - */ - public function setPostalCode(string $postalCode = null): void + public function setPostalCode(string $postalCode): void { $this->postalCode = $postalCode; } - /** - * @return string - */ - public function getSortingCode(): string - { - return $this->sortingCode; - } - - /** - * @param string $sortingCode - */ - public function setSortingCode(string $sortingCode = null): void + public function setSortingCode(string $sortingCode): void { $this->sortingCode = $sortingCode; } - /** - * @return string - */ - public function getLocality(): string - { - return $this->locality; - } - - /** - * @param string $locality - */ - public function setLocality(string $locality = null): void + public function setLocality(string $locality): void { $this->locality = $locality; } - /** - * @return string - */ - public function getDependentLocality(): string - { - return $this->dependentLocality; - } - - /** - * @param string $dependentLocality - */ - public function setDependentLocality(string $dependentLocality = null): void + public function setDependentLocality(string $dependentLocality): void { $this->dependentLocality = $dependentLocality; } - /** - * @return string - */ - public function getAdministrativeArea(): string - { - return $this->administrativeArea; - } - - /** - * @param string $administrativeArea - */ - public function setAdministrativeArea(string $administrativeArea = null): void + public function setAdministrativeArea(string $administrativeArea): void { $this->administrativeArea = $administrativeArea; } - /** - * @return string - */ - public function getCountryCode(): string - { - return $this->countryCode; - } - - /** - * @param string $countryCode - */ - public function setCountryCode(string $countryCode = NULL): void + public function setCountryCode(string $countryCode): void { $this->countryCode = $countryCode; } diff --git a/composer.json b/composer.json index 627d1dc..e8321f5 100644 --- a/composer.json +++ b/composer.json @@ -37,7 +37,7 @@ }, "extra": { "branch-alias": { - "dev-develop": "1.1.2-dev" + "dev-develop": "1.1.3-dev" } } } From c8502132d55ff16d6e739bb1caec86eeae14230e Mon Sep 17 00:00:00 2001 From: Rafal Kozlowski Date: Thu, 7 Dec 2023 19:49:41 +0100 Subject: [PATCH 12/16] Always return FieldOverrides object --- .../AddressEmbeddableTypeSubscriber.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Form/EventListener/AddressEmbeddableTypeSubscriber.php b/Form/EventListener/AddressEmbeddableTypeSubscriber.php index bd302e6..af01d45 100644 --- a/Form/EventListener/AddressEmbeddableTypeSubscriber.php +++ b/Form/EventListener/AddressEmbeddableTypeSubscriber.php @@ -6,6 +6,7 @@ use CommerceGuys\Addressing\AddressFormat\AddressField; use CommerceGuys\Addressing\AddressFormat\AddressFormatRepository; use CommerceGuys\Addressing\AddressFormat\AddressFormatRepositoryInterface; +use CommerceGuys\Addressing\AddressFormat\FieldOverrides; use CommerceGuys\Addressing\Subdivision\SubdivisionRepository; use CommerceGuys\Addressing\Subdivision\SubdivisionRepositoryInterface; use CommerceGuys\Addressing\Country\CountryRepository; @@ -176,26 +177,26 @@ public function preSubmit(FormEvent $event): void } } - private function getFieldOverrides(FormInterface $form) + private function getFieldOverrides(FormInterface $form): FieldOverrides { if (!$this->validator) { - return null; + return new FieldOverrides([]); } $formParent = $form->getParent(); if (!$formParent) { - return null; + return new FieldOverrides([]); } $parentEntity = $formParent->getData(); if (!is_object($parentEntity)) { - return null; + return new FieldOverrides([]); } try { $metadata = $this->validator->getMetadataFor(get_class($parentEntity)); } catch (NoSuchMetadataException $e) { - return null; + return new FieldOverrides([]); } $propertyMetadatas = $metadata->getPropertyMetadata($form->getName()); @@ -209,6 +210,6 @@ private function getFieldOverrides(FormInterface $form) } } - return null; + return new FieldOverrides([]); } } From 753eabd0d0242595ce2ff6da9642412d2dcade13 Mon Sep 17 00:00:00 2001 From: Rafal Kozlowski Date: Fri, 22 Dec 2023 11:29:53 +0100 Subject: [PATCH 13/16] Make Address properties not nullable. Revert package name --- Entity/AddressEmbeddable.php | 26 +++++++++++++------------- composer.json | 7 +------ 2 files changed, 14 insertions(+), 19 deletions(-) diff --git a/Entity/AddressEmbeddable.php b/Entity/AddressEmbeddable.php index fbfe82a..e9bb2c2 100644 --- a/Entity/AddressEmbeddable.php +++ b/Entity/AddressEmbeddable.php @@ -11,69 +11,69 @@ class AddressEmbeddable extends Address { /** - * @ORM\Column(type="string", nullable=true) + * @ORM\Column(type="string", nullable=false) */ protected string $locale = 'und'; /** - * @ORM\Column(type="string", nullable=true) + * @ORM\Column(type="string", nullable=false) */ protected string $givenName = ''; /** - * @ORM\Column(type="string", nullable=true) + * @ORM\Column(type="string", nullable=false) */ protected string $additionalName = ''; /** - * @ORM\Column(type="string", nullable=true) + * @ORM\Column(type="string", nullable=false) */ protected string $familyName = ''; /** - * @ORM\Column(type="string", nullable=true) + * @ORM\Column(type="string", nullable=false) */ protected string $organization = ''; /** - * @ORM\Column(type="string", nullable=true) + * @ORM\Column(type="string", nullable=false) */ protected string $addressLine1 = ''; /** - * @ORM\Column(type="string", nullable=true) + * @ORM\Column(type="string", nullable=false) */ protected string $addressLine2 = ''; protected string $addressLine3 = ''; /** - * @ORM\Column(type="string", nullable=true) + * @ORM\Column(type="string", nullable=false) */ protected string $postalCode = ''; /** - * @ORM\Column(type="string", nullable=true) + * @ORM\Column(type="string", nullable=false) */ protected string $sortingCode = ''; /** - * @ORM\Column(type="string", nullable=true) + * @ORM\Column(type="string", nullable=false) */ protected string $locality = ''; /** - * @ORM\Column(type="string", nullable=true) + * @ORM\Column(type="string", nullable=false) */ protected string $dependentLocality = ''; /** - * @ORM\Column(type="string", nullable=true) + * @ORM\Column(type="string", nullable=false) */ protected string $administrativeArea = ''; /** - * @ORM\Column(type="string", length=2, nullable=true) + * @ORM\Column(type="string", length=2, nullable=false) */ protected string $countryCode = ''; diff --git a/composer.json b/composer.json index e8321f5..7be7a8c 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "outofboxlab/addressing-bundle", + "name": "daften/addressing-bundle", "description": "Provides an integration between commerceguys addressing package and Symfony.", "type": "library", "license": "MIT", @@ -8,11 +8,6 @@ { "name": "daften", "email": "dieterblomme@gmail.com" - }, - { - "name": "Out Of Box Lab", - "email": "github@outofboxlab.com", - "homepage": "https://outofboxlab.com" } ], "require": { From ed406d681a852b43080440754fa12f65f8d0de51 Mon Sep 17 00:00:00 2001 From: Rafal Kozlowski Date: Fri, 22 Dec 2023 16:49:16 +0100 Subject: [PATCH 14/16] Add Doctrine annotation to the address line 3 property and remove branch alias from composer.json --- Entity/AddressEmbeddable.php | 3 +++ composer.json | 5 ----- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Entity/AddressEmbeddable.php b/Entity/AddressEmbeddable.php index e9bb2c2..2fc3235 100644 --- a/Entity/AddressEmbeddable.php +++ b/Entity/AddressEmbeddable.php @@ -45,6 +45,9 @@ class AddressEmbeddable extends Address */ protected string $addressLine2 = ''; + /** + * @ORM\Column(type="string", nullable=false) + */ protected string $addressLine3 = ''; /** diff --git a/composer.json b/composer.json index 7be7a8c..eb9bf0e 100644 --- a/composer.json +++ b/composer.json @@ -29,10 +29,5 @@ }, "autoload": { "psr-4": { "Daften\\Bundle\\AddressingBundle\\": "" } - }, - "extra": { - "branch-alias": { - "dev-develop": "1.1.3-dev" - } } } From d5d43dce0050fe043e191f53214ba77df152e86c Mon Sep 17 00:00:00 2001 From: Rafal Kozlowski Date: Fri, 22 Dec 2023 17:39:10 +0100 Subject: [PATCH 15/16] Add setter for the address line 3 property --- Entity/AddressEmbeddable.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Entity/AddressEmbeddable.php b/Entity/AddressEmbeddable.php index 2fc3235..8ffb29b 100644 --- a/Entity/AddressEmbeddable.php +++ b/Entity/AddressEmbeddable.php @@ -163,4 +163,8 @@ public function setCountryCode(string $countryCode): void $this->countryCode = $countryCode; } + public function setAddressLine3(string $addressLine3): void + { + $this->addressLine3 = $addressLine3; + } } From 2a0485b2391ac5e465d0f12d79f27f44cd3ba70a Mon Sep 17 00:00:00 2001 From: Dieter Blomme Date: Fri, 22 Dec 2023 17:55:01 +0100 Subject: [PATCH 16/16] Change order of setters --- Entity/AddressEmbeddable.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Entity/AddressEmbeddable.php b/Entity/AddressEmbeddable.php index 8ffb29b..10f51dc 100644 --- a/Entity/AddressEmbeddable.php +++ b/Entity/AddressEmbeddable.php @@ -133,6 +133,11 @@ public function setAddressLine2(string $addressLine2): void $this->addressLine2 = $addressLine2; } + public function setAddressLine3(string $addressLine3): void + { + $this->addressLine3 = $addressLine3; + } + public function setPostalCode(string $postalCode): void { $this->postalCode = $postalCode; @@ -162,9 +167,4 @@ public function setCountryCode(string $countryCode): void { $this->countryCode = $countryCode; } - - public function setAddressLine3(string $addressLine3): void - { - $this->addressLine3 = $addressLine3; - } }