diff --git a/src/Bundle/ChillMainBundle/Entity/Address.php b/src/Bundle/ChillMainBundle/Entity/Address.php index 43512a5b2..e01c3f540 100644 --- a/src/Bundle/ChillMainBundle/Entity/Address.php +++ b/src/Bundle/ChillMainBundle/Entity/Address.php @@ -367,12 +367,12 @@ class Address return $this; } - public function getNumber(): ?string + public function getStreetNumber(): ?string { return $this->streetNumber; } - public function setNumber(string $streetNumber): self + public function setStreetNumber(string $streetNumber): self { $this->streetNumber = $streetNumber; diff --git a/src/Bundle/ChillMainBundle/Form/Type/AddressType.php b/src/Bundle/ChillMainBundle/Form/Type/AddressType.php index 4a0e222b8..68cfdda09 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/AddressType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/AddressType.php @@ -33,8 +33,8 @@ use Symfony\Component\Form\Extension\Core\Type\ChoiceType; * A type to create/update Address entity * * Options: - * - * - `has_valid_from` (boolean): show if an entry "has valid from" must be + * + * - `has_valid_from` (boolean): show if an entry "has valid from" must be * shown. * - `null_if_empty` (boolean): replace the address type by null if the street * or the postCode is empty. This is useful when the address is not required and @@ -45,10 +45,10 @@ class AddressType extends AbstractType public function buildForm(FormBuilderInterface $builder, array $options) { $builder - ->add('streetAddress1', TextType::class, array( + ->add('street', TextType::class, array( 'required' => !$options['has_no_address'] // true if has no address is false )) - ->add('streetAddress2', TextType::class, array( + ->add('streetNumber', TextType::class, array( 'required' => false )) ->add('postCode', PostalCodeType::class, array( @@ -57,7 +57,7 @@ class AddressType extends AbstractType 'required' => !$options['has_no_address'] // true if has no address is false )) ; - + if ($options['has_valid_from']) { $builder ->add('validFrom', DateType::class, array( @@ -67,7 +67,7 @@ class AddressType extends AbstractType ) ); } - + if ($options['has_no_address']) { $builder ->add('isNoAddress', ChoiceType::class, [ @@ -79,12 +79,12 @@ class AddressType extends AbstractType 'label' => 'address.address_homeless' ]); } - + if ($options['null_if_empty'] === TRUE) { $builder->setDataMapper(new AddressDataMapper()); } } - + public function configureOptions(OptionsResolver $resolver) { $resolver diff --git a/src/Bundle/ChillMainBundle/Resources/views/Address/macro.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Address/macro.html.twig index 165d7c280..5de175169 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Address/macro.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Address/macro.html.twig @@ -6,8 +6,8 @@
{{ address.streetAddress1 }}
{% endif %} - {% if address.streetAddress2 is not empty %}{{ address.streetAddress2 }}
{% endif %} + {% if address.street is not empty %}{{ address.street }}
{% endif %} + {% if address.streetNumber is not empty %}{{ address.streetNumber }}
{% endif %} {% if address.postCode is not empty %}{{ address.postCode.code }} {{ address.postCode.name }}
{{ address.postCode.country.name|localize_translatable_string }}
diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Address/edit.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Address/edit.html.twig index eea76b5fe..b516dfb83 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Address/edit.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Address/edit.html.twig @@ -21,17 +21,17 @@ {% block title 'Update address for %name%'|trans({ '%name%': person.firstName ~ ' ' ~ person.lastName } ) %} {% block personcontent %} - +