vendor/bundles/Symfony/Bundle/DoctrineMigrationsBundle/DependencyInjection/DoctrineMigrationsExtension.php
author cavaliet
Mon, 07 Jul 2014 17:23:47 +0200
changeset 122 d672f7dd74dc
parent 39 03b14b0fe101
permissions -rw-r--r--
Added tag V00.17 for changeset ada5f3d8b5b4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
39
03b14b0fe101 Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff changeset
     1
<?php
03b14b0fe101 Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff changeset
     2
03b14b0fe101 Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff changeset
     3
/*
03b14b0fe101 Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff changeset
     4
 * This file is part of the Symfony package.
03b14b0fe101 Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff changeset
     5
 *
03b14b0fe101 Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff changeset
     6
 * (c) Fabien Potencier <fabien@symfony.com>
03b14b0fe101 Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff changeset
     7
 *
03b14b0fe101 Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff changeset
     8
 * For the full copyright and license information, please view the LICENSE
03b14b0fe101 Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff changeset
     9
 * file that was distributed with this source code.
03b14b0fe101 Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff changeset
    10
 */
03b14b0fe101 Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff changeset
    11
03b14b0fe101 Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff changeset
    12
namespace Symfony\Bundle\DoctrineMigrationsBundle\DependencyInjection;
03b14b0fe101 Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff changeset
    13
03b14b0fe101 Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff changeset
    14
use Symfony\Component\Config\Definition\Processor;
03b14b0fe101 Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff changeset
    15
use Symfony\Component\DependencyInjection\ContainerBuilder;
03b14b0fe101 Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff changeset
    16
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
03b14b0fe101 Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff changeset
    17
03b14b0fe101 Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff changeset
    18
/**
03b14b0fe101 Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff changeset
    19
 * DoctrineMigrationsExtension.
03b14b0fe101 Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff changeset
    20
 *
03b14b0fe101 Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff changeset
    21
 * @author Lukas Kahwe Smith <smith@pooteeweet.org>
03b14b0fe101 Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff changeset
    22
 */
03b14b0fe101 Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff changeset
    23
class DoctrineMigrationsExtension extends Extension
03b14b0fe101 Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff changeset
    24
{
03b14b0fe101 Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff changeset
    25
    /**
03b14b0fe101 Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff changeset
    26
     * Responds to the twig configuration parameter.
03b14b0fe101 Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff changeset
    27
     *
03b14b0fe101 Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff changeset
    28
     * @param array            $configs
03b14b0fe101 Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff changeset
    29
     * @param ContainerBuilder $container
03b14b0fe101 Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff changeset
    30
     */
03b14b0fe101 Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff changeset
    31
    public function load(array $configs, ContainerBuilder $container)
03b14b0fe101 Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff changeset
    32
    {
03b14b0fe101 Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff changeset
    33
        $processor = new Processor();
03b14b0fe101 Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff changeset
    34
        $configuration = new Configuration();
03b14b0fe101 Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff changeset
    35
03b14b0fe101 Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff changeset
    36
        $config = $processor->process($configuration->getConfigTree(), $configs);
03b14b0fe101 Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff changeset
    37
03b14b0fe101 Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff changeset
    38
        foreach ($config as $key => $value) {
03b14b0fe101 Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff changeset
    39
            $container->setParameter($this->getAlias().'.'.$key, $value);
03b14b0fe101 Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff changeset
    40
        }
03b14b0fe101 Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff changeset
    41
    }
03b14b0fe101 Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff changeset
    42
03b14b0fe101 Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff changeset
    43
    /**
03b14b0fe101 Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff changeset
    44
     * Returns the base path for the XSD files.
03b14b0fe101 Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff changeset
    45
     *
03b14b0fe101 Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff changeset
    46
     * @return string The XSD base path
03b14b0fe101 Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff changeset
    47
     */
03b14b0fe101 Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff changeset
    48
    public function getXsdValidationBasePath()
03b14b0fe101 Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff changeset
    49
    {
03b14b0fe101 Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff changeset
    50
        return __DIR__.'/../Resources/config/schema';
03b14b0fe101 Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff changeset
    51
    }
03b14b0fe101 Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff changeset
    52
03b14b0fe101 Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff changeset
    53
    public function getNamespace()
03b14b0fe101 Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff changeset
    54
    {
03b14b0fe101 Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff changeset
    55
        return 'http://symfony.com/schema/dic/doctrine/migrations';
03b14b0fe101 Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff changeset
    56
    }
03b14b0fe101 Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
diff changeset
    57
}