diff --git a/CHANGELOG.md b/CHANGELOG.md index 9fdfd7bb382e4d5bf09c7a0a5b213a6ac2c393b1..21c2ab699c5595257bc8e20b8ba047cd71352a62 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,9 +2,9 @@ ## [UNRELEASED] -## [1.2.1] - 2018-11-07 +## [1.2.2] - 2018-11-16 ### Fix -- [MATURITE] L'ordre des catégories est auto-généré (il restait à 0 pour toutes les catégories) +- [GLOBAL] Le code postal commencant par 0 ne fonctionnait pas pour les adresses du registre, #119 ## [1.2.0] - 2018-11-07 ### Changement diff --git a/config/domain/registry/validation/address.yaml b/config/domain/registry/validation/address.yaml index efdc33f5a049e3679c806dd14bc0e7ce1c1e75bc..544f27d3c5ed296ae046d1ec54c7280aee9e57c2 100644 --- a/config/domain/registry/validation/address.yaml +++ b/config/domain/registry/validation/address.yaml @@ -10,11 +10,6 @@ App\Domain\Registry\Model\Embeddable\Address: message: 'registry_address.phone_number.regex' groups: ['default'] zipCode: - - Length: - min: 5 - max: 5 - exactMessage: 'registry_address.zip_code.length' - groups: ['default'] - Regex: pattern: '/^[0-9]{5}$/' message: 'registry_address.zip_code.regex' diff --git a/config/packages/framework.yaml b/config/packages/framework.yaml index c8b04cb56080c6fc43e332ac849ec25b395a4946..c720eae9480061c641a97a91dd3db0c9721c786b 100644 --- a/config/packages/framework.yaml +++ b/config/packages/framework.yaml @@ -1,5 +1,5 @@ parameters: - app.version: 1.2.1 + app.version: 1.2.2 framework: secret: '%env(APP_SECRET)%' diff --git a/src/Application/Migrations/Version20181115193356.php b/src/Application/Migrations/Version20181115193356.php new file mode 100644 index 0000000000000000000000000000000000000000..28b8554e6953aad94ed578a2513864fd70c45a27 --- /dev/null +++ b/src/Application/Migrations/Version20181115193356.php @@ -0,0 +1,30 @@ +<?php + +declare(strict_types=1); + +namespace DoctrineMigrations; + +use Doctrine\DBAL\Schema\Schema; +use Doctrine\Migrations\AbstractMigration; + +/** + * Auto-generated Migration: Please modify to your needs! + */ +final class Version20181115193356 extends AbstractMigration +{ + public function up(Schema $schema): void + { + // this up() migration is auto-generated, please modify it to your needs + $this->abortIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'mysql\'.'); + + $this->addSql('ALTER TABLE registry_contractor CHANGE address_zip_code address_zip_code VARCHAR(5) DEFAULT NULL'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->abortIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'mysql\'.'); + + $this->addSql('ALTER TABLE registry_contractor CHANGE address_zip_code address_zip_code INT DEFAULT NULL'); + } +} diff --git a/src/Domain/Registry/Form/Type/Embeddable/AddressType.php b/src/Domain/Registry/Form/Type/Embeddable/AddressType.php index 57962182c74ceaa39a8a81d9fa7a42dc720e2605..e20bd16eb023dd7909978f609f9cff065388d078 100644 --- a/src/Domain/Registry/Form/Type/Embeddable/AddressType.php +++ b/src/Domain/Registry/Form/Type/Embeddable/AddressType.php @@ -16,7 +16,6 @@ namespace App\Domain\Registry\Form\Type\Embeddable; use App\Domain\Registry\Model\Embeddable\Address; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\EmailType; -use Symfony\Component\Form\Extension\Core\Type\NumberType; use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -40,7 +39,7 @@ class AddressType extends AbstractType 'label' => 'registry.address.form.city', 'required' => $required, ]) - ->add('zipCode', NumberType::class, [ + ->add('zipCode', TextType::class, [ 'label' => 'registry.address.form.zip_code', 'required' => $required, ]) diff --git a/src/Domain/Registry/Model/Embeddable/Address.php b/src/Domain/Registry/Model/Embeddable/Address.php index c78c61bc85325529e0db5632a6b5ac69f8b1e94e..cb9f1d89b9ca9cd730a7c37f738098dea1e6ab42 100644 --- a/src/Domain/Registry/Model/Embeddable/Address.php +++ b/src/Domain/Registry/Model/Embeddable/Address.php @@ -31,7 +31,7 @@ class Address private $city; /** - * @var int + * @var string */ private $zipCode; @@ -94,17 +94,17 @@ class Address } /** - * @return int|null + * @return string|null */ - public function getZipCode(): ?int + public function getZipCode(): ?string { return $this->zipCode; } /** - * @param int|null $zipCode + * @param string|null $zipCode */ - public function setZipCode(?int $zipCode): void + public function setZipCode(?string $zipCode): void { $this->zipCode = $zipCode; } diff --git a/src/Infrastructure/ORM/Registry/Mapping/Embeddable/Address.orm.xml b/src/Infrastructure/ORM/Registry/Mapping/Embeddable/Address.orm.xml index 4df03001a915126fb9893dc14f305952c7aaadd4..703c4661c013a0a12de78f5de91b43c7c7726ed2 100644 --- a/src/Infrastructure/ORM/Registry/Mapping/Embeddable/Address.orm.xml +++ b/src/Infrastructure/ORM/Registry/Mapping/Embeddable/Address.orm.xml @@ -10,7 +10,7 @@ <field name="lineOne" column="line_one" nullable="true"/> <field name="lineTwo" column="line_two" nullable="true"/> <field name="city" column="city" nullable="true"/> - <field name="zipCode" column="zip_code" type="integer" nullable="true"/> + <field name="zipCode" column="zip_code" length="5" nullable="true"/> <field name="mail" column="mail" nullable="true"/> <field name="phoneNumber" column="phone_number" length="10" nullable="true"/>