From ec2a3bc4173087e1b15963df7168d200fc32f894 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 5 Feb 2010 15:50:05 +0100 Subject: [PATCH] [DependencyInjection] removed the built-in extensions --- .../Loader/Extension/DoctrineExtension.php | 124 -------------- .../Loader/Extension/SwiftMailerExtension.php | 128 --------------- .../Extension/SymfonyTemplatingExtension.php | 155 ------------------ .../Loader/Extension/ZendExtension.php | 141 ---------------- .../Extension/xml/doctrine/dbal-1.0.xml | 48 ------ .../Loader/Extension/xml/doctrine/orm-1.0.xml | 24 --- .../xml/swiftmailer/swiftmailer-1.0.xml | 91 ---------- .../Extension/xml/symfony/templating-1.0.xml | 46 ------ .../Loader/Extension/xml/zend/logger-1.0.xml | 26 --- .../Loader/Extension/xml/zend/mail-1.0.xml | 48 ------ .../schema/dic/doctrine/doctrine-1.0.xsd | 20 --- .../dic/swiftmailer/swiftmailer-1.0.xsd | 55 ------- .../Loader/schema/dic/symfony/symfony-1.0.xsd | 19 --- .../Loader/schema/dic/zend/zend-1.0.xsd | 65 -------- 14 files changed, 990 deletions(-) delete mode 100644 src/Symfony/Components/DependencyInjection/Loader/Extension/DoctrineExtension.php delete mode 100644 src/Symfony/Components/DependencyInjection/Loader/Extension/SwiftMailerExtension.php delete mode 100644 src/Symfony/Components/DependencyInjection/Loader/Extension/SymfonyTemplatingExtension.php delete mode 100644 src/Symfony/Components/DependencyInjection/Loader/Extension/ZendExtension.php delete mode 100644 src/Symfony/Components/DependencyInjection/Loader/Extension/xml/doctrine/dbal-1.0.xml delete mode 100644 src/Symfony/Components/DependencyInjection/Loader/Extension/xml/doctrine/orm-1.0.xml delete mode 100644 src/Symfony/Components/DependencyInjection/Loader/Extension/xml/swiftmailer/swiftmailer-1.0.xml delete mode 100644 src/Symfony/Components/DependencyInjection/Loader/Extension/xml/symfony/templating-1.0.xml delete mode 100644 src/Symfony/Components/DependencyInjection/Loader/Extension/xml/zend/logger-1.0.xml delete mode 100644 src/Symfony/Components/DependencyInjection/Loader/Extension/xml/zend/mail-1.0.xml delete mode 100644 src/Symfony/Components/DependencyInjection/Loader/schema/dic/doctrine/doctrine-1.0.xsd delete mode 100644 src/Symfony/Components/DependencyInjection/Loader/schema/dic/swiftmailer/swiftmailer-1.0.xsd delete mode 100644 src/Symfony/Components/DependencyInjection/Loader/schema/dic/symfony/symfony-1.0.xsd delete mode 100644 src/Symfony/Components/DependencyInjection/Loader/schema/dic/zend/zend-1.0.xsd diff --git a/src/Symfony/Components/DependencyInjection/Loader/Extension/DoctrineExtension.php b/src/Symfony/Components/DependencyInjection/Loader/Extension/DoctrineExtension.php deleted file mode 100644 index ba3d3f5711..0000000000 --- a/src/Symfony/Components/DependencyInjection/Loader/Extension/DoctrineExtension.php +++ /dev/null @@ -1,124 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -/** - * DoctrineExtension is an extension for the Doctrine DBAL and ORM library. - * - * @package symfony - * @subpackage dependency_injection - * @author Fabien Potencier - */ -class DoctrineExtension extends LoaderExtension -{ - protected $resources = array( - 'dbal' => 'dbal-1.0.xml', - 'orm' => 'orm-1.0.xml', - ); - - protected $alias; - - public function setAlias($alias) - { - $this->alias = $alias; - } - - /** - * Loads the DBAL configuration. - * - * Usage example: - * - * - * - * @param array $config A configuration array - * - * @return BuilderConfiguration A BuilderConfiguration instance - */ - public function dbalLoad($config) - { - $configuration = new BuilderConfiguration(); - - $loader = new XmlFileLoader(__DIR__.'/xml/doctrine'); - $configuration->merge($loader->load($this->resources['dbal'])); - - foreach (array('dbname', 'host', 'username', 'password', 'path', 'port') as $key) - { - if (isset($config[$key])) - { - $configuration->setParameter('doctrine.dbal.'.$key, $config[$key]); - } - } - - if (isset($config['options'])) - { - $configuration->setParameter('doctrine.dbal.driver.options', $config['options']); - } - - if (isset($config['driver'])) - { - $class = $config['driver']; - if (in_array($class, array('OCI8', 'PDOMsSql', 'PDOMySql', 'PDOOracle', 'PDOPgSql', 'PDOSqlite'))) - { - $class = 'Doctrine\\DBAL\\Driver\\'.$class.'\\Driver'; - } - - $configuration->setParameter('doctrine.dbal.driver.class', $class); - } - - $configuration->setAlias('connection', null !== $this->alias ? $this->alias : 'doctrine.dbal.connection'); - - return $configuration; - } - - /** - * Loads the Doctrine ORM configuration. - * - * @param array $config A configuration array - * - * @return BuilderConfiguration A BuilderConfiguration instance - */ - public function ormLoad($config) - { - $configuration = new BuilderConfiguration(); - - $loader = new XmlFileLoader(__DIR__.'/xml/doctrine'); - $configuration->merge($loader->load($this->resources['orm'])); - - return $configuration; - } - - /** - * Returns the namespace to be used for this extension (XML namespace). - * - * @return string The XML namespace - */ - public function getNamespace() - { - return 'http://www.symfony-project.org/schema/dic/doctrine'; - } - - /** - * Returns the recommanded alias to use in XML. - * - * This alias is also the mandatory prefix to use when using YAML. - * - * @return string The alias - */ - public function getAlias() - { - return 'doctrine'; - } -} diff --git a/src/Symfony/Components/DependencyInjection/Loader/Extension/SwiftMailerExtension.php b/src/Symfony/Components/DependencyInjection/Loader/Extension/SwiftMailerExtension.php deleted file mode 100644 index 3835d093bb..0000000000 --- a/src/Symfony/Components/DependencyInjection/Loader/Extension/SwiftMailerExtension.php +++ /dev/null @@ -1,128 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -/** - * SwiftMailerExtension is an extension for the Swift Mailer library. - * - * @package symfony - * @subpackage dependency_injection - * @author Fabien Potencier - */ -class SwiftMailerExtension extends LoaderExtension -{ - protected $resources = array( - 'mailer' => 'swiftmailer-1.0.xml', - ); - - /** - * Loads the Swift Mailer configuration. - * - * Usage example: - * - * - * fabien - * xxxxx - * - * - * - * @param array $config A configuration array - * - * @return BuilderConfiguration A BuilderConfiguration instance - */ - public function mailerLoad($config) - { - $configuration = new BuilderConfiguration(); - - $loader = new XmlFileLoader(__DIR__.'/xml/swiftmailer'); - $configuration->merge($loader->load($this->resources['mailer'])); - - if (null === $config['transport']) - { - $config['transport'] = 'null'; - } - elseif (!isset($config['transport'])) - { - $config['transport'] = 'smtp'; - } - elseif ('gmail' === $config['transport']) - { - $config['encryption'] = 'ssl'; - $config['auth_mode'] = 'login'; - $config['host'] = 'smtp.gmail.com'; - $config['transport'] = 'smtp'; - } - - $configuration->setAlias('swiftmailer.transport', 'swiftmailer.transport.'.$config['transport']); - - if (isset($config['encryption']) && 'ssl' === $config['encryption'] && !isset($config['port'])) - { - $config['port'] = 465; - } - - foreach (array('encryption', 'port', 'host', 'username', 'password', 'auth_mode') as $key) - { - if (isset($config[$key])) - { - $configuration->setParameter('swiftmailer.transport.'.$config['transport'].'.'.$key, $config[$key]); - } - } - - // spool? - if (isset($config['spool'])) - { - $type = isset($config['type']) ? $config['type'] : 'file'; - - $configuration->setAlias('swiftmailer.transport.real', 'swiftmailer.transport.'.$config['transport']); - $configuration->setAlias('swiftmailer.transport', 'swiftmailer.transport.spool'); - $configuration->setAlias('swiftmailer.spool', 'swiftmailer.spool.'.$type); - - foreach (array('path') as $key) - { - if (isset($config['spool'][$key])) - { - $configuration->setParameter('swiftmailer.spool.'.$type.'.'.$key, $config['spool'][$key]); - } - } - } - - $configuration->setAlias('mailer', 'swiftmailer.mailer'); - - return $configuration; - } - - /** - * Returns the namespace to be used for this extension (XML namespace). - * - * @return string The XML namespace - */ - public function getNamespace() - { - return 'http://www.symfony-project.org/schema/dic/swiftmailer'; - } - - /** - * Returns the recommanded alias to use in XML. - * - * This alias is also the mandatory prefix to use when using YAML. - * - * @return string The alias - */ - public function getAlias() - { - return 'swift'; - } -} diff --git a/src/Symfony/Components/DependencyInjection/Loader/Extension/SymfonyTemplatingExtension.php b/src/Symfony/Components/DependencyInjection/Loader/Extension/SymfonyTemplatingExtension.php deleted file mode 100644 index 64fedd2229..0000000000 --- a/src/Symfony/Components/DependencyInjection/Loader/Extension/SymfonyTemplatingExtension.php +++ /dev/null @@ -1,155 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -/** - * SymfonyTemplatingExtension is an extension for the Symfony Templating Component. - * - * @package symfony - * @subpackage dependency_injection - * @author Fabien Potencier - */ -class SymfonyTemplatingExtension extends LoaderExtension -{ - protected $resources = array( - 'templating' => 'templating-1.0.xml', - ); - protected $defaultHelpers = array(); - protected $alias; - - public function setAlias($alias) - { - $this->alias = $alias; - } - - public function setDefaultHelpers(array $defaultHelpers) - { - $this->defaultHelpers = $defaultHelpers; - } - - /** - * Loads the templating configuration. - * - * Usage example: - * - * - * symfony.templating.loader.filesystem - * - * symfony.templating.helper.javascripts - * symfony.templating.helper.stylesheets - * - * - * - * @param array $config A configuration array - * - * @return BuilderConfiguration A BuilderConfiguration instance - */ - public function templatingLoad($config) - { - $configuration = new BuilderConfiguration(); - - $loader = new XmlFileLoader(__DIR__.'/xml/symfony'); - $configuration->merge($loader->load($this->resources['templating'])); - - // path for the filesystem loader - if (isset($config['path'])) - { - $configuration->setParameter('symfony.templating.loader.filesystem.path', $config['path']); - } - - // loaders - if (isset($config['loader'])) - { - $loaders = array(); - $ids = is_array($config['loader']) ? $config['loader'] : array($config['loader']); - foreach ($ids as $id) - { - $loaders[] = new Reference($id); - } - } - else - { - $loaders = array( - new Reference('symfony.templating.loader.filesystem'), - ); - } - - if (1 === count($loaders)) - { - $configuration->setAlias('symfony.templating.loader', (string) $loaders[0]); - } - else - { - $configuration->getDefinition('symfony.templating.loader.chain')->addArgument($loaders); - $configuration->setAlias('symfony.templating.loader', 'symfony.templating.loader.chain'); - } - - // helpers - if (array_key_exists('helpers', $config)) - { - $helpers = array(); - foreach (explode("\n", $config['helpers']) as $helper) - { - if ($helper) - { - $helpers[] = new Reference(trim($helper)); - } - } - } - else - { - $helpers = $this->defaultHelpers; - } - - $configuration->getDefinition('symfony.templating.helperset')->addArgument($helpers); - - // cache? - if (isset($config['cache'])) - { - // wrap the loader with some cache - $configuration->setDefinition('symfony.templating.loader.wrapped', $configuration->findDefinition('symfony.templating.loader')); - $configuration->setDefinition('symfony.templating.loader', $configuration->getDefinition('symfony.templating.loader.cache')); - $configuration->setParameter('symfony.templating.loader.cache.path', $config['cache']); - } - - $configuration->setAlias('templating', null !== $this->alias ? $this->alias : 'symfony.templating.engine'); - - return $configuration; - } - - /** - * Returns the namespace to be used for this extension (XML namespace). - * - * @return string The XML namespace - */ - public function getNamespace() - { - return 'http://www.symfony-project.org/schema/dic/symfony'; - } - - /** - * Returns the recommanded alias to use in XML. - * - * This alias is also the mandatory prefix to use when using YAML. - * - * @return string The alias - */ - public function getAlias() - { - return 'symfony'; - } -} diff --git a/src/Symfony/Components/DependencyInjection/Loader/Extension/ZendExtension.php b/src/Symfony/Components/DependencyInjection/Loader/Extension/ZendExtension.php deleted file mode 100644 index 045d644392..0000000000 --- a/src/Symfony/Components/DependencyInjection/Loader/Extension/ZendExtension.php +++ /dev/null @@ -1,141 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -/** - * ZendExtension is an extension for the Zend Framework libraries. - * - * @package symfony - * @subpackage dependency_injection - * @author Fabien Potencier - */ -class ZendExtension extends LoaderExtension -{ - protected $resources = array( - 'logger' => 'logger-1.0.xml', - 'mail' => 'mail-1.0.xml', - ); - - /** - * Loads the logger configuration. - * - * Usage example: - * - * - * - * @param array $config A configuration array - * - * @return BuilderConfiguration A BuilderConfiguration instance - */ - public function loggerLoad($config) - { - $configuration = new BuilderConfiguration(); - - $loader = new XmlFileLoader(__DIR__.'/xml/zend'); - $configuration->merge($loader->load($this->resources['logger'])); - - if (isset($config['priority'])) - { - $configuration->setParameter('zend.logger.priority', is_int($config['priority']) ? $config['priority'] : constant('\Zend_Log::'.strtoupper($config['priority']))); - } - - if (isset($config['path'])) - { - $configuration->setParameter('zend.logger.path', $config['path']); - } - - $configuration->setAlias('logger', 'zend.logger'); - - return $configuration; - } - - /** - * Loads the mail configuration. - * - * Usage example: - * - * - * fabien - * xxxxxx - * - * - * @param array $config A configuration array - * - * @return BuilderConfiguration A BuilderConfiguration instance - */ - public function mailLoad($config) - { - $configuration = new BuilderConfiguration(); - - $loader = new XmlFileLoader(__DIR__.'/xml/zend'); - $configuration->merge($loader->load($this->resources['logger'])); - - if (isset($config['transport'])) - { - if ('gmail' === $config['transport']) - { - $config['ssl'] = 'ssl'; - $config['auth'] = 'login'; - $config['host'] = 'smtp.gmail.com'; - - $configuration->setAlias('zend.mail.transport', 'zend.mail.transport.smtp.ssl'); - } - else - { - if (isset($config['ssl']) && $config['ssl']) - { - $config['transport'] = $config['transport'].'.ssl'; - } - $configuration->setAlias('zend.mail.transport', 'zend.mail.transport.'.$config['transport']); - } - } - - if (isset($config['ssl'])) - { - if (true === $config['ssl'] || 'ssl' === $config['ssl']) - { - $config['ssl'] = 'ssl'; - if (!isset($config['port'])) - { - $config['port'] = 465; - } - } - $configuration->setParameter('zend.mail.smtp.ssl', $config['ssl']); - } - - foreach (array('port', 'host', 'username', 'password', 'auth') as $key) - { - if (isset($config[$key])) - { - $configuration->setParameter('zend.mail.smtp.'.$key, $config[$key]); - } - } - - $configuration->setAlias('mail', 'zend.mail'); - - return $configuration; - } - - public function getNamespace() - { - return 'http://www.symfony-project.org/schema/dic/zend'; - } - - public function getAlias() - { - return 'zend'; - } -} diff --git a/src/Symfony/Components/DependencyInjection/Loader/Extension/xml/doctrine/dbal-1.0.xml b/src/Symfony/Components/DependencyInjection/Loader/Extension/xml/doctrine/dbal-1.0.xml deleted file mode 100644 index 6c001cd3b8..0000000000 --- a/src/Symfony/Components/DependencyInjection/Loader/Extension/xml/doctrine/dbal-1.0.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - null - root - - localhost - null - null - Doctrine\DBAL\Driver\PDOMySql\Driver - - Doctrine\DBAL\Connection - Doctrine\DBAL\Configuration - Doctrine\Common\EventManager - - - - - - %doctrine.dbal.dbname% - %doctrine.dbal.user% - %doctrine.dbal.password% - %doctrine.dbal.host% - %doctrine.dbal.port% - %doctrine.dbal.path% - %doctrine.dbal.driver.class% - %doctrine.dbal.driver.options% - - - - - - - - - - - - - - - diff --git a/src/Symfony/Components/DependencyInjection/Loader/Extension/xml/doctrine/orm-1.0.xml b/src/Symfony/Components/DependencyInjection/Loader/Extension/xml/doctrine/orm-1.0.xml deleted file mode 100644 index 5fc2bacc46..0000000000 --- a/src/Symfony/Components/DependencyInjection/Loader/Extension/xml/doctrine/orm-1.0.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - %kernel.cache_dir%/doctrine/Proxies - Proxies - - - - - diff --git a/src/Symfony/Components/DependencyInjection/Loader/Extension/xml/swiftmailer/swiftmailer-1.0.xml b/src/Symfony/Components/DependencyInjection/Loader/Extension/xml/swiftmailer/swiftmailer-1.0.xml deleted file mode 100644 index 718cd7f330..0000000000 --- a/src/Symfony/Components/DependencyInjection/Loader/Extension/xml/swiftmailer/swiftmailer-1.0.xml +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - Swift_Mailer - - Swift_Transport_EsmtpTransport - Swift_Transport_SendmailTransport - Swift_Transport_MailTransport - - localhost - 25 - null - null - null - null - - Swift_FileSpool - - - - - - - - - - - - - - - %swiftmailer.transport.smtp.host% - %swiftmailer.transport.smtp.port% - %swiftmailer.transport.smtp.encryption% - %swiftmailer.transport.smtp.username% - %swiftmailer.transport.smtp.password% - %swiftmailer.transport.smtp.auth_mode% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - %swiftmailer.spool.file.path% - - - - - - - diff --git a/src/Symfony/Components/DependencyInjection/Loader/Extension/xml/symfony/templating-1.0.xml b/src/Symfony/Components/DependencyInjection/Loader/Extension/xml/symfony/templating-1.0.xml deleted file mode 100644 index 0b019af004..0000000000 --- a/src/Symfony/Components/DependencyInjection/Loader/Extension/xml/symfony/templating-1.0.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - Symfony\Components\Templating\Engine - Symfony\Components\Templating\Helper\HelperSet - Symfony\Components\Templating\Loader\FilesystemLoader - Symfony\Components\Templating\Loader\CacheLoader - Symfony\Components\Templating\Loader\ChainLoader - Symfony\Components\Templating\Helper\JavascriptsHelper - Symfony\Components\Templating\Helper\StylesheetsHelper - - - - - - - - - - - - - %symfony.templating.loader.filesystem.path% - - - - - - %symfony.templating.loader.cache.path% - - - - - - - - - - - - - diff --git a/src/Symfony/Components/DependencyInjection/Loader/Extension/xml/zend/logger-1.0.xml b/src/Symfony/Components/DependencyInjection/Loader/Extension/xml/zend/logger-1.0.xml deleted file mode 100644 index d1f8374094..0000000000 --- a/src/Symfony/Components/DependencyInjection/Loader/Extension/xml/zend/logger-1.0.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - Zend_Log - Zend_Log::CRIT - - - - - - - - - %zend.logger.path% - - - - - %zend.logger.priority% - - - diff --git a/src/Symfony/Components/DependencyInjection/Loader/Extension/xml/zend/mail-1.0.xml b/src/Symfony/Components/DependencyInjection/Loader/Extension/xml/zend/mail-1.0.xml deleted file mode 100644 index bbbe845205..0000000000 --- a/src/Symfony/Components/DependencyInjection/Loader/Extension/xml/zend/mail-1.0.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - Zend_Mail - Zend_Mail_Transport_Smtp - localhost - null - null - null - null - 25 - - - - - - - - - - - %zend.mail.smtp.host% - - %zend.mail.smtp.auth% - %zend.mail.smtp.username% - %zend.mail.smtp.password% - %zend.mail.smtp.port% - - - - - %zend.mail.smtp.host% - - %zend.mail.smtp.auth% - %zend.mail.smtp.username% - %zend.mail.smtp.password% - %zend.mail.smtp.ssl% - %zend.mail.smtp.port% - - - - - - diff --git a/src/Symfony/Components/DependencyInjection/Loader/schema/dic/doctrine/doctrine-1.0.xsd b/src/Symfony/Components/DependencyInjection/Loader/schema/dic/doctrine/doctrine-1.0.xsd deleted file mode 100644 index 69445f5faa..0000000000 --- a/src/Symfony/Components/DependencyInjection/Loader/schema/dic/doctrine/doctrine-1.0.xsd +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/src/Symfony/Components/DependencyInjection/Loader/schema/dic/swiftmailer/swiftmailer-1.0.xsd b/src/Symfony/Components/DependencyInjection/Loader/schema/dic/swiftmailer/swiftmailer-1.0.xsd deleted file mode 100644 index 10e3598ecd..0000000000 --- a/src/Symfony/Components/DependencyInjection/Loader/schema/dic/swiftmailer/swiftmailer-1.0.xsd +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Symfony/Components/DependencyInjection/Loader/schema/dic/symfony/symfony-1.0.xsd b/src/Symfony/Components/DependencyInjection/Loader/schema/dic/symfony/symfony-1.0.xsd deleted file mode 100644 index a56eb59de2..0000000000 --- a/src/Symfony/Components/DependencyInjection/Loader/schema/dic/symfony/symfony-1.0.xsd +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/src/Symfony/Components/DependencyInjection/Loader/schema/dic/zend/zend-1.0.xsd b/src/Symfony/Components/DependencyInjection/Loader/schema/dic/zend/zend-1.0.xsd deleted file mode 100644 index 5728335409..0000000000 --- a/src/Symfony/Components/DependencyInjection/Loader/schema/dic/zend/zend-1.0.xsd +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -