This plugin helps you split street & number.
Features:
- Add
streetNumber
field to Address form (and database)
Optional features:
- Add
streetNumberAddition
field to Address form (and database)
-
Require plugin with composer:
composer require stefandoorn/sylius-street-number-plugin:^1.0@beta
-
Add plugin class to your
AppKernel
.$bundles = [ new \StefanDoorn\SyliusStreetNumberPlugin\SyliusStreetNumberPlugin(), ];
-
Add to your config:
- { resource: "@SyliusStreetNumberPlugin/Resources/config/config.yml" }
-
Add doctrine mapping fields for table
sylius_address
(seetests/Application/config/doctrine/Address.orm.yml
):... table: sylius_address fields: number: column: street_number type: string nullable: false options: default: '' addition: column: street_number_addition type: string nullable: true
The
streetNumberAddition
field is always added, regardless whether you use it. It will benull
in that cae. -
Add to
_sylius.yaml
:... sylius_addressing: resources: address: classes: model: App\Entity\Addressing\Address
-
Add to
SyliusAdminBundle/views/Common/Form/_address.html.twig
:{{ form_row(form.number) }}
-
Add to
SyliusShopBundle/views/Common/Form/_address.html.twig
:{{ form_row(form.number) }}
-
Update database:
$ bin/console doctrine:migrations:diff $ bin/console doctrine:migrations:migrate
-
Enable in config (for form extension):
sylius_street_number: features: street_number_addition: true
-
Add to
SyliusAdminBundle/views/Common/Form/_address.html.twig
:{{ form_row(form.addition) }}
-
Add to
SyliusShopBundle/views/Common/Form/_address.html.twig
:{{ form_row(form.addition) }}