Adding a sylius extensionΒΆ


This article outdated and may contain information that are not in use any more

Edit the extension in the folder DependencyInjection of your bundle to be derived from SyliusResourceExtension and add the required parameters.


namespace Acme\ProjectBundle\DependencyInjection;

use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\Loader;
use Enhavo\Bundle\AppBundle\DependencyInjection\SyliusResourceExtension;

 * This is the class that loads and manages your bundle configuration
 * To learn more see {@link}
class AcmeProjectExtension extends AbstractResourceExtension
    // You can choose your application name, it will be used as prefix for the configuration keys
    // in the container (the default value is sylius).
    protected $applicationName = 'acme_project';

    protected $bundleName = 'project';

    protected $companyName = 'acme';

    // You can define where your service definitions are located
    protected $configDirectory = '/../Resources/config';

    // You can define what service definitions you want to load
    protected $configFiles = array(

    // You can define the file format of the files loaded (default: xml)
    protected $configFormat = self::CONFIG_YAML;

    public function load(array $config, ContainerBuilder $container)
            new Configuration(),

        $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));

After that you have to add the driver to your Configuration.php

// Driver used by the resource bundle

Finally add the getSupportedDrivers function to your bundle.

public static function getSupportedDrivers()
    return array('doctrine/orm');