init without trunk
This commit is contained in:
parent
ed24ac4994
commit
bb809e7233
14652 changed files with 177862 additions and 94817 deletions
44
vendor/doctrine/doctrine-cache-bundle/DependencyInjection/Definition/CacheDefinition.php
vendored
Normal file
44
vendor/doctrine/doctrine-cache-bundle/DependencyInjection/Definition/CacheDefinition.php
vendored
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineCacheBundle\DependencyInjection\Definition;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Definition;
|
||||
|
||||
/**
|
||||
* Cache Definition.
|
||||
*
|
||||
* @author Fabio B. Silva <fabio.bat.silva@gmail.com>
|
||||
*/
|
||||
abstract class CacheDefinition
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $type;
|
||||
|
||||
/**
|
||||
* @param string $type
|
||||
*/
|
||||
public function __construct($type)
|
||||
{
|
||||
$this->type = $type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param array $config
|
||||
* @param \Symfony\Component\DependencyInjection\Definition $service
|
||||
* @param \Symfony\Component\DependencyInjection\ContainerBuilder $container
|
||||
*/
|
||||
abstract public function configure($name, array $config, Definition $service, ContainerBuilder $container);
|
||||
}
|
||||
57
vendor/doctrine/doctrine-cache-bundle/DependencyInjection/Definition/ChainDefinition.php
vendored
Normal file
57
vendor/doctrine/doctrine-cache-bundle/DependencyInjection/Definition/ChainDefinition.php
vendored
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineCacheBundle\DependencyInjection\Definition;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Definition;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
|
||||
/**
|
||||
* Chain definition.
|
||||
*
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
*/
|
||||
class ChainDefinition extends CacheDefinition
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function configure($name, array $config, Definition $service, ContainerBuilder $container)
|
||||
{
|
||||
$providersConf = $config['chain'];
|
||||
$providers = $this->getProviders($name, $providersConf, $container);
|
||||
|
||||
$service->setArguments(array($providers));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param array $config
|
||||
* @param \Symfony\Component\DependencyInjection\ContainerBuilder $container
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function getProviders($name, array $config, ContainerBuilder $container)
|
||||
{
|
||||
$providers = array();
|
||||
|
||||
foreach ($config['providers'] as $provider) {
|
||||
if (strpos($provider, 'doctrine_cache.providers.') === false) {
|
||||
$provider = sprintf('doctrine_cache.providers.%s', $provider);
|
||||
}
|
||||
|
||||
$providers[] = new Reference($provider);
|
||||
}
|
||||
|
||||
return $providers;
|
||||
}
|
||||
}
|
||||
62
vendor/doctrine/doctrine-cache-bundle/DependencyInjection/Definition/CouchbaseDefinition.php
vendored
Normal file
62
vendor/doctrine/doctrine-cache-bundle/DependencyInjection/Definition/CouchbaseDefinition.php
vendored
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineCacheBundle\DependencyInjection\Definition;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Definition;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
|
||||
/**
|
||||
* Couchbase definition.
|
||||
*
|
||||
* @author Fabio B. Silva <fabio.bat.silva@gmail.com>
|
||||
*/
|
||||
class CouchbaseDefinition extends CacheDefinition
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function configure($name, array $config, Definition $service, ContainerBuilder $container)
|
||||
{
|
||||
$couchbaseConf = $config['couchbase'];
|
||||
$connRef = $this->getConnectionReference($name, $couchbaseConf, $container);
|
||||
|
||||
$service->addMethodCall('setCouchbase', array($connRef));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param array $config
|
||||
* @param \Symfony\Component\DependencyInjection\ContainerBuilder $container
|
||||
*
|
||||
* @return \Symfony\Component\DependencyInjection\Reference
|
||||
*/
|
||||
private function getConnectionReference($name, array $config, ContainerBuilder $container)
|
||||
{
|
||||
if (isset($config['connection_id'])) {
|
||||
return new Reference($config['connection_id']);
|
||||
}
|
||||
|
||||
$host = $config['hostnames'];
|
||||
$user = $config['username'];
|
||||
$pass = $config['password'];
|
||||
$bucket = $config['bucket_name'];
|
||||
$connClass = '%doctrine_cache.couchbase.connection.class%';
|
||||
$connId = sprintf('doctrine_cache.services.%s_couchbase.connection', $name);
|
||||
$connDef = new Definition($connClass, array($host, $user, $pass, $bucket));
|
||||
|
||||
$connDef->setPublic(false);
|
||||
$container->setDefinition($connId, $connDef);
|
||||
|
||||
return new Reference($connId);
|
||||
}
|
||||
}
|
||||
35
vendor/doctrine/doctrine-cache-bundle/DependencyInjection/Definition/FileSystemDefinition.php
vendored
Normal file
35
vendor/doctrine/doctrine-cache-bundle/DependencyInjection/Definition/FileSystemDefinition.php
vendored
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineCacheBundle\DependencyInjection\Definition;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Definition;
|
||||
|
||||
/**
|
||||
* FileSystem definition.
|
||||
*
|
||||
* @author Fabio B. Silva <fabio.bat.silva@gmail.com>
|
||||
*/
|
||||
class FileSystemDefinition extends CacheDefinition
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function configure($name, array $config, Definition $service, ContainerBuilder $container)
|
||||
{
|
||||
$service->setArguments(array(
|
||||
$config['file_system']['directory'],
|
||||
$config['file_system']['extension'],
|
||||
$config['file_system']['umask']
|
||||
));
|
||||
}
|
||||
}
|
||||
62
vendor/doctrine/doctrine-cache-bundle/DependencyInjection/Definition/MemcacheDefinition.php
vendored
Normal file
62
vendor/doctrine/doctrine-cache-bundle/DependencyInjection/Definition/MemcacheDefinition.php
vendored
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineCacheBundle\DependencyInjection\Definition;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Definition;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
|
||||
/**
|
||||
* Memcache definition.
|
||||
*
|
||||
* @author Fabio B. Silva <fabio.bat.silva@gmail.com>
|
||||
*/
|
||||
class MemcacheDefinition extends CacheDefinition
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function configure($name, array $config, Definition $service, ContainerBuilder $container)
|
||||
{
|
||||
$memcacheConf = $config['memcache'];
|
||||
$connRef = $this->getConnectionReference($name, $memcacheConf, $container);
|
||||
|
||||
$service->addMethodCall('setMemcache', array($connRef));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param array $config
|
||||
* @param \Symfony\Component\DependencyInjection\ContainerBuilder $container
|
||||
*
|
||||
* @return \Symfony\Component\DependencyInjection\Reference
|
||||
*/
|
||||
private function getConnectionReference($name, array $config, ContainerBuilder $container)
|
||||
{
|
||||
if (isset($config['connection_id'])) {
|
||||
return new Reference($config['connection_id']);
|
||||
}
|
||||
|
||||
$connClass = '%doctrine_cache.memcache.connection.class%';
|
||||
$connId = sprintf('doctrine_cache.services.%s.connection', $name);
|
||||
$connDef = new Definition($connClass);
|
||||
|
||||
foreach ($config['servers'] as $host => $server) {
|
||||
$connDef->addMethodCall('addServer', array($host, $server['port']));
|
||||
}
|
||||
|
||||
$connDef->setPublic(false);
|
||||
$container->setDefinition($connId, $connDef);
|
||||
|
||||
return new Reference($connId);
|
||||
}
|
||||
}
|
||||
66
vendor/doctrine/doctrine-cache-bundle/DependencyInjection/Definition/MemcachedDefinition.php
vendored
Normal file
66
vendor/doctrine/doctrine-cache-bundle/DependencyInjection/Definition/MemcachedDefinition.php
vendored
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineCacheBundle\DependencyInjection\Definition;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Definition;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
|
||||
/**
|
||||
* Memcached definition.
|
||||
*
|
||||
* @author Fabio B. Silva <fabio.bat.silva@gmail.com>
|
||||
*/
|
||||
class MemcachedDefinition extends CacheDefinition
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function configure($name, array $config, Definition $service, ContainerBuilder $container)
|
||||
{
|
||||
$memcachedConf = $config['memcached'];
|
||||
$connRef = $this->getConnectionReference($name, $memcachedConf, $container);
|
||||
|
||||
$service->addMethodCall('setMemcached', array($connRef));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param array $config
|
||||
* @param \Symfony\Component\DependencyInjection\ContainerBuilder $container
|
||||
*
|
||||
* @return \Symfony\Component\DependencyInjection\Reference
|
||||
*/
|
||||
private function getConnectionReference($name, array $config, ContainerBuilder $container)
|
||||
{
|
||||
if (isset($config['connection_id'])) {
|
||||
return new Reference($config['connection_id']);
|
||||
}
|
||||
|
||||
$connClass = '%doctrine_cache.memcached.connection.class%';
|
||||
$connId = sprintf('doctrine_cache.services.%s.connection', $name);
|
||||
$connDef = new Definition($connClass);
|
||||
|
||||
if (isset($config['persistent_id']) === true) {
|
||||
$connDef->addArgument($config['persistent_id']);
|
||||
}
|
||||
|
||||
foreach ($config['servers'] as $host => $server) {
|
||||
$connDef->addMethodCall('addServer', array($host, $server['port']));
|
||||
}
|
||||
|
||||
$connDef->setPublic(false);
|
||||
$container->setDefinition($connId, $connDef);
|
||||
|
||||
return new Reference($connId);
|
||||
}
|
||||
}
|
||||
97
vendor/doctrine/doctrine-cache-bundle/DependencyInjection/Definition/MongodbDefinition.php
vendored
Normal file
97
vendor/doctrine/doctrine-cache-bundle/DependencyInjection/Definition/MongodbDefinition.php
vendored
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineCacheBundle\DependencyInjection\Definition;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Definition;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
|
||||
/**
|
||||
* MongoDB definition.
|
||||
*
|
||||
* @author Fabio B. Silva <fabio.bat.silva@gmail.com>
|
||||
*/
|
||||
class MongodbDefinition extends CacheDefinition
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function configure($name, array $config, Definition $service, ContainerBuilder $container)
|
||||
{
|
||||
$memcacheConf = $config['mongodb'];
|
||||
$collRef = $this->getCollectionReference($name, $memcacheConf, $container);
|
||||
|
||||
$service->setArguments(array($collRef));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param array $config
|
||||
* @param \Symfony\Component\DependencyInjection\ContainerBuilder $container
|
||||
*
|
||||
* @return \Symfony\Component\DependencyInjection\Reference
|
||||
*/
|
||||
private function getCollectionReference($name, array $config, ContainerBuilder $container)
|
||||
{
|
||||
if (isset($config['collection_id'])) {
|
||||
return new Reference($config['collection_id']);
|
||||
}
|
||||
|
||||
$databaseName = $config['database_name'];
|
||||
$collectionName = $config['collection_name'];
|
||||
$collClass = '%doctrine_cache.mongodb.collection.class%';
|
||||
$collId = sprintf('doctrine_cache.services.%s.collection', $name);
|
||||
$collDef = new Definition($collClass, array($databaseName, $collectionName));
|
||||
$connRef = $this->getConnectionReference($name, $config, $container);
|
||||
|
||||
$definition = $container->setDefinition($collId, $collDef)->setPublic(false);
|
||||
|
||||
if (method_exists($definition, 'setFactory')) {
|
||||
$definition->setFactory(array($connRef, 'selectCollection'));
|
||||
|
||||
return new Reference($collId);
|
||||
}
|
||||
|
||||
$definition
|
||||
->setFactoryService($connRef)
|
||||
->setFactoryMethod('selectCollection')
|
||||
;
|
||||
|
||||
return new Reference($collId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param array $config
|
||||
* @param \Symfony\Component\DependencyInjection\ContainerBuilder $container
|
||||
*
|
||||
* @return \Symfony\Component\DependencyInjection\Reference
|
||||
*/
|
||||
private function getConnectionReference($name, array $config, ContainerBuilder $container)
|
||||
{
|
||||
if (isset($config['connection_id'])) {
|
||||
return new Reference($config['connection_id']);
|
||||
}
|
||||
|
||||
$server = $config['server'];
|
||||
$connClass = '%doctrine_cache.mongodb.connection.class%';
|
||||
$connId = sprintf('doctrine_cache.services.%s.connection', $name);
|
||||
$connDef = new Definition($connClass, array($server));
|
||||
|
||||
$connDef->setPublic(false);
|
||||
$connDef->addMethodCall('connect');
|
||||
|
||||
$container->setDefinition($connId, $connDef);
|
||||
|
||||
return new Reference($connId);
|
||||
}
|
||||
}
|
||||
35
vendor/doctrine/doctrine-cache-bundle/DependencyInjection/Definition/PhpFileDefinition.php
vendored
Normal file
35
vendor/doctrine/doctrine-cache-bundle/DependencyInjection/Definition/PhpFileDefinition.php
vendored
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineCacheBundle\DependencyInjection\Definition;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Definition;
|
||||
|
||||
/**
|
||||
* PhpFile definition.
|
||||
*
|
||||
* @author Fabio B. Silva <fabio.bat.silva@gmail.com>
|
||||
*/
|
||||
class PhpFileDefinition extends CacheDefinition
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function configure($name, array $config, Definition $service, ContainerBuilder $container)
|
||||
{
|
||||
$service->setArguments(array(
|
||||
$config['php_file']['directory'],
|
||||
$config['php_file']['extension'],
|
||||
$config['php_file']['umask']
|
||||
));
|
||||
}
|
||||
}
|
||||
84
vendor/doctrine/doctrine-cache-bundle/DependencyInjection/Definition/PredisDefinition.php
vendored
Normal file
84
vendor/doctrine/doctrine-cache-bundle/DependencyInjection/Definition/PredisDefinition.php
vendored
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineCacheBundle\DependencyInjection\Definition;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Definition;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
|
||||
/**
|
||||
* Predis definition.
|
||||
*
|
||||
* @author Ivo Bathke <ivo.bathke@gmail.com>
|
||||
*/
|
||||
class PredisDefinition extends CacheDefinition
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function configure($name, array $config, Definition $service, ContainerBuilder $container)
|
||||
{
|
||||
$redisConf = $config['predis'];
|
||||
$connRef = $this->getConnectionReference($name, $redisConf, $container);
|
||||
$service->addArgument($connRef);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param array $config
|
||||
* @param \Symfony\Component\DependencyInjection\ContainerBuilder $container
|
||||
*
|
||||
* @return \Symfony\Component\DependencyInjection\Reference
|
||||
*/
|
||||
private function getConnectionReference($name, array $config, ContainerBuilder $container)
|
||||
{
|
||||
if (isset($config['client_id'])) {
|
||||
return new Reference($config['client_id']);
|
||||
}
|
||||
|
||||
$parameters = array(
|
||||
'scheme' => $config['scheme'],
|
||||
'host' => $config['host'],
|
||||
'port' => $config['port'],
|
||||
);
|
||||
|
||||
if ($config['password']) {
|
||||
$parameters['password'] = $config['password'];
|
||||
}
|
||||
|
||||
if ($config['timeout']) {
|
||||
$parameters['timeout'] = $config['timeout'];
|
||||
}
|
||||
|
||||
if ($config['database']) {
|
||||
$parameters['database'] = $config['database'];
|
||||
}
|
||||
|
||||
$options = null;
|
||||
|
||||
if (isset($config['options'])) {
|
||||
$options = $config['options'];
|
||||
}
|
||||
|
||||
$clientClass = '%doctrine_cache.predis.client.class%';
|
||||
$clientId = sprintf('doctrine_cache.services.%s_predis.client', $name);
|
||||
$clientDef = new Definition($clientClass);
|
||||
|
||||
$clientDef->addArgument($parameters);
|
||||
$clientDef->addArgument($options);
|
||||
$clientDef->setPublic(false);
|
||||
|
||||
$container->setDefinition($clientId, $clientDef);
|
||||
|
||||
return new Reference($clientId);
|
||||
}
|
||||
}
|
||||
83
vendor/doctrine/doctrine-cache-bundle/DependencyInjection/Definition/RedisDefinition.php
vendored
Normal file
83
vendor/doctrine/doctrine-cache-bundle/DependencyInjection/Definition/RedisDefinition.php
vendored
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineCacheBundle\DependencyInjection\Definition;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Definition;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
|
||||
/**
|
||||
* Redis definition.
|
||||
*
|
||||
* @author Fabio B. Silva <fabio.bat.silva@gmail.com>
|
||||
*/
|
||||
class RedisDefinition extends CacheDefinition
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function configure($name, array $config, Definition $service, ContainerBuilder $container)
|
||||
{
|
||||
$redisConf = $config['redis'];
|
||||
$connRef = $this->getConnectionReference($name, $redisConf, $container);
|
||||
|
||||
$service->addMethodCall('setRedis', array($connRef));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param array $config
|
||||
* @param \Symfony\Component\DependencyInjection\ContainerBuilder $container
|
||||
*
|
||||
* @return \Symfony\Component\DependencyInjection\Reference
|
||||
*/
|
||||
private function getConnectionReference($name, array $config, ContainerBuilder $container)
|
||||
{
|
||||
if (isset($config['connection_id'])) {
|
||||
return new Reference($config['connection_id']);
|
||||
}
|
||||
|
||||
$host = $config['host'];
|
||||
$port = $config['port'];
|
||||
$connClass = '%doctrine_cache.redis.connection.class%';
|
||||
$connId = sprintf('doctrine_cache.services.%s_redis.connection', $name);
|
||||
$connDef = new Definition($connClass);
|
||||
$connParams = array($host, $port);
|
||||
|
||||
if (isset($config['timeout'])) {
|
||||
$connParams[] = $config['timeout'];
|
||||
}
|
||||
|
||||
$connMethod = 'connect';
|
||||
|
||||
if (isset($config['persistent']) && $config['persistent']) {
|
||||
$connMethod = 'pconnect';
|
||||
}
|
||||
|
||||
$connDef->setPublic(false);
|
||||
$connDef->addMethodCall($connMethod, $connParams);
|
||||
|
||||
if (isset($config['password'])) {
|
||||
$password = $config['password'];
|
||||
$connDef->addMethodCall('auth', array($password));
|
||||
}
|
||||
|
||||
if (isset($config['database'])) {
|
||||
$database = (int) $config['database'];
|
||||
$connDef->addMethodCall('select', array($database));
|
||||
}
|
||||
|
||||
$container->setDefinition($connId, $connDef);
|
||||
|
||||
return new Reference($connId);
|
||||
}
|
||||
}
|
||||
109
vendor/doctrine/doctrine-cache-bundle/DependencyInjection/Definition/RiakDefinition.php
vendored
Normal file
109
vendor/doctrine/doctrine-cache-bundle/DependencyInjection/Definition/RiakDefinition.php
vendored
Normal file
|
|
@ -0,0 +1,109 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineCacheBundle\DependencyInjection\Definition;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Definition;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
|
||||
/**
|
||||
* Riak definition.
|
||||
*
|
||||
* @author Fabio B. Silva <fabio.bat.silva@gmail.com>
|
||||
*/
|
||||
class RiakDefinition extends CacheDefinition
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function configure($name, array $config, Definition $service, ContainerBuilder $container)
|
||||
{
|
||||
$riakConf = $config['riak'];
|
||||
$bucketRef = $this->getBucketReference($name, $riakConf, $container);
|
||||
|
||||
$service->setArguments(array($bucketRef));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param array $config
|
||||
* @param \Symfony\Component\DependencyInjection\ContainerBuilder $container
|
||||
*
|
||||
* @return \Symfony\Component\DependencyInjection\Reference
|
||||
*/
|
||||
private function getBucketReference($name, array $config, ContainerBuilder $container)
|
||||
{
|
||||
if (isset($config['bucket_id'])) {
|
||||
return new Reference($config['bucket_id']);
|
||||
}
|
||||
|
||||
$bucketName = $config['bucket_name'];
|
||||
$bucketClass = '%doctrine_cache.riak.bucket.class%';
|
||||
$bucketId = sprintf('doctrine_cache.services.%s.bucket', $name);
|
||||
$connDef = $this->getConnectionReference($name, $config, $container);
|
||||
$bucketDef = new Definition($bucketClass, array($connDef, $bucketName));
|
||||
|
||||
$bucketDef->setPublic(false);
|
||||
$container->setDefinition($bucketId, $bucketDef);
|
||||
|
||||
if ( ! empty($config['bucket_property_list'])) {
|
||||
$this->configureBucketPropertyList($name, $config['bucket_property_list'], $bucketDef, $container);
|
||||
}
|
||||
|
||||
return new Reference($bucketId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param array $config
|
||||
* @param \Symfony\Component\DependencyInjection\ContainerBuilder $container
|
||||
*
|
||||
* @return \Symfony\Component\DependencyInjection\Reference
|
||||
*/
|
||||
private function getConnectionReference($name, array $config, ContainerBuilder $container)
|
||||
{
|
||||
if (isset($config['connection_id'])) {
|
||||
return new Reference($config['connection_id']);
|
||||
}
|
||||
|
||||
$host = $config['host'];
|
||||
$port = $config['port'];
|
||||
$connClass = '%doctrine_cache.riak.connection.class%';
|
||||
$connId = sprintf('doctrine_cache.services.%s.connection', $name);
|
||||
$connDef = new Definition($connClass, array($host, $port));
|
||||
|
||||
$connDef->setPublic(false);
|
||||
$container->setDefinition($connId, $connDef);
|
||||
|
||||
return new Reference($connId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param array $config
|
||||
* @param \Symfony\Component\DependencyInjection\Definition $bucketDefinition
|
||||
* @param \Symfony\Component\DependencyInjection\ContainerBuilder $container
|
||||
*/
|
||||
private function configureBucketPropertyList($name, array $config, Definition $bucketDefinition, ContainerBuilder $container)
|
||||
{
|
||||
$propertyListClass = '%doctrine_cache.riak.bucket_property_list.class%';
|
||||
$propertyListServiceId = sprintf('doctrine_cache.services.%s.bucket_property_list', $name);
|
||||
$propertyListReference = new Reference($propertyListServiceId);
|
||||
$propertyListDefinition = new Definition($propertyListClass, array(
|
||||
$config['n_value'],
|
||||
$config['allow_multiple']
|
||||
));
|
||||
|
||||
$container->setDefinition($propertyListServiceId, $propertyListDefinition);
|
||||
$bucketDefinition->addMethodCall('setPropertyList', array($propertyListReference));
|
||||
}
|
||||
}
|
||||
60
vendor/doctrine/doctrine-cache-bundle/DependencyInjection/Definition/Sqlite3Definition.php
vendored
Normal file
60
vendor/doctrine/doctrine-cache-bundle/DependencyInjection/Definition/Sqlite3Definition.php
vendored
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineCacheBundle\DependencyInjection\Definition;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Definition;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
|
||||
/**
|
||||
* Sqlite3 definition.
|
||||
*
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
*/
|
||||
class Sqlite3Definition extends CacheDefinition
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function configure($name, array $config, Definition $service, ContainerBuilder $container)
|
||||
{
|
||||
$sqlite3Conf = $config['sqlite3'];
|
||||
$tableName = $sqlite3Conf['table_name'];
|
||||
$connectionRef = $this->getConnectionReference($name, $sqlite3Conf, $container);
|
||||
|
||||
$service->setArguments(array($connectionRef, $tableName));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param array $config
|
||||
* @param \Symfony\Component\DependencyInjection\ContainerBuilder $container
|
||||
*
|
||||
* @return \Symfony\Component\DependencyInjection\Reference
|
||||
*/
|
||||
private function getConnectionReference($name, array $config, ContainerBuilder $container)
|
||||
{
|
||||
if (isset($config['connection_id'])) {
|
||||
return new Reference($config['connection_id']);
|
||||
}
|
||||
|
||||
$fileName = $config['file_name'];
|
||||
$connClass = '%doctrine_cache.sqlite3.connection.class%';
|
||||
$connId = sprintf('doctrine_cache.services.%s.connection', $name);
|
||||
$connDef = new Definition($connClass, array($fileName, SQLITE3_OPEN_READWRITE | SQLITE3_OPEN_CREATE));
|
||||
|
||||
$connDef->setPublic(false);
|
||||
$container->setDefinition($connId, $connDef);
|
||||
|
||||
return new Reference($connId);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue