1. Installation¶
We assume you’re familiar with Composer, a dependency manager for PHP. Use following command to add the bundle to your composer.json and download package.
If you have Composer installed globally.
$ composer require sylius/addressing-bundle:*
Otherwise you have to download .phar file.
$ curl -sS https://getcomposer.org/installer | php
$ php composer.phar require sylius/addressing-bundle:*
1.1. Adding required bundles to the kernel¶
You need to enable the bundle inside the kernel.
If you’re not using any other Sylius bundles, you will also need to add SyliusResourceBundle and its dependencies to kernel. Don’t worry, everything was automatically installed via Composer.
<?php
// app/AppKernel.php
public function registerBundles()
{
$bundles = array(
new FOS\RestBundle\FOSRestBundle(),
new JMS\SerializerBundle\JMSSerializerBundle($this),
new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(),
new WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle(),
new Sylius\Bundle\AddressingBundle\SyliusAddressingBundle(),
new Sylius\Bundle\ResourceBundle\SyliusResourceBundle(),
// Other bundles...
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
);
}
Примечание
Please register the bundle before DoctrineBundle. This is important as we use listeners which have to be processed first.
1.2. Container configuration¶
Put this configuration inside your app/config/config.yml.
sylius_addressing:
driver: doctrine/orm # Configure the doctrine orm driver used in documentation.
And configure doctrine extensions which are used in assortment bundle:
stof_doctrine_extensions:
orm:
default:
timestampable: true
1.3. Routing configuration¶
Import the routing configuration by adding the following to your app/config/routing.yml.
sylius_addressing:
resource: @SyliusAddressingBundle/Resources/config/routing.yml
1.4. Updating database schema¶
Run the following command.
$ php app/console doctrine:schema:update --force
Предупреждение
This should be done only in dev environment! We recommend using Doctrine migrations, to safely update your schema.
1.5. Templates¶
This bundle provides some default bootstrap templates.
Примечание
You can check Sylius application to see how to integrate it in your application.