+
+ {% if is_writable %}
+ Your parameters.ini has been overwritten with these parameters (in {{ ini_path }}):
+ {% else %}
+ Your parameters.ini file is not writeable! Here are the parameters you can copy and paste in {{ ini_path }}:
+ {% endif %}
+
+
+
+{% set hide_edit, hide_delete = false, false %}
+{% include 'views/others/record_actions.html.twig' %}
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Sensio/Bundle/GeneratorBundle/Resources/skeleton/form/FormType.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Sensio/Bundle/GeneratorBundle/Resources/skeleton/form/FormType.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,26 @@
+add('{{ field }}')
+
+ {%- endfor %}
+
+ ;
+ }
+
+ public function getName()
+ {
+ return '{{ form_type_name }}';
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Sensio/Bundle/GeneratorBundle/SensioGeneratorBundle.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Sensio/Bundle/GeneratorBundle/SensioGeneratorBundle.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,23 @@
+
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+
+namespace Sensio\Bundle\GeneratorBundle;
+
+use Symfony\Component\HttpKernel\Bundle\Bundle;
+
+/**
+ * SensioGeneratorBundle.
+ *
+ * @author Fabien Potencier
+ */
+class SensioGeneratorBundle extends Bundle
+{
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Sensio/Bundle/GeneratorBundle/Tests/Command/GenerateBundleCommandTest.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Sensio/Bundle/GeneratorBundle/Tests/Command/GenerateBundleCommandTest.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,104 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Sensio\Bundle\GeneratorBundle\Tests\Command;
+
+use Symfony\Component\Console\Helper\HelperSet;
+use Symfony\Component\Console\Helper\FormatterHelper;
+use Symfony\Component\Console\Output\StreamOutput;
+use Symfony\Component\Console\Tester\CommandTester;
+use Sensio\Bundle\GeneratorBundle\Command\GenerateBundleCommand;
+use Sensio\Bundle\GeneratorBundle\Command\Helper\DialogHelper;
+use Symfony\Component\DependencyInjection\Container;
+
+class GenerateBundleCommandTest extends GenerateCommandTest
+{
+ /**
+ * @dataProvider getInteractiveCommandData
+ */
+ public function testInteractiveCommand($options, $input, $expected)
+ {
+ list($namespace, $bundle, $dir, $format, $structure) = $expected;
+
+ $generator = $this->getGenerator();
+ $generator
+ ->expects($this->once())
+ ->method('generate')
+ ->with($namespace, $bundle, $dir, $format, $structure)
+ ;
+
+ $tester = new CommandTester($this->getCommand($generator, $input));
+ $tester->execute($options);
+ }
+
+ public function getInteractiveCommandData()
+ {
+ $tmp = sys_get_temp_dir();
+ return array(
+ array(array('--dir' => $tmp), "Foo/BarBundle\n", array('Foo\BarBundle', 'FooBarBundle', $tmp.'/', 'annotation', false)),
+ array(array('--dir' => $tmp), "Foo/BarBundle\nBarBundle\nfoo\nyml\nn", array('Foo\BarBundle', 'BarBundle', 'foo/', 'yml', false)),
+ array(array('--dir' => $tmp, '--format' => 'yml', '--bundle-name' => 'BarBundle', '--structure' => true), "Foo/BarBundle\n", array('Foo\BarBundle', 'BarBundle', $tmp.'/', 'yml', true)),
+ );
+ }
+
+ /**
+ * @dataProvider getNonInteractiveCommandData
+ */
+ public function testNonInteractiveCommand($options, $expected)
+ {
+ list($namespace, $bundle, $dir, $format, $structure) = $expected;
+
+ $generator = $this->getGenerator();
+ $generator
+ ->expects($this->once())
+ ->method('generate')
+ ->with($namespace, $bundle, $dir, $format, $structure)
+ ;
+
+ $tester = new CommandTester($this->getCommand($generator, ''));
+ $tester->execute($options, array('interactive' => false));
+ }
+
+ public function getNonInteractiveCommandData()
+ {
+ $tmp = sys_get_temp_dir();
+ return array(
+ array(array('--dir' => $tmp, '--namespace' => 'Foo/BarBundle'), array('Foo\BarBundle', 'FooBarBundle', $tmp.'/', 'annotation', false)),
+ array(array('--dir' => $tmp, '--namespace' => 'Foo/BarBundle', '--format' => 'yml', '--bundle-name' => 'BarBundle', '--structure' => true), array('Foo\BarBundle', 'BarBundle', $tmp.'/', 'yml', true)),
+ );
+ }
+
+ protected function getCommand($generator, $input)
+ {
+ $command = $this
+ ->getMockBuilder('Sensio\Bundle\GeneratorBundle\Command\GenerateBundleCommand')
+ ->setMethods(array('checkAutoloader', 'updateKernel', 'updateRouting'))
+ ->getMock()
+ ;
+
+ $command->setContainer($this->getContainer());
+ $command->setHelperSet($this->getHelperSet($input));
+ $command->setGenerator($generator);
+
+ return $command;
+ }
+
+ protected function getGenerator()
+ {
+ // get a noop generator
+ return $this
+ ->getMockBuilder('Sensio\Bundle\GeneratorBundle\Generator\BundleGenerator')
+ ->disableOriginalConstructor()
+ ->setMethods(array('generate'))
+ ->getMock()
+ ;
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Sensio/Bundle/GeneratorBundle/Tests/Command/GenerateCommandTest.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Sensio/Bundle/GeneratorBundle/Tests/Command/GenerateCommandTest.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,76 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Sensio\Bundle\GeneratorBundle\Tests\Command;
+
+use Symfony\Component\Console\Helper\HelperSet;
+use Symfony\Component\Console\Helper\FormatterHelper;
+use Symfony\Component\Console\Output\StreamOutput;
+use Symfony\Component\Console\Tester\CommandTester;
+use Sensio\Bundle\GeneratorBundle\Command\Helper\DialogHelper;
+use Symfony\Component\DependencyInjection\Container;
+
+abstract class GenerateCommandTest extends \PHPUnit_Framework_TestCase
+{
+ protected function getHelperSet($input)
+ {
+ $dialog = new DialogHelper();
+ $dialog->setInputStream($this->getInputStream($input));
+
+ return new HelperSet(array(new FormatterHelper(), $dialog));
+ }
+
+ protected function getBundle()
+ {
+ $bundle = $this->getMock('Symfony\Component\HttpKernel\Bundle\BundleInterface');
+ $bundle
+ ->expects($this->any())
+ ->method('getPath')
+ ->will($this->returnValue(sys_get_temp_dir()))
+ ;
+
+ return $bundle;
+ }
+
+ protected function getInputStream($input)
+ {
+ $stream = fopen('php://memory', 'r+', false);
+ fputs($stream, $input.str_repeat("\n", 10));
+ rewind($stream);
+
+ return $stream;
+ }
+
+ protected function getContainer()
+ {
+ $kernel = $this->getMock('Symfony\Component\HttpKernel\KernelInterface');
+ $kernel
+ ->expects($this->any())
+ ->method('getBundle')
+ ->will($this->returnValue($this->getBundle()))
+ ;
+
+ $filesystem = $this->getMock('Symfony\Component\HttpKernel\Util\Filesystem');
+ $filesystem
+ ->expects($this->any())
+ ->method('isAbsolutePath')
+ ->will($this->returnValue(true))
+ ;
+
+ $container = new Container();
+ $container->set('kernel', $kernel);
+ $container->set('filesystem', $filesystem);
+
+ $container->setParameter('kernel.root_dir', sys_get_temp_dir());
+
+ return $container;
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Sensio/Bundle/GeneratorBundle/Tests/Command/GenerateDoctrineCrudCommandTest.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Sensio/Bundle/GeneratorBundle/Tests/Command/GenerateDoctrineCrudCommandTest.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,146 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Sensio\Bundle\GeneratorBundle\Tests\Command;
+
+use Symfony\Component\Console\Helper\HelperSet;
+use Symfony\Component\Console\Helper\FormatterHelper;
+use Symfony\Component\Console\Output\StreamOutput;
+use Symfony\Component\Console\Tester\CommandTester;
+use Sensio\Bundle\GeneratorBundle\Command\GenerateDoctrineCrudCommand;
+use Sensio\Bundle\GeneratorBundle\Command\Helper\DialogHelper;
+use Symfony\Component\DependencyInjection\Container;
+
+class GenerateDoctrineCrudCommandTest extends GenerateCommandTest
+{
+ /**
+ * @dataProvider getInteractiveCommandData
+ */
+ public function testInteractiveCommand($options, $input, $expected)
+ {
+ list($entity, $format, $prefix, $withWrite) = $expected;
+
+ $generator = $this->getGenerator();
+ $generator
+ ->expects($this->once())
+ ->method('generate')
+ ->with($this->getBundle(), $entity, $this->getDoctrineMetadata(), $format, $prefix, $withWrite)
+ ;
+
+ $tester = new CommandTester($this->getCommand($generator, $input));
+ $tester->execute($options);
+ }
+
+ public function getInteractiveCommandData()
+ {
+ return array(
+ array(array(), "AcmeBlogBundle:Blog/Post\n", array('Blog\\Post', 'annotation', 'blog_post', false)),
+ array(array('--entity' => 'AcmeBlogBundle:Blog/Post'), '', array('Blog\\Post', 'annotation', 'blog_post', false)),
+ array(array(), "AcmeBlogBundle:Blog/Post\ny\nyml\nfoobar\n", array('Blog\\Post', 'yml', 'foobar', true)),
+ array(array(), "AcmeBlogBundle:Blog/Post\ny\nyml\n/foobar\n", array('Blog\\Post', 'yml', 'foobar', true)),
+ array(array('--entity' => 'AcmeBlogBundle:Blog/Post', '--format' => 'yml', '--route-prefix' => 'foo', '--with-write' => true), '', array('Blog\\Post', 'yml', 'foo', true)),
+ );
+ }
+
+ /**
+ * @dataProvider getNonInteractiveCommandData
+ */
+ public function testNonInteractiveCommand($options, $expected)
+ {
+ list($entity, $format, $prefix, $withWrite) = $expected;
+
+ $generator = $this->getGenerator();
+ $generator
+ ->expects($this->once())
+ ->method('generate')
+ ->with($this->getBundle(), $entity, $this->getDoctrineMetadata(), $format, $prefix, $withWrite)
+ ;
+
+ $tester = new CommandTester($this->getCommand($generator, ''));
+ $tester->execute($options, array('interactive' => false));
+ }
+
+ public function getNonInteractiveCommandData()
+ {
+ return array(
+ array(array('--entity' => 'AcmeBlogBundle:Blog/Post'), array('Blog\\Post', 'annotation', 'blog_post', false)),
+ array(array('--entity' => 'AcmeBlogBundle:Blog/Post', '--format' => 'yml', '--route-prefix' => 'foo', '--with-write' => true), array('Blog\\Post', 'yml', 'foo', true)),
+ );
+ }
+
+ protected function getCommand($generator, $input)
+ {
+ $command = $this
+ ->getMockBuilder('Sensio\Bundle\GeneratorBundle\Command\GenerateDoctrineCrudCommand')
+ ->setMethods(array('getEntityMetadata'))
+ ->getMock()
+ ;
+
+ $command
+ ->expects($this->any())
+ ->method('getEntityMetadata')
+ ->will($this->returnValue(array($this->getDoctrineMetadata())))
+ ;
+
+ $command->setContainer($this->getContainer());
+ $command->setHelperSet($this->getHelperSet($input));
+ $command->setGenerator($generator);
+ $command->setFormGenerator($this->getFormGenerator());
+
+ return $command;
+ }
+
+ protected function getDoctrineMetadata()
+ {
+ return $this
+ ->getMockBuilder('Doctrine\ORM\Mapping\ClassMetadataInfo')
+ ->disableOriginalConstructor()
+ ->getMock()
+ ;
+ }
+
+ protected function getGenerator()
+ {
+ // get a noop generator
+ return $this
+ ->getMockBuilder('Sensio\Bundle\GeneratorBundle\Generator\DoctrineCrudGenerator')
+ ->disableOriginalConstructor()
+ ->setMethods(array('generate'))
+ ->getMock()
+ ;
+ }
+
+ protected function getFormGenerator()
+ {
+ return $this
+ ->getMockBuilder('Sensio\Bundle\GeneratorBundle\Generator\DoctrineFormGenerator')
+ ->disableOriginalConstructor()
+ ->setMethods(array('generate'))
+ ->getMock()
+ ;
+ }
+
+ protected function getContainer()
+ {
+ $container = parent::getContainer();
+
+ $registry = $this->getMock('Symfony\Bridge\Doctrine\RegistryInterface');
+ $registry
+ ->expects($this->any())
+ ->method('getEntityNamespace')
+ ->will($this->returnValue('Foo\\FooBundle\\Entity'))
+ ;
+
+ $container->set('doctrine', $registry);
+
+ return $container;
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Sensio/Bundle/GeneratorBundle/Tests/Command/GenerateDoctrineEntityCommandTest.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Sensio/Bundle/GeneratorBundle/Tests/Command/GenerateDoctrineEntityCommandTest.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,104 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Sensio\Bundle\GeneratorBundle\Tests\Command;
+
+use Symfony\Component\Console\Helper\HelperSet;
+use Symfony\Component\Console\Helper\FormatterHelper;
+use Symfony\Component\Console\Output\StreamOutput;
+use Symfony\Component\Console\Tester\CommandTester;
+use Sensio\Bundle\GeneratorBundle\Command\GenerateDoctrineEntityCommand;
+use Sensio\Bundle\GeneratorBundle\Command\Helper\DialogHelper;
+use Symfony\Component\DependencyInjection\Container;
+
+class GenerateDoctrineEntityCommandTest extends GenerateCommandTest
+{
+ /**
+ * @dataProvider getInteractiveCommandData
+ */
+ public function testInteractiveCommand($options, $input, $expected)
+ {
+ list($entity, $format, $fields) = $expected;
+
+ $generator = $this->getGenerator();
+ $generator
+ ->expects($this->once())
+ ->method('generate')
+ ->with($this->getBundle(), $entity, $format, $fields)
+ ;
+
+ $tester = new CommandTester($this->getCommand($generator, $input));
+ $tester->execute($options);
+ }
+
+ public function getInteractiveCommandData()
+ {
+ return array(
+ array(array(), "AcmeBlogBundle:Blog/Post\n", array('Blog\\Post', 'annotation', array())),
+ array(array('--entity' => 'AcmeBlogBundle:Blog/Post'), '', array('Blog\\Post', 'annotation', array())),
+ array(array(), "AcmeBlogBundle:Blog/Post\nyml\n\n", array('Blog\\Post', 'yml', array())),
+ array(array(), "AcmeBlogBundle:Blog/Post\nyml\ntitle\n\n255\ndescription\ntext\n\n", array('Blog\\Post', 'yml', array(
+ array('fieldName' => 'title', 'type' => 'string', 'length' => 255),
+ array('fieldName' => 'description', 'type' => 'text'),
+ ))),
+ );
+ }
+
+ /**
+ * @dataProvider getNonInteractiveCommandData
+ */
+ public function testNonInteractiveCommand($options, $expected)
+ {
+ list($entity, $format, $fields) = $expected;
+
+ $generator = $this->getGenerator();
+ $generator
+ ->expects($this->once())
+ ->method('generate')
+ ->with($this->getBundle(), $entity, $format, $fields)
+ ;
+
+ $tester = new CommandTester($this->getCommand($generator, ''));
+ $tester->execute($options, array('interactive' => false));
+ }
+
+ public function getNonInteractiveCommandData()
+ {
+ return array(
+ array(array('--entity' => 'AcmeBlogBundle:Blog/Post'), array('Blog\\Post', 'annotation', array())),
+ array(array('--entity' => 'AcmeBlogBundle:Blog/Post', '--format' => 'yml', '--fields' => 'title:string(255) description:text'), array('Blog\\Post', 'yml', array(
+ array('fieldName' => 'title', 'type' => 'string', 'length' => 255),
+ array('fieldName' => 'description', 'type' => 'text', 'length' => ''),
+ ))),
+ );
+ }
+
+ protected function getCommand($generator, $input)
+ {
+ $command = new GenerateDoctrineEntityCommand();
+ $command->setContainer($this->getContainer());
+ $command->setHelperSet($this->getHelperSet($input));
+ $command->setGenerator($generator);
+
+ return $command;
+ }
+
+ protected function getGenerator()
+ {
+ // get a noop generator
+ return $this
+ ->getMockBuilder('Sensio\Bundle\GeneratorBundle\Generator\DoctrineEntityGenerator')
+ ->disableOriginalConstructor()
+ ->setMethods(array('generate'))
+ ->getMock()
+ ;
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Sensio/Bundle/GeneratorBundle/Tests/Generator/BundleGeneratorTest.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Sensio/Bundle/GeneratorBundle/Tests/Generator/BundleGeneratorTest.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,60 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Sensio\Bundle\GeneratorBundle\Tests\Generator;
+
+use Sensio\Bundle\GeneratorBundle\Generator\BundleGenerator;
+use Symfony\Component\HttpKernel\Util\Filesystem;
+
+class BundleGeneratorTest extends GeneratorTest
+{
+ public function testGenerateYaml()
+ {
+ $generator = new BundleGenerator($this->filesystem, __DIR__.'/../../Resources/skeleton/bundle');
+ $generator->generate('Foo\BarBundle', 'FooBarBundle', $this->tmpDir, 'yml', false);
+
+ $files = array(
+ 'FooBarBundle.php',
+ 'Controller/DefaultController.php',
+ 'Resources/views/Default/index.html.twig',
+ 'Resources/config/routing.yml',
+ 'Tests/Controller/DefaultControllerTest.php',
+ 'Resources/config/services.yml',
+ 'DependencyInjection/Configuration.php',
+ 'DependencyInjection/FooBarExtension.php',
+ );
+ foreach ($files as $file) {
+ $this->assertTrue(file_exists($this->tmpDir.'/Foo/BarBundle/'.$file), sprintf('%s has been generated', $file));
+ }
+
+ $content = file_get_contents($this->tmpDir.'/Foo/BarBundle/FooBarBundle.php');
+ $this->assertContains('namespace Foo\\BarBundle', $content);
+
+ $content = file_get_contents($this->tmpDir.'/Foo/BarBundle/Controller/DefaultController.php');
+ $this->assertContains('public function indexAction', $content);
+ $this->assertNotContains('@Route("/hello/{name}"', $content);
+
+ $content = file_get_contents($this->tmpDir.'/Foo/BarBundle/Resources/views/Default/index.html.twig');
+ $this->assertContains('Hello {{ name }}!', $content);
+ }
+
+ public function testGenerateAnnotation()
+ {
+ $generator = new BundleGenerator($this->filesystem, __DIR__.'/../../Resources/skeleton/bundle');
+ $generator->generate('Foo\BarBundle', 'FooBarBundle', $this->tmpDir, 'annotation', false);
+
+ $this->assertFalse(file_exists($this->tmpDir.'/Foo/BarBundle/Resources/config/routing.yml'));
+ $this->assertFalse(file_exists($this->tmpDir.'/Foo/BarBundle/Resources/config/routing.xml'));
+
+ $content = file_get_contents($this->tmpDir.'/Foo/BarBundle/Controller/DefaultController.php');
+ $this->assertContains('@Route("/hello/{name}"', $content);
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Sensio/Bundle/GeneratorBundle/Tests/Generator/DoctrineCrudGeneratorTest.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Sensio/Bundle/GeneratorBundle/Tests/Generator/DoctrineCrudGeneratorTest.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,207 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Sensio\Bundle\GeneratorBundle\Tests\Generator;
+
+use Sensio\Bundle\GeneratorBundle\Generator\DoctrineCrudGenerator;
+use Symfony\Component\HttpKernel\Util\Filesystem;
+
+class DoctrineCrudGeneratorTest extends GeneratorTest
+{
+ public function testGenerateYamlFull()
+ {
+ $this->getGenerator()->generate($this->getBundle(), 'Post', $this->getMetadata(), 'yml', '/post', true);
+
+ $files = array(
+ 'Controller/PostController.php',
+ 'Tests/Controller/PostControllerTest.php',
+ 'Resources/config/routing/post.yml',
+ 'Resources/views/Post/index.html.twig',
+ 'Resources/views/Post/show.html.twig',
+ 'Resources/views/Post/new.html.twig',
+ 'Resources/views/Post/edit.html.twig',
+ );
+ foreach ($files as $file) {
+ $this->assertTrue(file_exists($this->tmpDir.'/'.$file), sprintf('%s has been generated', $file));
+ }
+
+ $files = array(
+ 'Resources/config/routing/post.xml',
+ );
+ foreach ($files as $file) {
+ $this->assertFalse(file_exists($this->tmpDir.'/'.$file), sprintf('%s has not been generated', $file));
+ }
+
+ $content = file_get_contents($this->tmpDir.'/Controller/PostController.php');
+ $strings = array(
+ 'namespace Foo\BarBundle\Controller;',
+ 'public function indexAction',
+ 'public function showAction',
+ 'public function newAction',
+ 'public function editAction',
+ );
+ foreach ($strings as $string) {
+ $this->assertContains($string, $content);
+ }
+ }
+
+ public function testGenerateXml()
+ {
+ $this->getGenerator()->generate($this->getBundle(), 'Post', $this->getMetadata(), 'xml', '/post', false);
+
+ $files = array(
+ 'Controller/PostController.php',
+ 'Tests/Controller/PostControllerTest.php',
+ 'Resources/config/routing/post.xml',
+ 'Resources/views/Post/index.html.twig',
+ 'Resources/views/Post/show.html.twig',
+ );
+ foreach ($files as $file) {
+ $this->assertTrue(file_exists($this->tmpDir.'/'.$file), sprintf('%s has been generated', $file));
+ }
+
+ $files = array(
+ 'Resources/config/routing/post.yml',
+ 'Resources/views/Post/new.html.twig',
+ 'Resources/views/Post/edit.html.twig',
+ );
+ foreach ($files as $file) {
+ $this->assertFalse(file_exists($this->tmpDir.'/'.$file), sprintf('%s has not been generated', $file));
+ }
+
+ $content = file_get_contents($this->tmpDir.'/Controller/PostController.php');
+ $strings = array(
+ 'namespace Foo\BarBundle\Controller;',
+ 'public function indexAction',
+ 'public function showAction',
+ );
+ foreach ($strings as $string) {
+ $this->assertContains($string, $content);
+ }
+
+ $content = file_get_contents($this->tmpDir.'/Controller/PostController.php');
+ $strings = array(
+ 'public function newAction',
+ 'public function editAction',
+ '@Route',
+ );
+ foreach ($strings as $string) {
+ $this->assertNotContains($string, $content);
+ }
+ }
+
+ public function testGenerateAnnotationWrite()
+ {
+ $this->getGenerator()->generate($this->getBundle(), 'Post', $this->getMetadata(), 'annotation', '/post', true);
+
+ $files = array(
+ 'Controller/PostController.php',
+ 'Tests/Controller/PostControllerTest.php',
+ 'Resources/views/Post/index.html.twig',
+ 'Resources/views/Post/show.html.twig',
+ 'Resources/views/Post/new.html.twig',
+ 'Resources/views/Post/edit.html.twig',
+ );
+ foreach ($files as $file) {
+ $this->assertTrue(file_exists($this->tmpDir.'/'.$file), sprintf('%s has been generated', $file));
+ }
+
+ $files = array(
+ 'Resources/config/routing/post.yml',
+ 'Resources/config/routing/post.xml',
+ );
+ foreach ($files as $file) {
+ $this->assertFalse(file_exists($this->tmpDir.'/'.$file), sprintf('%s has not been generated', $file));
+ }
+
+ $content = file_get_contents($this->tmpDir.'/Controller/PostController.php');
+ $strings = array(
+ 'namespace Foo\BarBundle\Controller;',
+ 'public function indexAction',
+ 'public function showAction',
+ 'public function newAction',
+ 'public function editAction',
+ '@Route',
+ );
+ foreach ($strings as $string) {
+ $this->assertContains($string, $content);
+ }
+ }
+
+ public function testGenerateAnnotation()
+ {
+ $this->getGenerator()->generate($this->getBundle(), 'Post', $this->getMetadata(), 'annotation', '/post', false);
+
+ $files = array(
+ 'Controller/PostController.php',
+ 'Tests/Controller/PostControllerTest.php',
+ 'Resources/views/Post/index.html.twig',
+ 'Resources/views/Post/show.html.twig',
+ );
+ foreach ($files as $file) {
+ $this->assertTrue(file_exists($this->tmpDir.'/'.$file), sprintf('%s has been generated', $file));
+ }
+
+ $files = array(
+ 'Resources/config/routing/post.yml',
+ 'Resources/config/routing/post.xml',
+ 'Resources/views/Post/new.html.twig',
+ 'Resources/views/Post/edit.html.twig',
+ );
+ foreach ($files as $file) {
+ $this->assertFalse(file_exists($this->tmpDir.'/'.$file), sprintf('%s has not been generated', $file));
+ }
+
+ $content = file_get_contents($this->tmpDir.'/Controller/PostController.php');
+ $strings = array(
+ 'namespace Foo\BarBundle\Controller;',
+ 'public function indexAction',
+ 'public function showAction',
+ '@Route',
+ );
+ foreach ($strings as $string) {
+ $this->assertContains($string, $content);
+ }
+
+ $content = file_get_contents($this->tmpDir.'/Controller/PostController.php');
+ $strings = array(
+ 'public function newAction',
+ 'public function editAction',
+ );
+ foreach ($strings as $string) {
+ $this->assertNotContains($string, $content);
+ }
+ }
+
+ protected function getGenerator()
+ {
+ return new DoctrineCrudGenerator($this->filesystem, __DIR__.'/../../Resources/skeleton/crud');
+ }
+
+ protected function getBundle()
+ {
+ $bundle = $this->getMock('Symfony\Component\HttpKernel\Bundle\BundleInterface');
+ $bundle->expects($this->any())->method('getPath')->will($this->returnValue($this->tmpDir));
+ $bundle->expects($this->any())->method('getName')->will($this->returnValue('FooBarBundle'));
+ $bundle->expects($this->any())->method('getNamespace')->will($this->returnValue('Foo\BarBundle'));
+
+ return $bundle;
+ }
+
+ public function getMetadata()
+ {
+ $metadata = $this->getMockBuilder('Doctrine\ORM\Mapping\ClassMetadataInfo')->disableOriginalConstructor()->getMock();
+ $metadata->identifier = array('id');
+ $metadata->fieldMappings = array('title' => array('type' => 'string'));
+
+ return $metadata;
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Sensio/Bundle/GeneratorBundle/Tests/Generator/DoctrineFormGeneratorTest.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Sensio/Bundle/GeneratorBundle/Tests/Generator/DoctrineFormGeneratorTest.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,40 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Sensio\Bundle\GeneratorBundle\Tests\Generator;
+
+use Sensio\Bundle\GeneratorBundle\Generator\DoctrineFormGenerator;
+use Symfony\Component\HttpKernel\Util\Filesystem;
+
+class DoctrineFormGeneratorTest extends GeneratorTest
+{
+ public function testGenerate()
+ {
+ $generator = new DoctrineFormGenerator($this->filesystem, __DIR__.'/../../Resources/skeleton/form');
+
+ $bundle = $this->getMock('Symfony\Component\HttpKernel\Bundle\BundleInterface');
+ $bundle->expects($this->any())->method('getPath')->will($this->returnValue($this->tmpDir));
+ $bundle->expects($this->any())->method('getNamespace')->will($this->returnValue('Foo\BarBundle'));
+
+ $metadata = $this->getMockBuilder('Doctrine\ORM\Mapping\ClassMetadataInfo')->disableOriginalConstructor()->getMock();
+ $metadata->identifier = array('id');
+ $metadata->associationMappings = array('title' => array('type' => 'string'));
+
+ $generator->generate($bundle, 'Post', $metadata);
+
+ $this->assertTrue(file_exists($this->tmpDir.'/Form/PostType.php'));
+
+ $content = file_get_contents($this->tmpDir.'/Form/PostType.php');
+ $this->assertContains('->add(\'title\')', $content);
+ $this->assertContains('class PostType extends AbstractType', $content);
+ $this->assertContains("'foo_barbundle_posttype'", $content);
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Sensio/Bundle/GeneratorBundle/Tests/Generator/GeneratorTest.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Sensio/Bundle/GeneratorBundle/Tests/Generator/GeneratorTest.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,32 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Sensio\Bundle\GeneratorBundle\Tests\Generator;
+
+use Symfony\Component\HttpKernel\Util\Filesystem;
+
+abstract class GeneratorTest extends \PHPUnit_Framework_TestCase
+{
+ protected $filesystem;
+ protected $tmpDir;
+
+ public function setUp()
+ {
+ $this->tmpDir = sys_get_temp_dir().'/sf2';
+ $this->filesystem = new Filesystem();
+ $this->filesystem->remove($this->tmpDir);
+ }
+
+ public function tearDown()
+ {
+ $this->filesystem->remove($this->tmpDir);
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/AsseticBundle.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/AsseticBundle.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,45 @@
+
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+
+namespace Symfony\Bundle\AsseticBundle;
+
+use Symfony\Bundle\AsseticBundle\DependencyInjection\Compiler\AssetFactoryPass;
+use Symfony\Bundle\AsseticBundle\DependencyInjection\Compiler\AssetManagerPass;
+use Symfony\Bundle\AsseticBundle\DependencyInjection\Compiler\CheckYuiFilterPass;
+use Symfony\Bundle\AsseticBundle\DependencyInjection\Compiler\FilterManagerPass;
+use Symfony\Bundle\AsseticBundle\DependencyInjection\Compiler\CheckCssEmbedFilterPass;
+use Symfony\Bundle\AsseticBundle\DependencyInjection\Compiler\CheckClosureFilterPass;
+use Symfony\Bundle\AsseticBundle\DependencyInjection\Compiler\TemplatingPass;
+use Symfony\Bundle\AsseticBundle\DependencyInjection\Compiler\SprocketsFilterPass;
+use Symfony\Component\DependencyInjection\ContainerBuilder;
+use Symfony\Component\HttpKernel\Bundle\Bundle;
+
+/**
+ * Assetic integration.
+ *
+ * @author Kris Wallsmith
+ */
+class AsseticBundle extends Bundle
+{
+ public function build(ContainerBuilder $container)
+ {
+ parent::build($container);
+
+ $container->addCompilerPass(new CheckClosureFilterPass());
+ $container->addCompilerPass(new CheckCssEmbedFilterPass());
+ $container->addCompilerPass(new CheckYuiFilterPass());
+ $container->addCompilerPass(new SprocketsFilterPass());
+ $container->addCompilerPass(new TemplatingPass());
+ $container->addCompilerPass(new AssetFactoryPass());
+ $container->addCompilerPass(new AssetManagerPass());
+ $container->addCompilerPass(new FilterManagerPass());
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/CacheWarmer/AssetManagerCacheWarmer.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/CacheWarmer/AssetManagerCacheWarmer.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,41 @@
+
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+
+namespace Symfony\Bundle\AsseticBundle\CacheWarmer;
+
+use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface;
+use Symfony\Component\DependencyInjection\ContainerInterface;
+
+/**
+ * The AssetManagerCacheWarmer warms up the formula loader.
+ *
+ * @author Kris Wallsmith
+ */
+class AssetManagerCacheWarmer implements CacheWarmerInterface
+{
+ private $container;
+
+ public function __construct(ContainerInterface $container)
+ {
+ $this->container = $container;
+ }
+
+ public function warmUp($cacheDir)
+ {
+ $am = $this->container->get('assetic.asset_manager');
+ $am->load();
+ }
+
+ public function isOptional()
+ {
+ return true;
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/CacheWarmer/AssetWriterCacheWarmer.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/CacheWarmer/AssetWriterCacheWarmer.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,44 @@
+
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+
+namespace Symfony\Bundle\AsseticBundle\CacheWarmer;
+
+use Assetic\AssetWriter;
+use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface;
+use Symfony\Component\DependencyInjection\ContainerInterface;
+
+/**
+ * The AssetWriterCacheWarmer processes and writes the asset files.
+ *
+ * @author Kris Wallsmith
+ */
+class AssetWriterCacheWarmer implements CacheWarmerInterface
+{
+ private $container;
+ private $writer;
+
+ public function __construct(ContainerInterface $container, AssetWriter $writer)
+ {
+ $this->container = $container;
+ $this->writer = $writer;
+ }
+
+ public function warmUp($cacheDir)
+ {
+ $am = $this->container->get('assetic.asset_manager');
+ $this->writer->writeManagerAssets($am);
+ }
+
+ public function isOptional()
+ {
+ return true;
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Command/DumpCommand.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Command/DumpCommand.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,210 @@
+
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+
+namespace Symfony\Bundle\AsseticBundle\Command;
+
+use Assetic\Asset\AssetInterface;
+use Assetic\Factory\LazyAssetManager;
+use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
+use Symfony\Component\Console\Input\InputArgument;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Input\InputOption;
+use Symfony\Component\Console\Output\OutputInterface;
+
+/**
+ * Dumps assets to the filesystem.
+ *
+ * @author Kris Wallsmith
+ */
+class DumpCommand extends ContainerAwareCommand
+{
+ private $basePath;
+ private $verbose;
+ private $am;
+
+ protected function configure()
+ {
+ $this
+ ->setName('assetic:dump')
+ ->setDescription('Dumps all assets to the filesystem')
+ ->addArgument('write_to', InputArgument::OPTIONAL, 'Override the configured asset root')
+ ->addOption('watch', null, InputOption::VALUE_NONE, 'Check for changes every second, debug mode only')
+ ->addOption('force', null, InputOption::VALUE_NONE, 'Force an initial generation of all assets (used with --watch)')
+ ->addOption('period', null, InputOption::VALUE_REQUIRED, 'Set the polling period in seconds (used with --watch)', 1)
+ ;
+ }
+
+ protected function initialize(InputInterface $input, OutputInterface $output)
+ {
+ parent::initialize($input, $output);
+
+ $this->basePath = $input->getArgument('write_to') ?: $this->getContainer()->getParameter('assetic.write_to');
+ $this->verbose = $input->getOption('verbose');
+ $this->am = $this->getContainer()->get('assetic.asset_manager');
+ }
+
+ protected function execute(InputInterface $input, OutputInterface $output)
+ {
+ $output->writeln(sprintf('Dumping all %s assets.', $input->getOption('env')));
+ $output->writeln(sprintf('Debug mode is %s.', $input->getOption('no-debug') ? 'off' : 'on'));
+ $output->writeln('');
+
+ if (!$input->getOption('watch')) {
+ foreach ($this->am->getNames() as $name) {
+ $this->dumpAsset($name, $output);
+ }
+
+ return;
+ }
+
+ if (!$this->am->isDebug()) {
+ throw new \RuntimeException('The --watch option is only available in debug mode.');
+ }
+
+ $this->watch($input, $output);
+ }
+
+ /**
+ * Watches a asset manager for changes.
+ *
+ * This method includes an infinite loop the continuously polls the asset
+ * manager for changes.
+ *
+ * @param InputInterface $input The command input
+ * @param OutputInterface $output The command output
+ */
+ private function watch(InputInterface $input, OutputInterface $output)
+ {
+ $refl = new \ReflectionClass('Assetic\\AssetManager');
+ $prop = $refl->getProperty('assets');
+ $prop->setAccessible(true);
+
+ $cache = sys_get_temp_dir().'/assetic_watch_'.substr(sha1($this->basePath), 0, 7);
+ if ($input->getOption('force') || !file_exists($cache)) {
+ $previously = array();
+ } else {
+ $previously = unserialize(file_get_contents($cache));
+ }
+
+ $error = '';
+ while (true) {
+ try {
+ foreach ($this->am->getNames() as $name) {
+ if ($this->checkAsset($name, $previously)) {
+ $this->dumpAsset($name, $output);
+ }
+ }
+
+ // reset the asset manager
+ $prop->setValue($this->am, array());
+ $this->am->load();
+
+ file_put_contents($cache, serialize($previously));
+ $error = '';
+
+ sleep($input->getOption('period'));
+ } catch (\Exception $e) {
+ if ($error != $msg = $e->getMessage()) {
+ $output->writeln('[error] '.$msg);
+ $error = $msg;
+ }
+ }
+ }
+ }
+
+ /**
+ * Checks if an asset should be dumped.
+ *
+ * @param string $name The asset name
+ * @param array &$previously An array of previous visits
+ *
+ * @return Boolean Whether the asset should be dumped
+ */
+ private function checkAsset($name, array &$previously)
+ {
+ $formula = $this->am->hasFormula($name) ? serialize($this->am->getFormula($name)) : null;
+ $asset = $this->am->get($name);
+ $mtime = $asset->getLastModified();
+
+ if (isset($previously[$name])) {
+ $changed = $previously[$name]['mtime'] != $mtime || $previously[$name]['formula'] != $formula;
+ } else {
+ $changed = true;
+ }
+
+ $previously[$name] = array('mtime' => $mtime, 'formula' => $formula);
+
+ return $changed;
+ }
+
+ /**
+ * Writes an asset.
+ *
+ * If the application or asset is in debug mode, each leaf asset will be
+ * dumped as well.
+ *
+ * @param string $name An asset name
+ * @param OutputInterface $output The command output
+ */
+ private function dumpAsset($name, OutputInterface $output)
+ {
+ $asset = $this->am->get($name);
+ $formula = $this->am->getFormula($name);
+
+ // start by dumping the main asset
+ $this->doDump($asset, $output);
+
+ // dump each leaf if debug
+ if (isset($formula[2]['debug']) ? $formula[2]['debug'] : $this->am->isDebug()) {
+ foreach ($asset as $leaf) {
+ $this->doDump($leaf, $output);
+ }
+ }
+ }
+
+ /**
+ * Performs the asset dump.
+ *
+ * @param AssetInterface $asset An asset
+ * @param OutputInterface $output The command output
+ *
+ * @throws RuntimeException If there is a problem writing the asset
+ */
+ private function doDump(AssetInterface $asset, OutputInterface $output)
+ {
+ $target = rtrim($this->basePath, '/').'/'.str_replace('_controller/', '', $asset->getTargetPath());
+ if (!is_dir($dir = dirname($target))) {
+ $output->writeln('[dir+] '.$dir);
+ if (false === @mkdir($dir, 0777, true)) {
+ throw new \RuntimeException('Unable to create directory '.$dir);
+ }
+ }
+
+ $output->writeln('[file+] '.$target);
+ if ($this->verbose) {
+ if ($asset instanceof \Traversable) {
+ foreach ($asset as $leaf) {
+ $root = $leaf->getSourceRoot();
+ $path = $leaf->getSourcePath();
+ $output->writeln(sprintf(' %s/%s', $root ?: '[unknown root]', $path ?: '[unknown path]'));
+ }
+ } else {
+ $root = $asset->getSourceRoot();
+ $path = $asset->getSourcePath();
+ $output->writeln(sprintf(' %s/%s', $root ?: '[unknown root]', $path ?: '[unknown path]'));
+ }
+ }
+
+ if (false === @file_put_contents($target, $asset->dump())) {
+ throw new \RuntimeException('Unable to write file '.$target);
+ }
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Config/AsseticResource.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Config/AsseticResource.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,50 @@
+
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+
+namespace Symfony\Bundle\AsseticBundle\Config;
+
+use Assetic\Factory\Resource\ResourceInterface as AsseticResourceInterface;
+use Symfony\Component\Config\Resource\ResourceInterface as SymfonyResourceInterface;
+
+/**
+ * Turns an Assetic resource into a Symfony one.
+ *
+ * @author Kris Wallsmith
+ */
+class AsseticResource implements SymfonyResourceInterface
+{
+ private $resource;
+
+ public function __construct(AsseticResourceInterface $resource)
+ {
+ $this->resource = $resource;
+ }
+
+ public function __toString()
+ {
+ return (string) $this->resource;
+ }
+
+ public function isFresh($timestamp)
+ {
+ return $this->resource->isFresh($timestamp);
+ }
+
+ /**
+ * Returns the Assetic resource.
+ *
+ * @return AsseticResourceInterface The wrapped Assetic resource
+ */
+ public function getResource()
+ {
+ return $this->resource;
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Controller/AsseticController.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Controller/AsseticController.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,95 @@
+
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+
+namespace Symfony\Bundle\AsseticBundle\Controller;
+
+use Assetic\Asset\AssetCache;
+use Assetic\Asset\AssetInterface;
+use Assetic\Factory\LazyAssetManager;
+use Assetic\Cache\CacheInterface;
+use Symfony\Component\HttpFoundation\Request;
+use Symfony\Component\HttpFoundation\Response;
+use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
+
+/**
+ * Serves assets.
+ *
+ * @author Kris Wallsmith
+ */
+class AsseticController
+{
+ protected $request;
+ protected $am;
+ protected $cache;
+
+ public function __construct(Request $request, LazyAssetManager $am, CacheInterface $cache)
+ {
+ $this->request = $request;
+ $this->am = $am;
+ $this->cache = $cache;
+ }
+
+ public function render($name, $pos = null)
+ {
+ if (!$this->am->has($name)) {
+ throw new NotFoundHttpException(sprintf('The "%s" asset could not be found.', $name));
+ }
+
+ $asset = $this->am->get($name);
+ if (null !== $pos && !$asset = $this->findAssetLeaf($asset, $pos)) {
+ throw new NotFoundHttpException(sprintf('The "%s" asset does not include a leaf at position %d.', $name, $pos));
+ }
+
+ $response = $this->createResponse();
+
+ // last-modified
+ if (null !== $lastModified = $asset->getLastModified()) {
+ $date = new \DateTime();
+ $date->setTimestamp($lastModified);
+ $response->setLastModified($date);
+ }
+
+ // etag
+ if ($this->am->hasFormula($name)) {
+ $formula = $this->am->getFormula($name);
+ $formula['last_modified'] = $lastModified;
+ $response->setETag(md5(serialize($formula)));
+ }
+
+ if ($response->isNotModified($this->request)) {
+ return $response;
+ }
+
+ $response->setContent($this->cachifyAsset($asset)->dump());
+
+ return $response;
+ }
+
+ protected function createResponse()
+ {
+ return new Response();
+ }
+
+ protected function cachifyAsset(AssetInterface $asset)
+ {
+ return new AssetCache($asset, $this->cache);
+ }
+
+ private function findAssetLeaf(\Traversable $asset, $pos)
+ {
+ $i = 0;
+ foreach ($asset as $leaf) {
+ if ($pos == $i++) {
+ return $leaf;
+ }
+ }
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/DependencyInjection/AsseticExtension.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/DependencyInjection/AsseticExtension.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,155 @@
+
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+
+namespace Symfony\Bundle\AsseticBundle\DependencyInjection;
+
+use Symfony\Component\Config\FileLocator;
+use Symfony\Component\Config\Definition\Processor;
+use Symfony\Component\DependencyInjection\ContainerBuilder;
+use Symfony\Component\DependencyInjection\DefinitionDecorator;
+use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
+use Symfony\Component\DependencyInjection\Reference;
+use Symfony\Component\HttpKernel\DependencyInjection\Extension;
+
+/**
+ * Semantic asset configuration.
+ *
+ * @author Kris Wallsmith
+ */
+class AsseticExtension extends Extension
+{
+ /**
+ * Loads the configuration.
+ *
+ * @param array $configs An array of configuration settings
+ * @param ContainerBuilder $container A ContainerBuilder instance
+ */
+ public function load(array $configs, ContainerBuilder $container)
+ {
+ $bundles = $container->getParameter('kernel.bundles');
+
+ $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
+ $loader->load('assetic.xml');
+ $loader->load('templating_twig.xml');
+ $loader->load('templating_php.xml');
+
+ $processor = new Processor();
+ $configuration = new MainConfiguration(array_keys($bundles));
+ $config = $processor->processConfiguration($configuration, $configs);
+
+ $container->setParameter('assetic.debug', $config['debug']);
+ $container->setParameter('assetic.use_controller', $config['use_controller']);
+ $container->setParameter('assetic.read_from', $config['read_from']);
+ $container->setParameter('assetic.write_to', $config['write_to']);
+
+ $container->setParameter('assetic.java.bin', $config['java']);
+ $container->setParameter('assetic.node.bin', $config['node']);
+ $container->setParameter('assetic.sass.bin', $config['sass']);
+
+ // register formulae
+ $formulae = array();
+ foreach ($config['assets'] as $name => $formula) {
+ $formulae[$name] = array($formula['inputs'], $formula['filters'], $formula['options']);
+ }
+
+ if ($formulae) {
+ $container->getDefinition('assetic.config_resource')->replaceArgument(0, $formulae);
+ } else {
+ $container->removeDefinition('assetic.config_loader');
+ $container->removeDefinition('assetic.config_resource');
+ }
+
+ // register filters
+ foreach ($config['filters'] as $name => $filter) {
+ if (isset($filter['resource'])) {
+ $loader->load($container->getParameterBag()->resolveValue($filter['resource']));
+ unset($filter['resource']);
+ } else {
+ $loader->load('filters/'.$name.'.xml');
+ }
+
+ if (isset($filter['file'])) {
+ $container->getDefinition('assetic.filter.'.$name)->setFile($filter['file']);
+ unset($filter['file']);
+ }
+
+ if (isset($filter['apply_to'])) {
+ if (!is_array($filter['apply_to'])) {
+ $filter['apply_to'] = array($filter['apply_to']);
+ }
+
+ foreach ($filter['apply_to'] as $i => $pattern) {
+ $worker = new DefinitionDecorator('assetic.worker.ensure_filter');
+ $worker->replaceArgument(0, '/'.$pattern.'/');
+ $worker->replaceArgument(1, new Reference('assetic.filter.'.$name));
+ $worker->addTag('assetic.factory_worker');
+
+ $container->setDefinition('assetic.filter.'.$name.'.worker'.$i, $worker);
+ }
+
+ unset($filter['apply_to']);
+ }
+
+ foreach ($filter as $key => $value) {
+ $container->setParameter('assetic.filter.'.$name.'.'.$key, $value);
+ }
+ }
+
+ // twig functions
+ $container->setParameter('assetic.twig_extension.functions', $config['twig']['functions']);
+
+ // choose dynamic or static
+ if ($container->getParameterBag()->resolveValue($container->getParameterBag()->get('assetic.use_controller'))) {
+ $loader->load('controller.xml');
+ $container->getDefinition('assetic.helper.dynamic')->addTag('templating.helper', array('alias' => 'assetic'));
+ $container->removeDefinition('assetic.helper.static');
+ } else {
+ $loader->load('asset_writer.xml');
+ $container->getDefinition('assetic.helper.static')->addTag('templating.helper', array('alias' => 'assetic'));
+ $container->removeDefinition('assetic.helper.dynamic');
+ }
+
+ // bundle and kernel resources
+ foreach ($container->getParameterBag()->resolveValue($config['bundles']) as $bundle) {
+ $rc = new \ReflectionClass($bundles[$bundle]);
+ foreach (array('twig', 'php') as $engine) {
+ $container->setDefinition(
+ 'assetic.'.$engine.'_directory_resource.'.$bundle,
+ new DirectoryResourceDefinition($bundle, $engine, array(
+ $container->getParameter('kernel.root_dir').'/Resources/'.$bundle.'/views',
+ dirname($rc->getFileName()).'/Resources/views',
+ ))
+ );
+ }
+ }
+ foreach (array('twig', 'php') as $engine) {
+ $container->setDefinition(
+ 'assetic.'.$engine.'_directory_resource.kernel',
+ new DirectoryResourceDefinition('', $engine, array($container->getParameter('kernel.root_dir').'/Resources/views'))
+ );
+ }
+ }
+
+ /**
+ * Returns the base path for the XSD files.
+ *
+ * @return string The XSD base path
+ */
+ public function getXsdValidationBasePath()
+ {
+ return __DIR__ . '/../Resources/config/schema';
+ }
+
+ public function getNamespace()
+ {
+ return 'http://symfony.com/schema/dic/assetic';
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/DependencyInjection/Compiler/AssetFactoryPass.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/DependencyInjection/Compiler/AssetFactoryPass.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,36 @@
+
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+
+namespace Symfony\Bundle\AsseticBundle\DependencyInjection\Compiler;
+
+use Symfony\Component\DependencyInjection\Reference;
+use Symfony\Component\DependencyInjection\ContainerBuilder;
+use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
+
+/**
+ * Adds services tagged as workers to the asset factory.
+ *
+ * @author Kris Wallsmith
+ */
+class AssetFactoryPass implements CompilerPassInterface
+{
+ public function process(ContainerBuilder $container)
+ {
+ if (!$container->hasDefinition('assetic.asset_factory')) {
+ return;
+ }
+
+ $factory = $container->getDefinition('assetic.asset_factory');
+ foreach ($container->findTaggedServiceIds('assetic.factory_worker') as $id => $attr) {
+ $factory->addMethodCall('addWorker', array(new Reference($id)));
+ }
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/DependencyInjection/Compiler/AssetManagerPass.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/DependencyInjection/Compiler/AssetManagerPass.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,62 @@
+
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+
+namespace Symfony\Bundle\AsseticBundle\DependencyInjection\Compiler;
+
+use Symfony\Component\DependencyInjection\Reference;
+use Symfony\Component\DependencyInjection\ContainerBuilder;
+use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
+
+/**
+ * Adds services tagged as assets to the asset manager.
+ *
+ * @author Kris Wallsmith
+ */
+class AssetManagerPass implements CompilerPassInterface
+{
+ public function process(ContainerBuilder $container)
+ {
+ if (!$container->hasDefinition('assetic.asset_manager')) {
+ return;
+ }
+
+ $am = $container->getDefinition('assetic.asset_manager');
+
+ // add assets
+ foreach ($container->findTaggedServiceIds('assetic.asset') as $id => $attributes) {
+ foreach ($attributes as $attr) {
+ if (isset($attr['alias'])) {
+ $am->addMethodCall('set', array($attr['alias'], new Reference($id)));
+ }
+ }
+ }
+
+ // add loaders
+ $loaders = array();
+ foreach ($container->findTaggedServiceIds('assetic.formula_loader') as $id => $attributes) {
+ foreach ($attributes as $attr) {
+ if (isset($attr['alias'])) {
+ $loaders[$attr['alias']] = new Reference($id);
+ }
+ }
+ }
+ $am->replaceArgument(1, $loaders);
+
+ // add resources
+ foreach ($container->findTaggedServiceIds('assetic.formula_resource') as $id => $attributes) {
+ foreach ($attributes as $attr) {
+ if (isset($attr['loader'])) {
+ $am->addMethodCall('addResource', array(new Reference($id), $attr['loader']));
+ }
+ }
+ }
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/DependencyInjection/Compiler/CheckClosureFilterPass.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/DependencyInjection/Compiler/CheckClosureFilterPass.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,36 @@
+
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+
+namespace Symfony\Bundle\AsseticBundle\DependencyInjection\Compiler;
+
+use Symfony\Component\DependencyInjection\ContainerBuilder;
+use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
+
+/**
+ * Tags either the closure JAR or API filter for the filter manager.
+ *
+ * @author Kris Wallsmith
+ */
+class CheckClosureFilterPass implements CompilerPassInterface
+{
+ public function process(ContainerBuilder $container)
+ {
+ if ($container->hasDefinition('assetic.filter.closure.jar')
+ && $container->hasParameter('assetic.filter.closure.jar')
+ && $container->getParameterBag()->resolveValue($container->getParameter('assetic.filter.closure.jar'))) {
+ $container->removeDefinition('assetic.filter.closure.api');
+ $container->setAlias('assetic.filter.closure', 'assetic.filter.closure.jar');
+ } elseif ($container->hasDefinition('assetic.filter.closure.api')) {
+ $container->removeDefinition('assetic.filter.closure.jar');
+ $container->setAlias('assetic.filter.closure', 'assetic.filter.closure.api');
+ }
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/DependencyInjection/Compiler/CheckCssEmbedFilterPass.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/DependencyInjection/Compiler/CheckCssEmbedFilterPass.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,31 @@
+
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+
+namespace Symfony\Bundle\AsseticBundle\DependencyInjection\Compiler;
+
+use Symfony\Component\DependencyInjection\ContainerBuilder;
+use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
+
+/**
+ * Checks that the location of the CssEmbed JAR has been configured.
+ *
+ * @author Kris Wallsmith
+ */
+class CheckCssEmbedFilterPass implements CompilerPassInterface
+{
+ public function process(ContainerBuilder $container)
+ {
+ if ($container->hasDefinition('assetic.filter.cssembed') &&
+ !$container->getParameterBag()->resolveValue($container->getParameter('assetic.filter.cssembed.jar'))) {
+ throw new \RuntimeException('The "assetic.filters.cssembed" configuration requires a "jar" value.');
+ }
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/DependencyInjection/Compiler/CheckYuiFilterPass.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/DependencyInjection/Compiler/CheckYuiFilterPass.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,36 @@
+
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+
+namespace Symfony\Bundle\AsseticBundle\DependencyInjection\Compiler;
+
+use Symfony\Component\DependencyInjection\ContainerBuilder;
+use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
+
+/**
+ * Checks that the location of the YUI JAR has been configured.
+ *
+ * @author Kris Wallsmith
+ */
+class CheckYuiFilterPass implements CompilerPassInterface
+{
+ public function process(ContainerBuilder $container)
+ {
+ if ($container->hasDefinition('assetic.filter.yui_css') &&
+ !$container->getParameterBag()->resolveValue($container->getParameter('assetic.filter.yui_css.jar'))) {
+ throw new \RuntimeException('The "assetic.filters.yui_css" configuration requires a "jar" value.');
+ }
+
+ if ($container->hasDefinition('assetic.filter.yui_js') &&
+ !$container->getParameterBag()->resolveValue($container->getParameter('assetic.filter.yui_js.jar'))) {
+ throw new \RuntimeException('The "assetic.filters.yui_js" configuration requires a "jar" value.');
+ }
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/DependencyInjection/Compiler/FilterManagerPass.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/DependencyInjection/Compiler/FilterManagerPass.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,44 @@
+
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+
+namespace Symfony\Bundle\AsseticBundle\DependencyInjection\Compiler;
+
+use Symfony\Component\DependencyInjection\Reference;
+use Symfony\Component\DependencyInjection\ContainerBuilder;
+use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
+
+/**
+ * Adds services tagged as filters to the filter manager.
+ *
+ * @author Kris Wallsmith
+ */
+class FilterManagerPass implements CompilerPassInterface
+{
+ public function process(ContainerBuilder $container)
+ {
+ if (!$container->hasDefinition('assetic.filter_manager')) {
+ return;
+ }
+
+ $mapping = array();
+ foreach ($container->findTaggedServiceIds('assetic.filter') as $id => $attributes) {
+ foreach ($attributes as $attr) {
+ if (isset($attr['alias'])) {
+ $mapping[$attr['alias']] = $id;
+ }
+ }
+ }
+
+ $container
+ ->getDefinition('assetic.filter_manager')
+ ->replaceArgument(1, $mapping);
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/DependencyInjection/Compiler/SprocketsFilterPass.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/DependencyInjection/Compiler/SprocketsFilterPass.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,35 @@
+
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+
+namespace Symfony\Bundle\AsseticBundle\DependencyInjection\Compiler;
+
+use Symfony\Component\DependencyInjection\ContainerBuilder;
+use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
+
+/**
+ * Finishes configuration of the Sprockets filter.
+ *
+ * @author Kris Wallsmith
+ */
+class SprocketsFilterPass implements CompilerPassInterface
+{
+ public function process(ContainerBuilder $container)
+ {
+ if (!$container->hasDefinition('assetic.filter.sprockets')) {
+ return;
+ }
+
+ $filter = $container->getDefinition('assetic.filter.sprockets');
+ foreach ($container->getParameter('assetic.filter.sprockets.include_dirs') as $dir) {
+ $filter->addMethodCall('addIncludeDir', array($dir));
+ }
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/DependencyInjection/Compiler/TemplatingPass.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/DependencyInjection/Compiler/TemplatingPass.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,44 @@
+
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+
+namespace Symfony\Bundle\AsseticBundle\DependencyInjection\Compiler;
+
+use Symfony\Component\DependencyInjection\ContainerBuilder;
+use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
+
+/**
+ * This pass removes services associated with unused templating engines.
+ *
+ * @author Kris Wallsmith
+ */
+class TemplatingPass implements CompilerPassInterface
+{
+ public function process(ContainerBuilder $container)
+ {
+ if (!$container->hasDefinition('assetic.asset_manager')) {
+ return;
+ }
+
+ $engines = $container->getParameterBag()->resolveValue($container->getParameter('templating.engines'));
+
+ if (!in_array('twig', $engines)) {
+ foreach ($container->findTaggedServiceIds('assetic.templating.twig') as $id => $attr) {
+ $container->removeDefinition($id);
+ }
+ }
+
+ if (!in_array('php', $engines)) {
+ foreach ($container->findTaggedServiceIds('assetic.templating.php') as $id => $attr) {
+ $container->removeDefinition($id);
+ }
+ }
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/DependencyInjection/DirectoryResourceDefinition.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/DependencyInjection/DirectoryResourceDefinition.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,75 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Bundle\AsseticBundle\DependencyInjection;
+
+use Symfony\Component\DependencyInjection\Definition;
+use Symfony\Component\DependencyInjection\Reference;
+
+/**
+ * Encapsulates logic for creating a directory resource.
+ *
+ * @author Kris Wallsmith
+ */
+class DirectoryResourceDefinition extends Definition
+{
+ /**
+ * Constructor.
+ *
+ * @param string $bundle A bundle name or empty string
+ * @param string $engine The templating engine
+ * @param array $dirs An array of directories to merge
+ */
+ public function __construct($bundle, $engine, array $dirs)
+ {
+ if (!count($dirs)) {
+ throw new \InvalidArgumentException('You must provide at least one directory.');
+ }
+
+ parent::__construct();
+
+ $this
+ ->addTag('assetic.templating.'.$engine)
+ ->addTag('assetic.formula_resource', array('loader' => $engine));
+ ;
+
+ if (1 == count($dirs)) {
+ // no need to coalesce
+ self::configureDefinition($this, $bundle, $engine, reset($dirs));
+ return;
+ }
+
+ // gather the wrapped resource definitions
+ $resources = array();
+ foreach ($dirs as $dir) {
+ $resources[] = $resource = new Definition();
+ self::configureDefinition($resource, $bundle, $engine, $dir);
+ }
+
+ $this
+ ->setClass('%assetic.coalescing_directory_resource.class%')
+ ->addArgument($resources)
+ ->setPublic(false)
+ ;
+ }
+
+ static private function configureDefinition(Definition $definition, $bundle, $engine, $dir)
+ {
+ $definition
+ ->setClass('%assetic.directory_resource.class%')
+ ->addArgument(new Reference('templating.loader'))
+ ->addArgument($bundle)
+ ->addArgument($dir)
+ ->addArgument('/^[^.]+\.[^.]+\.'.$engine.'$/')
+ ->setPublic(false)
+ ;
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/DependencyInjection/MainConfiguration.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/DependencyInjection/MainConfiguration.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,174 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Bundle\AsseticBundle\DependencyInjection;
+
+use Symfony\Component\Process\ExecutableFinder;
+use Symfony\Component\Config\Definition\Builder\TreeBuilder;
+use Symfony\Component\Config\Definition\ConfigurationInterface;
+
+/**
+ * This class contains the configuration information for the bundle
+ *
+ * This information is solely responsible for how the different configuration
+ * sections are normalized, and merged.
+ *
+ * @author Christophe Coevoet
+ * @author Kris Wallsmith
+ */
+class MainConfiguration implements ConfigurationInterface
+{
+ private $bundles;
+
+ /**
+ * Constructor
+ *
+ * @param array $bundles An array of bundle names
+ */
+ public function __construct(array $bundles)
+ {
+ $this->bundles = $bundles;
+ }
+
+ /**
+ * Generates the configuration tree builder.
+ *
+ * @return \Symfony\Component\Config\Definition\Builder\TreeBuilder The tree builder
+ */
+ public function getConfigTreeBuilder()
+ {
+ $builder = new TreeBuilder();
+ $finder = new ExecutableFinder();
+
+ $builder->root('assetic')
+ ->children()
+ ->booleanNode('debug')->defaultValue('%kernel.debug%')->end()
+ ->booleanNode('use_controller')->defaultValue('%kernel.debug%')->end()
+ ->scalarNode('read_from')->defaultValue('%kernel.root_dir%/../web')->end()
+ ->scalarNode('write_to')->defaultValue('%assetic.read_from%')->end()
+ ->scalarNode('java')->defaultValue(function() use($finder) { return $finder->find('java', '/usr/bin/java'); })->end()
+ ->scalarNode('node')->defaultValue(function() use($finder) { return $finder->find('node', '/usr/bin/node'); })->end()
+ ->scalarNode('sass')->defaultValue(function() use($finder) { return $finder->find('sass', '/usr/bin/sass'); })->end()
+ ->end()
+
+ // bundles
+ ->fixXmlConfig('bundle')
+ ->children()
+ ->arrayNode('bundles')
+ ->defaultValue($this->bundles)
+ ->prototype('scalar')
+ ->validate()
+ ->ifNotInArray($this->bundles)
+ ->thenInvalid('%s is not a valid bundle.')
+ ->end()
+ ->end()
+ ->end()
+ ->end()
+
+ // assets
+ ->fixXmlConfig('asset')
+ ->children()
+ ->arrayNode('assets')
+ ->addDefaultsIfNotSet()
+ ->requiresAtLeastOneElement()
+ ->useAttributeAsKey('name')
+ ->prototype('array')
+ ->beforeNormalization()
+ // a scalar is a simple formula of one input file
+ ->ifTrue(function($v) { return !is_array($v); })
+ ->then(function($v) { return array('inputs' => array($v)); })
+ ->end()
+ ->beforeNormalization()
+ ->always()
+ ->then(function($v)
+ {
+ // cast scalars as array
+ foreach (array('input', 'inputs', 'filter', 'filters') as $key) {
+ if (isset($v[$key]) && !is_array($v[$key])) {
+ $v[$key] = array($v[$key]);
+ }
+ }
+
+ // organize arbitrary options
+ foreach ($v as $key => $value) {
+ if (!in_array($key, array('input', 'inputs', 'filter', 'filters', 'option', 'options'))) {
+ $v['options'][$key] = $value;
+ unset($v[$key]);
+ }
+ }
+
+ return $v;
+ })
+ ->end()
+
+ // the formula
+ ->fixXmlConfig('input')
+ ->fixXmlConfig('filter')
+ ->children()
+ ->arrayNode('inputs')
+ ->prototype('scalar')->end()
+ ->end()
+ ->arrayNode('filters')
+ ->prototype('scalar')->end()
+ ->end()
+ ->arrayNode('options')
+ ->useAttributeAsKey('name')
+ ->prototype('variable')->end()
+ ->end()
+ ->end()
+ ->end()
+ ->end()
+ ->end()
+
+ // filters
+ ->fixXmlConfig('filter')
+ ->children()
+ ->arrayNode('filters')
+ ->addDefaultsIfNotSet()
+ ->requiresAtLeastOneElement()
+ ->useAttributeAsKey('name')
+ ->prototype('variable')
+ ->treatNullLike(array())
+ ->validate()
+ ->ifTrue(function($v) { return !is_array($v); })
+ ->thenInvalid('The assetic.filters config %s must be either null or an array.')
+ ->end()
+ ->end()
+ ->end()
+ ->end()
+
+ // twig
+ ->children()
+ ->arrayNode('twig')
+ ->addDefaultsIfNotSet()
+ ->defaultValue(array())
+ ->fixXmlConfig('function')
+ ->children()
+ ->arrayNode('functions')
+ ->addDefaultsIfNotSet()
+ ->defaultValue(array())
+ ->useAttributeAsKey('name')
+ ->prototype('variable')
+ ->treatNullLike(array())
+ ->validate()
+ ->ifTrue(function($v) { return !is_array($v); })
+ ->thenInvalid('The assetic.twig.functions config %s must be either null or an array.')
+ ->end()
+ ->end()
+ ->end()
+ ->end()
+ ->end()
+ ->end()
+ ;
+
+ return $builder;
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/EventListener/RequestListener.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/EventListener/RequestListener.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,31 @@
+
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+
+namespace Symfony\Bundle\AsseticBundle\EventListener;
+
+use Symfony\Component\HttpKernel\Event\GetResponseEvent;
+
+/**
+ * Adds a few formats to each request.
+ *
+ * @author Kris Wallsmith
+ */
+class RequestListener
+{
+ public function onKernelRequest(GetResponseEvent $event)
+ {
+ $request = $event->getRequest();
+
+ $request->setFormat('png', 'image/png');
+ $request->setFormat('jpg', 'image/jpeg');
+ $request->setFormat('gif', 'image/gif');
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Factory/AssetFactory.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Factory/AssetFactory.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,97 @@
+
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+
+namespace Symfony\Bundle\AsseticBundle\Factory;
+
+use Assetic\Factory\AssetFactory as BaseAssetFactory;
+use Symfony\Component\DependencyInjection\ContainerInterface;
+use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
+use Symfony\Component\HttpKernel\KernelInterface;
+
+/**
+ * Loads asset formulae from the filesystem.
+ *
+ * @author Kris Wallsmith
+ */
+class AssetFactory extends BaseAssetFactory
+{
+ private $kernel;
+ private $container;
+ private $parameterBag;
+
+ /**
+ * Constructor.
+ *
+ * @param KernelInterface $kernel The kernel is used to parse bundle notation
+ * @param ContainerInterface $container The container is used to load the managers lazily, thus avoiding a circular dependency
+ * @param ParameterBagInterface $parameterBag The container parameter bag
+ * @param string $baseDir The base directory for relative inputs
+ * @param Boolean $debug The current debug mode
+ */
+ public function __construct(KernelInterface $kernel, ContainerInterface $container, ParameterBagInterface $parameterBag, $baseDir, $debug = false)
+ {
+ $this->kernel = $kernel;
+ $this->container = $container;
+ $this->parameterBag = $parameterBag;
+
+ parent::__construct($baseDir, $debug);
+ }
+
+ /**
+ * Adds support for bundle notation file and glob assets and parameter placeholders.
+ *
+ * FIXME: This is a naive implementation of globs in that it doesn't
+ * attempt to support bundle inheritance within the glob pattern itself.
+ */
+ protected function parseInput($input, array $options = array())
+ {
+ $input = $this->parameterBag->resolveValue($input);
+
+ // expand bundle notation
+ if ('@' == $input[0] && false !== strpos($input, '/')) {
+ // use the bundle path as this asset's root
+ $bundle = substr($input, 1);
+ if (false !== $pos = strpos($bundle, '/')) {
+ $bundle = substr($bundle, 0, $pos);
+ }
+ $options['root'] = array($this->kernel->getBundle($bundle)->getPath());
+
+ // canonicalize the input
+ if (false !== $pos = strpos($input, '*')) {
+ // locateResource() does not support globs so we provide a naive implementation here
+ list($before, $after) = explode('*', $input, 2);
+ $input = $this->kernel->locateResource($before).'*'.$after;
+ } else {
+ $input = $this->kernel->locateResource($input);
+ }
+ }
+
+ return parent::parseInput($input, $options);
+ }
+
+ protected function createAssetReference($name)
+ {
+ if (!$this->getAssetManager()) {
+ $this->setAssetManager($this->container->get('assetic.asset_manager'));
+ }
+
+ return parent::createAssetReference($name);
+ }
+
+ protected function getFilter($name)
+ {
+ if (!$this->getFilterManager()) {
+ $this->setFilterManager($this->container->get('assetic.filter_manager'));
+ }
+
+ return parent::getFilter($name);
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Factory/Loader/AsseticHelperFormulaLoader.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Factory/Loader/AsseticHelperFormulaLoader.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,87 @@
+
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+
+namespace Symfony\Bundle\AsseticBundle\Factory\Loader;
+
+use Assetic\Factory\Loader\BasePhpFormulaLoader;
+
+/**
+ * Loads formulae from Symfony2 PHP templates.
+ *
+ * @author Kris Wallsmith
+ */
+class AsseticHelperFormulaLoader extends BasePhpFormulaLoader
+{
+ protected function registerPrototypes()
+ {
+ return array(
+ '$view[\'assetic\']->javascripts(*)' => array('output' => 'js/*.js'),
+ '$view[\'assetic\']->stylesheets(*)' => array('output' => 'css/*.css'),
+ '$view[\'assetic\']->image(*)' => array('output' => 'images/*', 'single' => true),
+ '$view["assetic"]->javascripts(*)' => array('output' => 'js/*.js'),
+ '$view["assetic"]->stylesheets(*)' => array('output' => 'css/*.css'),
+ '$view["assetic"]->image(*)' => array('output' => 'images/*', 'single' => true),
+ '$view->get(\'assetic\')->javascripts(*)' => array('output' => 'js/*.js'),
+ '$view->get(\'assetic\')->stylesheets(*)' => array('output' => 'css/*.css'),
+ '$view->get(\'assetic\')->image(*)' => array('output' => 'images/*', 'single' => true),
+ '$view->get("assetic")->javascripts(*)' => array('output' => 'js/*.js'),
+ '$view->get("assetic")->stylesheets(*)' => array('output' => 'css/*.css'),
+ '$view->get("assetic")->image(*)' => array('output' => 'images/*', 'single' => true),
+ );
+ }
+
+ protected function registerSetupCode()
+ {
+ return <<<'EOF'
+class Helper
+{
+ public function assets()
+ {
+ global $_call;
+ $_call = func_get_args();
+ }
+
+ public function javascripts()
+ {
+ global $_call;
+ $_call = func_get_args();
+ }
+
+ public function stylesheets()
+ {
+ global $_call;
+ $_call = func_get_args();
+ }
+
+ public function image()
+ {
+ global $_call;
+ $_call = func_get_args();
+ }
+}
+
+class View extends ArrayObject
+{
+ public function __construct(Helper $helper)
+ {
+ parent::__construct(array('assetic' => $helper));
+ }
+
+ public function get()
+ {
+ return $this['assetic'];
+ }
+}
+
+$view = new View(new Helper());
+EOF;
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Factory/Loader/ConfigurationLoader.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Factory/Loader/ConfigurationLoader.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,29 @@
+
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+
+namespace Symfony\Bundle\AsseticBundle\Factory\Loader;
+
+use Assetic\Factory\Loader\FormulaLoaderInterface;
+use Assetic\Factory\Resource\ResourceInterface;
+use Symfony\Bundle\AsseticBundle\Factory\Resource\ConfigurationResource;
+
+/**
+ * Loads configured formulae.
+ *
+ * @author Kris Wallsmith
+ */
+class ConfigurationLoader implements FormulaLoaderInterface
+{
+ public function load(ResourceInterface $resource)
+ {
+ return $resource instanceof ConfigurationResource ? $resource->getContent() : array();
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Factory/Resource/CoalescingDirectoryResource.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Factory/Resource/CoalescingDirectoryResource.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,30 @@
+
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+
+namespace Symfony\Bundle\AsseticBundle\Factory\Resource;
+
+use Assetic\Factory\Resource\CoalescingDirectoryResource as BaseCoalescingDirectoryResource;
+use Assetic\Factory\Resource\ResourceInterface;
+
+/**
+ * Coalesces multiple directories together into one merged resource.
+ *
+ * @author Kris Wallsmith
+ */
+class CoalescingDirectoryResource extends BaseCoalescingDirectoryResource
+{
+ protected function getRelativeName(ResourceInterface $file, ResourceInterface $directory)
+ {
+ $name = (string) $file;
+
+ return substr($name, strpos($name, ':'));
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Factory/Resource/ConfigurationResource.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Factory/Resource/ConfigurationResource.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,44 @@
+
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+
+namespace Symfony\Bundle\AsseticBundle\Factory\Resource;
+
+use Assetic\Factory\Resource\ResourceInterface;
+
+/**
+ * A configured resource.
+ *
+ * @author Kris Wallsmith
+ */
+class ConfigurationResource implements ResourceInterface
+{
+ private $formulae;
+
+ public function __construct(array $formulae)
+ {
+ $this->formulae = $formulae;
+ }
+
+ public function isFresh($timestamp)
+ {
+ return true;
+ }
+
+ public function getContent()
+ {
+ return $this->formulae;
+ }
+
+ public function __toString()
+ {
+ return 'symfony';
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Factory/Resource/DirectoryResource.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Factory/Resource/DirectoryResource.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,51 @@
+
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+
+namespace Symfony\Bundle\AsseticBundle\Factory\Resource;
+
+use Assetic\Factory\Resource\DirectoryResource as BaseDirectoryResource;
+use Symfony\Component\Templating\Loader\LoaderInterface;
+
+/**
+ * A directory resource that creates Symfony2 templating resources.
+ *
+ * @author Kris Wallsmith
+ */
+class DirectoryResource extends BaseDirectoryResource
+{
+ protected $loader;
+ protected $bundle;
+ protected $path;
+
+ /**
+ * Constructor.
+ *
+ * @param LoaderInterface $loader The templating loader
+ * @param string $bundle The current bundle name
+ * @param string $path The directory path
+ * @param string $pattern A regex pattern for file basenames
+ */
+ public function __construct(LoaderInterface $loader, $bundle, $path, $pattern = null)
+ {
+ $this->loader = $loader;
+ $this->bundle = $bundle;
+ $this->path = rtrim($path, '/').'/';
+
+ parent::__construct($path, $pattern);
+ }
+
+ public function getIterator()
+ {
+ return is_dir($this->path)
+ ? new DirectoryResourceIterator($this->loader, $this->bundle, $this->path, $this->getInnerIterator())
+ : new \EmptyIterator();
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Factory/Resource/DirectoryResourceIterator.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Factory/Resource/DirectoryResourceIterator.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,45 @@
+
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+
+namespace Symfony\Bundle\AsseticBundle\Factory\Resource;
+
+use Symfony\Component\Templating\Loader\LoaderInterface;
+
+class DirectoryResourceIterator extends \RecursiveIteratorIterator
+{
+ protected $loader;
+ protected $bundle;
+ protected $path;
+
+ /**
+ * Constructor.
+ *
+ * @param LoaderInterface $loader The templating loader
+ * @param string $bundle The current bundle name
+ * @param string $path The directory
+ * @param RecursiveIterator $iterator The inner iterator
+ */
+ public function __construct(LoaderInterface $loader, $bundle, $path, \RecursiveIterator $iterator)
+ {
+ $this->loader = $loader;
+ $this->bundle = $bundle;
+ $this->path = $path;
+
+ parent::__construct($iterator);
+ }
+
+ public function current()
+ {
+ $file = parent::current();
+
+ return new FileResource($this->loader, $this->bundle, $this->path, $file->getPathname());
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Factory/Resource/FileResource.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Factory/Resource/FileResource.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,78 @@
+
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+
+namespace Symfony\Bundle\AsseticBundle\Factory\Resource;
+
+use Assetic\Factory\Resource\ResourceInterface;
+use Symfony\Bundle\FrameworkBundle\Templating\TemplateReference;
+use Symfony\Component\Templating\Loader\LoaderInterface;
+
+/**
+ * A file resource.
+ *
+ * @author Kris Wallsmith
+ */
+class FileResource implements ResourceInterface
+{
+ protected $loader;
+ protected $bundle;
+ protected $baseDir;
+ protected $path;
+ protected $template;
+
+ /**
+ * Constructor.
+ *
+ * @param LoaderInterface $loader The templating loader
+ * @param string $bundle The current bundle name
+ * @param string $baseDir The directory
+ * @param string $path The file path
+ */
+ public function __construct(LoaderInterface $loader, $bundle, $baseDir, $path)
+ {
+ $this->loader = $loader;
+ $this->bundle = $bundle;
+ $this->baseDir = $baseDir;
+ $this->path = $path;
+ }
+
+ public function isFresh($timestamp)
+ {
+ return $this->loader->isFresh($this->getTemplate(), $timestamp);
+ }
+
+ public function getContent()
+ {
+ return $this->loader->load($this->getTemplate())->getContent();
+ }
+
+ public function __toString()
+ {
+ return (string) $this->getTemplate();
+ }
+
+ protected function getTemplate()
+ {
+ if (null === $this->template) {
+ $this->template = self::createTemplateReference($this->bundle, substr($this->path, strlen($this->baseDir)));
+ }
+
+ return $this->template;
+ }
+
+ static private function createTemplateReference($bundle, $file)
+ {
+ $parts = explode('/', strtr($file, '\\', '/'));
+ $elements = explode('.', array_pop($parts));
+
+ return new TemplateReference($bundle, implode('/', $parts), $elements[0], $elements[1], $elements[2]);
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Factory/Worker/UseControllerWorker.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Factory/Worker/UseControllerWorker.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,33 @@
+
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+
+namespace Symfony\Bundle\AsseticBundle\Factory\Worker;
+
+use Assetic\Asset\AssetInterface;
+use Assetic\Factory\Worker\WorkerInterface;
+
+/**
+ * Prepends a fake front controller so the asset knows where it is-ish.
+ *
+ * @author Kris Wallsmith
+ */
+class UseControllerWorker implements WorkerInterface
+{
+ public function process(AssetInterface $asset)
+ {
+ $targetUrl = $asset->getTargetPath();
+ if ($targetUrl && '/' != $targetUrl[0] && 0 !== strpos($targetUrl, '_controller/')) {
+ $asset->setTargetPath('_controller/'.$targetUrl);
+ }
+
+ return $asset;
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/FilterManager.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/FilterManager.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,55 @@
+
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+
+namespace Symfony\Bundle\AsseticBundle;
+
+use Assetic\FilterManager as BaseFilterManager;
+use Symfony\Component\DependencyInjection\ContainerInterface;
+
+/**
+ * Lazy filter manager.
+ *
+ * @author Kris Wallsmith
+ */
+class FilterManager extends BaseFilterManager
+{
+ protected $container;
+ protected $mappings;
+
+ /**
+ * Constructor.
+ *
+ * @param ContainerInterface $container The service container
+ * @param array $mappings A hash of filter names to service ids
+ */
+ public function __construct(ContainerInterface $container, array $mappings)
+ {
+ $this->container = $container;
+ $this->mappings = $mappings;
+ }
+
+ public function get($name)
+ {
+ return isset($this->mappings[$name])
+ ? $this->container->get($this->mappings[$name])
+ : parent::get($name);
+ }
+
+ public function has($name)
+ {
+ return isset($this->mappings[$name]) || parent::has($name);
+ }
+
+ public function getNames()
+ {
+ return array_unique(array_merge(array_keys($this->mappings), parent::getNames()));
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Resources/config/asset_writer.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Resources/config/asset_writer.xml Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,22 @@
+
+
+
+
+
+ Symfony\Bundle\AsseticBundle\CacheWarmer\AssetWriterCacheWarmer
+ Assetic\AssetWriter
+
+
+
+
+
+
+
+
+
+ %assetic.write_to%
+
+
+
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Resources/config/assetic.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Resources/config/assetic.xml Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,71 @@
+
+
+
+
+
+ Symfony\Bundle\AsseticBundle\Factory\AssetFactory
+ Assetic\Factory\LazyAssetManager
+ Symfony\Bundle\AsseticBundle\CacheWarmer\AssetManagerCacheWarmer
+ Assetic\Factory\Loader\CachedFormulaLoader
+ Assetic\Cache\ConfigCache
+ Symfony\Bundle\AsseticBundle\Factory\Loader\ConfigurationLoader
+ Symfony\Bundle\AsseticBundle\Factory\Resource\ConfigurationResource
+ Symfony\Bundle\AsseticBundle\Factory\Resource\CoalescingDirectoryResource
+ Symfony\Bundle\AsseticBundle\Factory\Resource\DirectoryResource
+ Symfony\Bundle\AsseticBundle\FilterManager
+ Assetic\Factory\Worker\EnsureFilterWorker
+
+
+ %kernel.cache_dir%/assetic
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ %assetic.read_from%
+ %assetic.debug%
+
+
+
+
+
+
+
+
+
+
+
+ %assetic.cache_dir%/config
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Resources/config/controller.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Resources/config/controller.xml Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,35 @@
+
+
+
+
+
+ Symfony\Bundle\AsseticBundle\Controller\AsseticController
+ Symfony\Bundle\AsseticBundle\Routing\AsseticLoader
+ Assetic\Cache\FilesystemCache
+ Symfony\Bundle\AsseticBundle\Factory\Worker\UseControllerWorker
+ Symfony\Bundle\AsseticBundle\EventListener\RequestListener
+
+
+
+
+
+
+
+
+
+
+
+
+
+ %assetic.cache_dir%/assets
+
+
+
+
+
+
+
+
+
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Resources/config/filters/closure.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Resources/config/filters/closure.xml Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,24 @@
+
+
+
+
+
+ Assetic\Filter\GoogleClosure\CompilerApiFilter
+ Assetic\Filter\GoogleClosure\CompilerJarFilter
+ %assetic.java.bin%
+
+
+
+
+
+ %assetic.filter.closure.jar%
+ %assetic.filter.closure.java%
+
+
+
+
+
+
+
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Resources/config/filters/coffee.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Resources/config/filters/coffee.xml Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,20 @@
+
+
+
+
+
+ Assetic\Filter\CoffeeScriptFilter
+ /usr/bin/coffee
+ %assetic.node.bin%
+
+
+
+
+
+ %assetic.filter.coffee.bin%
+ %assetic.filter.coffee.node%
+
+
+
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Resources/config/filters/compass.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Resources/config/filters/compass.xml Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,34 @@
+
+
+
+
+
+ Assetic\Filter\CompassFilter
+ /usr/bin/compass
+ %assetic.debug%
+ null
+ null
+ null
+ null
+ null
+ null
+
+
+
+
+
+
+ %assetic.filter.compass.bin%
+ %assetic.filter.compass.debug%
+ %assetic.filter.compass.style%
+ %assetic.filter.compass.images_dir%
+ %assetic.filter.compass.javascripts_dir%
+ %assetic.filter.compass.http_path%
+ %assetic.filter.compass.http_images_path%
+ %assetic.filter.compass.http_javascripts_path%
+ %assetic.filter.compass.plugins%
+
+
+
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Resources/config/filters/cssembed.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Resources/config/filters/cssembed.xml Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,34 @@
+
+
+
+
+
+ Assetic\Filter\CssEmbedFilter
+ %assetic.java.bin%
+
+ %kernel.charset%
+ false
+ null
+ null
+ false
+ null
+ null
+
+
+
+
+
+ %assetic.filter.cssembed.jar%
+ %assetic.filter.cssembed.java%
+ %assetic.filter.cssembed.charset%
+ %assetic.filter.cssembed.mhtml%
+ %assetic.filter.cssembed.mhtml_root%
+ %assetic.filter.cssembed.root%
+ %assetic.filter.cssembed.skip_missing%
+ %assetic.filter.cssembed.max_uri_length%
+ %assetic.filter.cssembed.max_image_size%
+
+
+
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Resources/config/filters/cssimport.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Resources/config/filters/cssimport.xml Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,16 @@
+
+
+
+
+
+ Assetic\Filter\CssImportFilter
+
+
+
+
+
+
+
+
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Resources/config/filters/cssmin.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Resources/config/filters/cssmin.xml Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,20 @@
+
+
+
+
+
+ Assetic\Filter\CssMinFilter
+
+
+
+
+
+
+
+ %assetic.filter.cssmin.filters%
+ %assetic.filter.cssmin.plugins%
+
+
+
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Resources/config/filters/cssrewrite.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Resources/config/filters/cssrewrite.xml Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,16 @@
+
+
+
+
+
+ Assetic\Filter\CssRewriteFilter
+
+
+
+
+
+
+
+
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Resources/config/filters/jpegoptim.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Resources/config/filters/jpegoptim.xml Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,22 @@
+
+
+
+
+
+ Assetic\Filter\JpegoptimFilter
+ /usr/bin/jpegoptim
+ false
+ null
+
+
+
+
+
+ %assetic.filter.jpegoptim.bin%
+ %assetic.filter.jpegoptim.strip_all%
+ %assetic.filter.jpegoptim.max%
+
+
+
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Resources/config/filters/jpegtran.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Resources/config/filters/jpegtran.xml Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,26 @@
+
+
+
+
+
+ Assetic\Filter\JpegtranFilter
+ /usr/bin/jpegtran
+ null
+ false
+ false
+ null
+
+
+
+
+
+ %assetic.filter.jpegtran.bin%
+ %assetic.filter.jpegtran.copy%
+ %assetic.filter.jpegtran.optimize%
+ %assetic.filter.jpegtran.progressive%
+ %assetic.filter.jpegtran.restart%
+
+
+
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Resources/config/filters/less.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Resources/config/filters/less.xml Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,22 @@
+
+
+
+
+
+ Assetic\Filter\LessFilter
+ %assetic.node.bin%
+ %assetic.node.paths%
+ null
+
+
+
+
+
+ %assetic.filter.less.node%
+ %assetic.filter.less.node_paths%
+ %assetic.filter.less.compress%
+
+
+
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Resources/config/filters/lessphp.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Resources/config/filters/lessphp.xml Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,16 @@
+
+
+
+
+
+ Assetic\Filter\LessphpFilter
+
+
+
+
+
+
+
+
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Resources/config/filters/optipng.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Resources/config/filters/optipng.xml Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,20 @@
+
+
+
+
+
+ Assetic\Filter\OptiPngFilter
+ /usr/bin/optipng
+ null
+
+
+
+
+
+ %assetic.filter.optipng.bin%
+ %assetic.filter.optipng.level%
+
+
+
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Resources/config/filters/packager.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Resources/config/filters/packager.xml Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,18 @@
+
+
+
+
+
+ Assetic\Filter\PackagerFilter
+
+
+
+
+
+
+ %assetic.filter.packager.packages%
+
+
+
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Resources/config/filters/pngout.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Resources/config/filters/pngout.xml Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,26 @@
+
+
+
+
+
+ Assetic\Filter\PngoutFilter
+ /usr/bin/pngout
+ null
+ null
+ null
+ null
+
+
+
+
+
+ %assetic.filter.pngout.bin%
+ %assetic.filter.pngout.color%
+ %assetic.filter.pngout.filter%
+ %assetic.filter.pngout.strategy%
+ %assetic.filter.pngout.block_split_threshold%
+
+
+
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Resources/config/filters/sass.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Resources/config/filters/sass.xml Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,22 @@
+
+
+
+
+
+ Assetic\Filter\Sass\SassFilter
+ %assetic.sass.bin%
+ null
+ null
+
+
+
+
+
+ %assetic.filter.sass.bin%
+ %assetic.filter.sass.style%
+ %assetic.filter.sass.compass%
+
+
+
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Resources/config/filters/scss.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Resources/config/filters/scss.xml Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,22 @@
+
+
+
+
+
+ Assetic\Filter\Sass\ScssFilter
+ %assetic.sass.bin%
+ null
+ null
+
+
+
+
+
+ %assetic.filter.scss.sass%
+ %assetic.filter.scss.style%
+ %assetic.filter.scss.compass%
+
+
+
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Resources/config/filters/sprockets.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Resources/config/filters/sprockets.xml Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,21 @@
+
+
+
+
+
+ Assetic\Filter\SprocketsFilter
+ /usr/bin/sprocketize
+ %assetic.write_to%
+
+
+
+
+
+
+ %assetic.filter.sprockets.bin%
+ %assetic.filter.sprockets.asset_root%
+
+
+
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Resources/config/filters/stylus.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Resources/config/filters/stylus.xml Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,22 @@
+
+
+
+
+
+ Assetic\Filter\StylusFilter
+ %assetic.node.bin%
+ %assetic.node.paths%
+ null
+
+
+
+
+
+ %assetic.filter.stylus.node%
+ %assetic.filter.stylus.node_paths%
+ %assetic.filter.stylus.compress%
+
+
+
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Resources/config/filters/yui_css.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Resources/config/filters/yui_css.xml Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,22 @@
+
+
+
+
+
+ Assetic\Filter\Yui\CssCompressorFilter
+ %assetic.java.bin%
+
+ %kernel.charset%
+
+
+
+
+
+ %assetic.filter.yui_css.jar%
+ %assetic.filter.yui_css.java%
+ %assetic.filter.yui_css.charset%
+
+
+
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Resources/config/filters/yui_js.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Resources/config/filters/yui_js.xml Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,28 @@
+
+
+
+
+
+ Assetic\Filter\Yui\JsCompressorFilter
+ %assetic.java.bin%
+
+ %kernel.charset%
+ null
+ null
+ null
+
+
+
+
+
+ %assetic.filter.yui_js.jar%
+ %assetic.filter.yui_js.java%
+ %assetic.filter.yui_js.charset%
+ %assetic.filter.yui_js.nomunge%
+ %assetic.filter.yui_js.preserve_semi%
+ %assetic.filter.yui_js.disable_optimizations%
+
+
+
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Resources/config/schema/assetic-1.0.xsd
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Resources/config/schema/assetic-1.0.xsd Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,59 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Resources/config/templating_php.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Resources/config/templating_php.xml Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,39 @@
+
+
+
+
+
+ Symfony\Bundle\AsseticBundle\Templating\DynamicAsseticHelper
+ Symfony\Bundle\AsseticBundle\Templating\StaticAsseticHelper
+ Symfony\Bundle\AsseticBundle\Factory\Loader\AsseticHelperFormulaLoader
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ %kernel.debug%
+
+
+
+
+
+
+
+
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Resources/config/templating_twig.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Resources/config/templating_twig.xml Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,32 @@
+
+
+
+
+
+ Symfony\Bundle\AsseticBundle\Twig\AsseticExtension
+ Assetic\Extension\Twig\TwigFormulaLoader
+
+
+
+
+
+
+
+ %assetic.use_controller%
+ %assetic.twig_extension.functions%
+
+
+
+
+
+
+ %kernel.debug%
+
+
+
+
+
+
+
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Routing/AsseticLoader.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Routing/AsseticLoader.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,122 @@
+
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+
+namespace Symfony\Bundle\AsseticBundle\Routing;
+
+use Assetic\Asset\AssetInterface;
+use Assetic\Factory\LazyAssetManager;
+use Symfony\Bundle\AsseticBundle\Config\AsseticResource;
+use Symfony\Component\Config\Loader\Loader;
+use Symfony\Component\Config\Resource\FileResource;
+use Symfony\Component\Routing\Route;
+use Symfony\Component\Routing\RouteCollection;
+
+/**
+ * Loads routes for all assets.
+ *
+ * Assets should only be served through the routing system for ease-of-use
+ * during development.
+ *
+ * For example, add the following to your application's routing_dev.yml:
+ *
+ * _assetic:
+ * resource: .
+ * type: assetic
+ *
+ * In a production environment you should use the `assetic:dump` command to
+ * create static asset files.
+ *
+ * @author Kris Wallsmith
+ */
+class AsseticLoader extends Loader
+{
+ protected $am;
+
+ public function __construct(LazyAssetManager $am)
+ {
+ $this->am = $am;
+ }
+
+ public function load($routingResource, $type = null)
+ {
+ $routes = new RouteCollection();
+
+ // resources
+ foreach ($this->am->getResources() as $resources) {
+ if (!$resources instanceof \Traversable) {
+ $resources = array($resources);
+ }
+ foreach ($resources as $resource) {
+ $routes->addResource(new AsseticResource($resource));
+ }
+ }
+
+ // routes
+ foreach ($this->am->getNames() as $name) {
+ $asset = $this->am->get($name);
+ $formula = $this->am->getFormula($name);
+
+ $this->loadRouteForAsset($routes, $asset, $name);
+
+ $debug = isset($formula[2]['debug']) ? $formula[2]['debug'] : $this->am->isDebug();
+ $combine = isset($formula[2]['combine']) ? $formula[2]['combine'] : !$debug;
+
+ // add a route for each "leaf" in debug mode
+ if (!$combine) {
+ $i = 0;
+ foreach ($asset as $leaf) {
+ $this->loadRouteForAsset($routes, $leaf, $name, $i++);
+ }
+ }
+ }
+
+ return $routes;
+ }
+
+ /**
+ * Loads a route to serve an supplied asset.
+ *
+ * The fake front controller that {@link UseControllerWorker} adds to the
+ * target URL will be removed before set as a route pattern.
+ *
+ * @param RouteCollection $routes The route collection
+ * @param AssetInterface $asset The asset
+ * @param string $name The name to use
+ * @param integer $pos The leaf index
+ */
+ private function loadRouteForAsset(RouteCollection $routes, AssetInterface $asset, $name, $pos = null)
+ {
+ $defaults = array(
+ '_controller' => 'assetic.controller:render',
+ 'name' => $name,
+ 'pos' => $pos,
+ );
+
+ // remove the fake front controller
+ $pattern = str_replace('_controller/', '', $asset->getTargetPath());
+
+ if ($format = pathinfo($pattern, PATHINFO_EXTENSION)) {
+ $defaults['_format'] = $format;
+ }
+
+ $route = '_assetic_'.$name;
+ if (null !== $pos) {
+ $route .= '_'.$pos;
+ }
+
+ $routes->add($route, new Route($pattern, $defaults));
+ }
+
+ public function supports($resource, $type = null)
+ {
+ return 'assetic' == $type;
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Templating/AsseticHelper.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Templating/AsseticHelper.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,157 @@
+
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+
+namespace Symfony\Bundle\AsseticBundle\Templating;
+
+use Assetic\Asset\AssetInterface;
+use Assetic\Factory\AssetFactory;
+use Assetic\Util\TraversableString;
+use Symfony\Component\Templating\Helper\Helper;
+
+/**
+ * The "assetic" templating helper.
+ *
+ * @author Kris Wallsmith
+ */
+abstract class AsseticHelper extends Helper
+{
+ protected $factory;
+
+ /**
+ * Constructor.
+ *
+ * @param AssetFactory $factory The asset factory
+ */
+ public function __construct(AssetFactory $factory)
+ {
+ $this->factory = $factory;
+ }
+
+ /**
+ * Returns an array of javascript urls.
+ */
+ public function javascripts($inputs = array(), $filters = array(), array $options = array())
+ {
+ if (!isset($options['output'])) {
+ $options['output'] = 'js/*.js';
+ }
+
+ return $this->getAssetUrls($inputs, $filters, $options);
+ }
+
+ /**
+ * Returns an array of stylesheet urls.
+ */
+ public function stylesheets($inputs = array(), $filters = array(), array $options = array())
+ {
+ if (!isset($options['output'])) {
+ $options['output'] = 'css/*.css';
+ }
+
+ return $this->getAssetUrls($inputs, $filters, $options);
+ }
+
+ /**
+ * Returns an array of one image url.
+ */
+ public function image($inputs = array(), $filters = array(), array $options = array())
+ {
+ if (!isset($options['output'])) {
+ $options['output'] = 'images/*';
+ }
+
+ $options['single'] = true;
+
+ return $this->getAssetUrls($inputs, $filters, $options);
+ }
+
+ /**
+ * Gets the URLs for the configured asset.
+ *
+ * Usage looks something like this:
+ *
+ * assets('@jquery, js/src/core/*', '?yui_js') as $url): ?>
+ *
+ *
+ *
+ * When in debug mode, the helper returns an array of one or more URLs.
+ * When not in debug mode it returns an array of one URL.
+ *
+ * @param array|string $inputs An array or comma-separated list of input strings
+ * @param array|string $filters An array or comma-separated list of filter names
+ * @param array $options An array of options
+ *
+ * @return array An array of URLs for the asset
+ */
+ private function getAssetUrls($inputs = array(), $filters = array(), array $options = array())
+ {
+ $explode = function($value)
+ {
+ return array_map('trim', explode(',', $value));
+ };
+
+ if (!is_array($inputs)) {
+ $inputs = $explode($inputs);
+ }
+
+ if (!is_array($filters)) {
+ $filters = $explode($filters);
+ }
+
+ if (!isset($options['debug'])) {
+ $options['debug'] = $this->factory->isDebug();
+ }
+
+ if (!isset($options['combine'])) {
+ $options['combine'] = !$options['debug'];
+ }
+
+ if (isset($options['single']) && $options['single'] && 1 < count($inputs)) {
+ $inputs = array_slice($inputs, -1);
+ }
+
+ if (!isset($options['name'])) {
+ $options['name'] = $this->factory->generateAssetName($inputs, $filters, $options);
+ }
+
+ $asset = $this->factory->createAsset($inputs, $filters, $options);
+
+ $one = $this->getAssetUrl($asset, $options);
+ $many = array();
+ if ($options['combine']) {
+ $many[] = $one;
+ } else {
+ $i = 0;
+ foreach ($asset as $leaf) {
+ $many[] = $this->getAssetUrl($leaf, array_replace($options, array(
+ 'name' => $options['name'].'_'.$i++,
+ )));
+ }
+ }
+
+ return new TraversableString($one, $many);
+ }
+
+ /**
+ * Returns an URL for the supplied asset.
+ *
+ * @param AssetInterface $asset An asset
+ * @param array $options An array of options
+ *
+ * @return string An echo-ready URL
+ */
+ abstract protected function getAssetUrl(AssetInterface $asset, $options = array());
+
+ public function getName()
+ {
+ return 'assetic';
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Templating/DynamicAsseticHelper.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Templating/DynamicAsseticHelper.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,44 @@
+
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+
+namespace Symfony\Bundle\AsseticBundle\Templating;
+
+use Assetic\Asset\AssetInterface;
+use Assetic\Factory\AssetFactory;
+use Symfony\Bundle\FrameworkBundle\Templating\Helper\RouterHelper;
+
+/**
+ * The dynamic "assetic" templating helper.
+ *
+ * @author Kris Wallsmith
+ */
+class DynamicAsseticHelper extends AsseticHelper
+{
+ private $routerHelper;
+
+ /**
+ * Constructor.
+ *
+ * @param RouterHelper $routerHelper The router helper
+ * @param AssetFactory $factory The asset factory
+ */
+ public function __construct(RouterHelper $routerHelper, AssetFactory $factory)
+ {
+ $this->routerHelper = $routerHelper;
+
+ parent::__construct($factory);
+ }
+
+ protected function getAssetUrl(AssetInterface $asset, $options = array())
+ {
+ return $this->routerHelper->generate('_assetic_'.$options['name']);
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Templating/StaticAsseticHelper.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Templating/StaticAsseticHelper.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,44 @@
+
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+
+namespace Symfony\Bundle\AsseticBundle\Templating;
+
+use Assetic\Asset\AssetInterface;
+use Assetic\Factory\AssetFactory;
+use Symfony\Component\Templating\Helper\CoreAssetsHelper;
+
+/**
+ * The static "assetic" templating helper.
+ *
+ * @author Kris Wallsmith
+ */
+class StaticAsseticHelper extends AsseticHelper
+{
+ private $assetsHelper;
+
+ /**
+ * Constructor.
+ *
+ * @param CoreAssetsHelper $assetsHelper The assets helper
+ * @param AssetFactory $factory The asset factory
+ */
+ public function __construct(CoreAssetsHelper $assetsHelper, AssetFactory $factory)
+ {
+ $this->assetsHelper = $assetsHelper;
+
+ parent::__construct($factory);
+ }
+
+ protected function getAssetUrl(AssetInterface $asset, $options = array())
+ {
+ return $this->assetsHelper->getUrl($asset->getTargetPath(), isset($options['package']) ? $options['package'] : null);
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Tests/CacheWarmer/AssetManagerCacheWarmerTest.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Tests/CacheWarmer/AssetManagerCacheWarmerTest.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,51 @@
+
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+
+namespace Symfony\Bundle\AsseticBundle\Tests\CacheWarmer;
+
+use Symfony\Bundle\AsseticBundle\CacheWarmer\AssetManagerCacheWarmer;
+
+class AssetManagerCacheWarmerTest extends \PHPUnit_Framework_TestCase
+{
+ protected function setUp()
+ {
+ if (!class_exists('Assetic\\AssetManager')) {
+ $this->markTestSkipped('Assetic is not available.');
+ }
+ }
+
+ public function testWarmUp()
+ {
+ $am = $this
+ ->getMockBuilder('Assetic\\Factory\\LazyAssetManager')
+ ->disableOriginalConstructor()
+ ->getMock()
+ ;
+
+ $am->expects($this->once())->method('load');
+
+ $container = $this
+ ->getMockBuilder('Symfony\\Component\\DependencyInjection\\Container')
+ ->setConstructorArgs(array())
+ ->getMock()
+ ;
+
+ $container
+ ->expects($this->once())
+ ->method('get')
+ ->with('assetic.asset_manager')
+ ->will($this->returnValue($am))
+ ;
+
+ $warmer = new AssetManagerCacheWarmer($container);
+ $warmer->warmUp('/path/to/cache');
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Tests/CacheWarmer/AssetWriterCacheWarmerTest.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Tests/CacheWarmer/AssetWriterCacheWarmerTest.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,57 @@
+
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+
+namespace Symfony\Bundle\AsseticBundle\Tests\CacheWarmer;
+
+use Symfony\Bundle\AsseticBundle\CacheWarmer\AssetWriterCacheWarmer;
+
+class AssetWriterCacheWarmerTest extends \PHPUnit_Framework_TestCase
+{
+ protected function setUp()
+ {
+ if (!class_exists('Assetic\\AssetManager')) {
+ $this->markTestSkipped('Assetic is not available.');
+ }
+ }
+
+ public function testWarmUp()
+ {
+ $am = $this->getMock('Assetic\\AssetManager');
+
+ $writer = $this
+ ->getMockBuilder('Assetic\\AssetWriter')
+ ->disableOriginalConstructor()
+ ->getMock()
+ ;
+
+ $writer
+ ->expects($this->once())
+ ->method('writeManagerAssets')
+ ->with($am)
+ ;
+
+ $container = $this
+ ->getMockBuilder('Symfony\\Component\\DependencyInjection\\Container')
+ ->setConstructorArgs(array())
+ ->getMock()
+ ;
+
+ $container
+ ->expects($this->once())
+ ->method('get')
+ ->with('assetic.asset_manager')
+ ->will($this->returnValue($am))
+ ;
+
+ $warmer = new AssetWriterCacheWarmer($container, $writer);
+ $warmer->warmUp('/path/to/cache');
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Tests/Command/DumpCommandTest.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Tests/Command/DumpCommandTest.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,174 @@
+
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+
+namespace Symfony\Bundle\AsseticBundle\Tests\Command;
+
+use Symfony\Bundle\AsseticBundle\Command\DumpCommand;
+use Symfony\Component\Console\Input\ArrayInput;
+use Symfony\Component\Console\Input\InputOption;
+use Symfony\Component\Console\Output\NullOutput;
+
+class DumpCommandTest extends \PHPUnit_Framework_TestCase
+{
+ private $writeTo;
+ private $application;
+ private $definition;
+ private $kernel;
+ private $container;
+ private $am;
+
+ protected function setUp()
+ {
+ if (!class_exists('Assetic\\AssetManager')) {
+ $this->markTestSkipped('Assetic is not available.');
+ }
+
+ $this->writeTo = sys_get_temp_dir().'/assetic_dump';
+
+ $this->application = $this->getMockBuilder('Symfony\\Bundle\\FrameworkBundle\\Console\\Application')
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->definition = $this->getMockBuilder('Symfony\\Component\\Console\\Input\\InputDefinition')
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->kernel = $this->getMock('Symfony\\Component\\HttpKernel\\KernelInterface');
+ $this->helperSet = $this->getMock('Symfony\\Component\\Console\\Helper\\HelperSet');
+ $this->container = $this->getMock('Symfony\\Component\\DependencyInjection\\ContainerInterface');
+ $this->am = $this->getMockBuilder('Assetic\\Factory\\LazyAssetManager')
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $this->application->expects($this->any())
+ ->method('getDefinition')
+ ->will($this->returnValue($this->definition));
+ $this->definition->expects($this->any())
+ ->method('getArguments')
+ ->will($this->returnValue(array()));
+ $this->definition->expects($this->any())
+ ->method('getOptions')
+ ->will($this->returnValue(array(
+ new InputOption('--verbose', '-v', InputOption::VALUE_NONE, 'Increase verbosity of messages.'),
+ new InputOption('--env', '-e', InputOption::VALUE_REQUIRED, 'The Environment name.', 'dev'),
+ new InputOption('--no-debug', null, InputOption::VALUE_NONE, 'Switches off debug mode.'),
+ )));
+ $this->application->expects($this->any())
+ ->method('getKernel')
+ ->will($this->returnValue($this->kernel));
+ $this->application->expects($this->once())
+ ->method('getHelperSet')
+ ->will($this->returnValue($this->helperSet));
+ $this->kernel->expects($this->any())
+ ->method('getContainer')
+ ->will($this->returnValue($this->container));
+ $this->container->expects($this->any())
+ ->method('getParameter')
+ ->with('assetic.write_to')
+ ->will($this->returnValue($this->writeTo));
+ $this->container->expects($this->once())
+ ->method('get')
+ ->with('assetic.asset_manager')
+ ->will($this->returnValue($this->am));
+
+ $this->command = new DumpCommand();
+ $this->command->setApplication($this->application);
+ }
+
+ protected function tearDown()
+ {
+ if (is_dir($this->writeTo)) {
+ array_map('unlink', glob($this->writeTo.'/*'));
+ rmdir($this->writeTo);
+ }
+ }
+
+ public function testEmptyAssetManager()
+ {
+ $this->am->expects($this->once())
+ ->method('getNames')
+ ->will($this->returnValue(array()));
+
+ $this->command->run(new ArrayInput(array()), new NullOutput());
+ }
+
+ public function testDumpOne()
+ {
+ $asset = $this->getMock('Assetic\\Asset\\AssetInterface');
+
+ $this->am->expects($this->once())
+ ->method('getNames')
+ ->will($this->returnValue(array('test_asset')));
+ $this->am->expects($this->once())
+ ->method('get')
+ ->with('test_asset')
+ ->will($this->returnValue($asset));
+ $this->am->expects($this->once())
+ ->method('getFormula')
+ ->with('test_asset')
+ ->will($this->returnValue(array()));
+ $this->am->expects($this->once())
+ ->method('isDebug')
+ ->will($this->returnValue(false));
+ $asset->expects($this->once())
+ ->method('getTargetPath')
+ ->will($this->returnValue('test_asset.css'));
+ $asset->expects($this->once())
+ ->method('dump')
+ ->will($this->returnValue('/* test_asset */'));
+
+ $this->command->run(new ArrayInput(array()), new NullOutput());
+
+ $this->assertFileExists($this->writeTo.'/test_asset.css');
+ $this->assertEquals('/* test_asset */', file_get_contents($this->writeTo.'/test_asset.css'));
+ }
+
+ public function testDumpDebug()
+ {
+ $asset = $this->getMock('Assetic\\Asset\\AssetCollection');
+ $leaf = $this->getMock('Assetic\\Asset\\AssetInterface');
+
+ $this->am->expects($this->once())
+ ->method('getNames')
+ ->will($this->returnValue(array('test_asset')));
+ $this->am->expects($this->once())
+ ->method('get')
+ ->with('test_asset')
+ ->will($this->returnValue($asset));
+ $this->am->expects($this->once())
+ ->method('getFormula')
+ ->with('test_asset')
+ ->will($this->returnValue(array()));
+ $this->am->expects($this->once())
+ ->method('isDebug')
+ ->will($this->returnValue(true));
+ $asset->expects($this->once())
+ ->method('getTargetPath')
+ ->will($this->returnValue('test_asset.css'));
+ $asset->expects($this->once())
+ ->method('dump')
+ ->will($this->returnValue('/* test_asset */'));
+ $asset->expects($this->once())
+ ->method('getIterator')
+ ->will($this->returnValue(new \ArrayIterator(array($leaf))));
+ $leaf->expects($this->once())
+ ->method('getTargetPath')
+ ->will($this->returnValue('test_leaf.css'));
+ $leaf->expects($this->once())
+ ->method('dump')
+ ->will($this->returnValue('/* test_leaf */'));
+
+ $this->command->run(new ArrayInput(array()), new NullOutput());
+
+ $this->assertFileExists($this->writeTo.'/test_asset.css');
+ $this->assertFileExists($this->writeTo.'/test_leaf.css');
+ $this->assertEquals('/* test_asset */', file_get_contents($this->writeTo.'/test_asset.css'));
+ $this->assertEquals('/* test_leaf */', file_get_contents($this->writeTo.'/test_leaf.css'));
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Tests/Controller/AsseticControllerTest.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Tests/Controller/AsseticControllerTest.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,167 @@
+
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+
+namespace Symfony\Bundle\AsseticBundle\Tests\Controller;
+
+use Symfony\Bundle\AsseticBundle\Controller\AsseticController;
+
+class AsseticControllerTest extends \PHPUnit_Framework_TestCase
+{
+ protected $request;
+ protected $headers;
+ protected $am;
+ protected $cache;
+
+ protected $controller;
+
+ protected function setUp()
+ {
+ if (!class_exists('Assetic\\AssetManager')) {
+ $this->markTestSkipped('Assetic is not available.');
+ }
+
+ $this->request = $this->getMock('Symfony\\Component\\HttpFoundation\\Request');
+ $this->headers = $this->getMock('Symfony\\Component\\HttpFoundation\\ParameterBag');
+ $this->request->headers = $this->headers;
+ $this->am = $this->getMockBuilder('Assetic\\Factory\\LazyAssetManager')
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->cache = $this->getMock('Assetic\\Cache\\CacheInterface');
+
+ $this->controller = new AsseticController($this->request, $this->am, $this->cache);
+ }
+
+ public function testRenderNotFound()
+ {
+ $this->setExpectedException('Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException');
+
+ $name = 'foo';
+
+ $this->am->expects($this->once())
+ ->method('has')
+ ->with($name)
+ ->will($this->returnValue(false));
+
+ $this->controller->render($name);
+ }
+
+ public function testRenderLastModifiedFresh()
+ {
+ $asset = $this->getMock('Assetic\\Asset\\AssetInterface');
+
+ $name = 'foo';
+ $lastModified = strtotime('2010-10-10 10:10:10');
+ $ifModifiedSince = gmdate('D, d M Y H:i:s', $lastModified).' GMT';
+
+ $asset->expects($this->any())->method('getFilters')->will($this->returnValue(array()));
+ $this->am->expects($this->once())->method('has')->with($name)->will($this->returnValue(true));
+ $this->am->expects($this->once())->method('get')->with($name)->will($this->returnValue($asset));
+ $asset->expects($this->once())->method('getLastModified')->will($this->returnValue($lastModified));
+ $this->headers->expects($this->once())->method('get')->with('If-Modified-Since')->will($this->returnValue($ifModifiedSince));
+
+ $asset->expects($this->never())
+ ->method('dump');
+
+ $response = $this->controller->render($name);
+ $this->assertEquals(304, $response->getStatusCode(), '->render() sends a Not Modified response when If-Modified-Since is fresh');
+ }
+
+ public function testRenderLastModifiedStale()
+ {
+ $asset = $this->getMock('Assetic\\Asset\\AssetInterface');
+
+ $name = 'foo';
+ $content = '==ASSET_CONTENT==';
+ $lastModified = strtotime('2010-10-10 10:10:10');
+ $ifModifiedSince = gmdate('D, d M Y H:i:s', $lastModified - 300).' GMT';
+
+ $asset->expects($this->any())->method('getFilters')->will($this->returnValue(array()));
+ $this->am->expects($this->once())->method('has')->with($name)->will($this->returnValue(true));
+ $this->am->expects($this->once())->method('get')->with($name)->will($this->returnValue($asset));
+ $asset->expects($this->exactly(2))->method('getLastModified')->will($this->returnValue($lastModified));
+ $this->headers->expects($this->once())->method('get')->with('If-Modified-Since')->will($this->returnValue($ifModifiedSince));
+
+ $this->cache->expects($this->once())
+ ->method('has')
+ ->with($this->isType('string'))
+ ->will($this->returnValue(false));
+ $asset->expects($this->once())
+ ->method('dump')
+ ->will($this->returnValue($content));
+
+ $response = $this->controller->render($name);
+ $this->assertEquals(200, $response->getStatusCode(), '->render() sends an OK response when If-Modified-Since is stale');
+ $this->assertEquals($content, $response->getContent(), '->render() sends the dumped asset as the response content');
+ }
+
+ public function testRenderETagFresh()
+ {
+ $asset = $this->getMock('Assetic\\Asset\\AssetInterface');
+
+ $name = 'foo';
+ $formula = array(array('js/core.js'), array(), array(''));
+ $etag = md5(serialize($formula + array('last_modified' => null)));
+
+ $asset->expects($this->any())->method('getFilters')->will($this->returnValue(array()));
+ $this->am->expects($this->once())->method('has')->with($name)->will($this->returnValue(true));
+ $this->am->expects($this->once())->method('get')->with($name)->will($this->returnValue($asset));
+
+ $this->am->expects($this->once())
+ ->method('hasFormula')
+ ->with($name)
+ ->will($this->returnValue(true));
+ $this->am->expects($this->once())
+ ->method('getFormula')
+ ->with($name)
+ ->will($this->returnValue($formula));
+ $this->request->expects($this->once())
+ ->method('getETags')
+ ->will($this->returnValue(array('"'.$etag.'"')));
+ $asset->expects($this->never())
+ ->method('dump');
+
+ $response = $this->controller->render($name);
+ $this->assertEquals(304, $response->getStatusCode(), '->render() sends a Not Modified response when If-None-Match is fresh');
+ }
+
+ public function testRenderETagStale()
+ {
+ $asset = $this->getMock('Assetic\\Asset\\AssetInterface');
+
+ $name = 'foo';
+ $content = '==ASSET_CONTENT==';
+ $formula = array(array('js/core.js'), array(), array(''));
+ $etag = md5(serialize($formula + array('last_modified' => null)));
+
+ $asset->expects($this->any())->method('getFilters')->will($this->returnValue(array()));
+ $this->am->expects($this->once())->method('has')->with($name)->will($this->returnValue(true));
+ $this->am->expects($this->once())->method('get')->with($name)->will($this->returnValue($asset));
+
+ $this->am->expects($this->once())
+ ->method('hasFormula')
+ ->with($name)
+ ->will($this->returnValue(true));
+ $this->am->expects($this->once())
+ ->method('getFormula')
+ ->with($name)
+ ->will($this->returnValue($formula));
+ $this->request->expects($this->once())
+ ->method('getETags')
+ ->will($this->returnValue(array('"123"')));
+ $asset->expects($this->once())
+ ->method('dump')
+ ->will($this->returnValue($content));
+
+ $response = $this->controller->render($name);
+ $this->assertEquals(200, $response->getStatusCode(), '->render() sends an OK response when If-None-Match is stale');
+ $this->assertEquals($content, $response->getContent(), '->render() sends the dumped asset as the response content');
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Tests/DependencyInjection/AsseticExtensionTest.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Tests/DependencyInjection/AsseticExtensionTest.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,214 @@
+
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+
+namespace Symfony\Bundle\AsseticBundle\Tests\DependencyInjection;
+
+use Symfony\Bundle\AsseticBundle\DependencyInjection\AsseticExtension;
+use Symfony\Bundle\AsseticBundle\DependencyInjection\Compiler\CheckYuiFilterPass;
+use Symfony\Bundle\AsseticBundle\DependencyInjection\Compiler\CheckClosureFilterPass;
+use Symfony\Component\DependencyInjection\Container;
+use Symfony\Component\DependencyInjection\ContainerBuilder;
+use Symfony\Component\DependencyInjection\Definition;
+use Symfony\Component\DependencyInjection\Dumper\PhpDumper;
+use Symfony\Component\DependencyInjection\Scope;
+use Symfony\Component\HttpFoundation\Request;
+
+class AsseticExtensionTest extends \PHPUnit_Framework_TestCase
+{
+ private $kernel;
+ private $container;
+
+ static public function assertSaneContainer(Container $container, $message = '')
+ {
+ $errors = array();
+ foreach ($container->getServiceIds() as $id) {
+ try {
+ $container->get($id);
+ } catch (\Exception $e) {
+ $errors[$id] = $e->getMessage();
+ }
+ }
+
+ self::assertEquals(array(), $errors, $message);
+ }
+
+ protected function setUp()
+ {
+ if (!class_exists('Assetic\\AssetManager')) {
+ $this->markTestSkipped('Assetic is not available.');
+ }
+
+ $this->kernel = $this->getMock('Symfony\\Component\\HttpKernel\\KernelInterface');
+
+ $this->container = new ContainerBuilder();
+ $this->container->addScope(new Scope('request'));
+ $this->container->register('request', 'Symfony\\Component\\HttpFoundation\\Request')->setScope('request');
+ $this->container->register('templating.helper.assets', $this->getMockClass('Symfony\\Component\\Templating\\Helper\\AssetsHelper'));
+ $this->container->register('templating.helper.router', $this->getMockClass('Symfony\\Bundle\\FrameworkBundle\\Templating\\Helper\\RouterHelper'))
+ ->addArgument(new Definition($this->getMockClass('Symfony\\Component\\Routing\\RouterInterface')));
+ $this->container->register('twig', 'Twig_Environment');
+ $this->container->setParameter('kernel.bundles', array());
+ $this->container->setParameter('kernel.cache_dir', __DIR__);
+ $this->container->setParameter('kernel.debug', false);
+ $this->container->setParameter('kernel.root_dir', __DIR__);
+ $this->container->setParameter('kernel.charset', 'UTF-8');
+ $this->container->set('kernel', $this->kernel);
+ }
+
+ /**
+ * @dataProvider getDebugModes
+ */
+ public function testDefaultConfig($debug)
+ {
+ $this->container->setParameter('kernel.debug', $debug);
+
+ $extension = new AsseticExtension();
+ $extension->load(array(array()), $this->container);
+
+ $this->assertFalse($this->container->has('assetic.filter.yui_css'), '->load() does not load the yui_css filter when a yui value is not provided');
+ $this->assertFalse($this->container->has('assetic.filter.yui_js'), '->load() does not load the yui_js filter when a yui value is not provided');
+
+ $this->assertSaneContainer($this->getDumpedContainer());
+ }
+
+ public function getDebugModes()
+ {
+ return array(
+ array(true),
+ array(false),
+ );
+ }
+
+ /**
+ * @dataProvider getFilterNames
+ */
+ public function testFilterConfigs($name, $config = array())
+ {
+ $extension = new AsseticExtension();
+ $extension->load(array(array('filters' => array($name => $config))), $this->container);
+
+ $this->assertSaneContainer($this->getDumpedContainer());
+ }
+
+ public function getFilterNames()
+ {
+ return array(
+ array('closure', array('jar' => '/path/to/closure.jar')),
+ array('coffee'),
+ array('compass'),
+ array('cssembed', array('jar' => '/path/to/cssembed.jar')),
+ array('cssimport'),
+ array('cssrewrite'),
+ array('jpegoptim'),
+ array('jpegtran'),
+ array('less'),
+ array('lessphp'),
+ array('optipng'),
+ array('packager'),
+ array('pngout'),
+ array('sass'),
+ array('scss'),
+ array('sprockets', array('include_dirs' => array('foo'))),
+ array('stylus'),
+ array('yui_css', array('jar' => '/path/to/yuicompressor.jar')),
+ array('yui_js', array('jar' => '/path/to/yuicompressor.jar')),
+ );
+ }
+
+ /**
+ * @dataProvider getUseControllerKeys
+ */
+ public function testUseController($bool, $includes, $omits)
+ {
+ $extension = new AsseticExtension();
+ $extension->load(array(array('use_controller' => $bool)), $this->container);
+
+ foreach ($includes as $id) {
+ $this->assertTrue($this->container->has($id), '"'.$id.'" is registered when use_controller is '.$bool);
+ }
+
+ foreach ($omits as $id) {
+ $this->assertFalse($this->container->has($id), '"'.$id.'" is not registered when use_controller is '.$bool);
+ }
+
+ $this->assertSaneContainer($this->getDumpedContainer());
+ }
+
+ public function getUseControllerKeys()
+ {
+ return array(
+ array(true, array('assetic.routing_loader', 'assetic.controller'), array('assetic.asset_writer_cache_warmer', 'assetic.asset_writer')),
+ array(false, array('assetic.asset_writer_cache_warmer', 'assetic.asset_writer'), array('assetic.routing_loader', 'assetic.controller')),
+ );
+ }
+
+ /**
+ * @dataProvider getClosureJarAndExpected
+ */
+ public function testClosureCompilerPass($jar, $expected)
+ {
+ $this->container->addCompilerPass(new CheckClosureFilterPass());
+
+ $extension = new AsseticExtension();
+ $extension->load(array(array(
+ 'filters' => array(
+ 'closure' => array('jar' => $jar),
+ ),
+ )), $this->container);
+
+ $container = $this->getDumpedContainer();
+ $this->assertSaneContainer($container);
+
+ $this->assertTrue($this->container->getDefinition($expected)->hasTag('assetic.filter'));
+ $this->assertNotEmpty($container->getParameter('assetic.filter.closure.java'));
+ }
+
+ public function getClosureJarAndExpected()
+ {
+ return array(
+ array(null, 'assetic.filter.closure.api'),
+ array('/path/to/closure.jar', 'assetic.filter.closure.jar'),
+ );
+ }
+
+ public function testInvalidYuiConfig()
+ {
+ $this->setExpectedException('RuntimeException', 'assetic.filters.yui_js');
+
+ $this->container->addCompilerPass(new CheckYuiFilterPass());
+
+ $extension = new AsseticExtension();
+ $extension->load(array(array(
+ 'filters' => array(
+ 'yui_js' => array(),
+ ),
+ )), $this->container);
+
+ $this->getDumpedContainer();
+ }
+
+ private function getDumpedContainer()
+ {
+ static $i = 0;
+ $class = 'AsseticExtensionTestContainer'.$i++;
+
+ $this->container->compile();
+
+ $dumper = new PhpDumper($this->container);
+ eval('?>'.$dumper->dump(array('class' => $class)));
+
+ $container = new $class();
+ $container->enterScope('request');
+ $container->set('kernel', $this->kernel);
+
+ return $container;
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Tests/Factory/AssetFactoryTest.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Tests/Factory/AssetFactoryTest.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,97 @@
+
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+
+namespace Symfony\Bundle\AsseticBundle\Tests\Factory;
+
+use Symfony\Bundle\AsseticBundle\Factory\AssetFactory;
+
+class AssetFactoryTest extends \PHPUnit_Framework_TestCase
+{
+ protected $kernel;
+ protected $factory;
+ protected $container;
+
+ protected function setUp()
+ {
+ if (!class_exists('Assetic\\AssetManager')) {
+ $this->markTestSkipped('Assetic is not available.');
+ }
+
+ $this->kernel = $this->getMock('Symfony\\Component\\HttpKernel\\KernelInterface');
+ $this->container = $this->getMock('Symfony\\Component\\DependencyInjection\\ContainerInterface');
+ $this->parameterBag = $this->getMock('Symfony\\Component\\DependencyInjection\\ParameterBag\\ParameterBagInterface');
+ $this->factory = new AssetFactory($this->kernel, $this->container, $this->parameterBag, '/path/to/web');
+ }
+
+ public function testBundleNotation()
+ {
+ $input = '@MyBundle/Resources/css/main.css';
+ $bundle = $this->getMock('Symfony\\Component\\HttpKernel\\Bundle\\BundleInterface');
+
+ $this->parameterBag->expects($this->once())
+ ->method('resolveValue')
+ ->will($this->returnCallback(function($v) { return $v; }));
+ $this->kernel->expects($this->once())
+ ->method('getBundle')
+ ->with('MyBundle')
+ ->will($this->returnValue($bundle));
+ $this->kernel->expects($this->once())
+ ->method('locateResource')
+ ->with($input)
+ ->will($this->returnValue('/path/to/MyBundle/Resources/css/main.css'));
+ $bundle->expects($this->once())
+ ->method('getPath')
+ ->will($this->returnValue('/path/to/MyBundle'));
+
+ $coll = $this->factory->createAsset($input)->all();
+ $asset = $coll[0];
+
+ $this->assertEquals('/path/to/MyBundle', $asset->getSourceRoot(), '->createAsset() sets the asset root');
+ $this->assertEquals('Resources/css/main.css', $asset->getSourcePath(), '->createAsset() sets the asset path');
+ }
+
+ /**
+ * @dataProvider getGlobs
+ */
+ public function testBundleGlobNotation($input)
+ {
+ $bundle = $this->getMock('Symfony\\Component\\HttpKernel\\Bundle\\BundleInterface');
+
+ $this->parameterBag->expects($this->once())
+ ->method('resolveValue')
+ ->will($this->returnCallback(function($v) { return $v; }));
+ $this->kernel->expects($this->once())
+ ->method('getBundle')
+ ->with('MyBundle')
+ ->will($this->returnValue($bundle));
+ $this->kernel->expects($this->once())
+ ->method('locateResource')
+ ->with('@MyBundle/Resources/css/')
+ ->will($this->returnValue('/path/to/MyBundle/Resources/css/'));
+ $bundle->expects($this->once())
+ ->method('getPath')
+ ->will($this->returnValue('/path/to/MyBundle'));
+
+ $coll = $this->factory->createAsset($input)->all();
+ $asset = $coll[0];
+
+ $this->assertEquals('/path/to/MyBundle', $asset->getSourceRoot(), '->createAsset() sets the asset root');
+ $this->assertNull($asset->getSourcePath(), '->createAsset() sets the asset path to null');
+ }
+
+ public function getGlobs()
+ {
+ return array(
+ array('@MyBundle/Resources/css/*'),
+ array('@MyBundle/Resources/css/*/*.css'),
+ );
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Tests/Factory/Resource/CoalescingDirectoryResourceTest.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Tests/Factory/Resource/CoalescingDirectoryResourceTest.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,63 @@
+
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+
+namespace Symfony\Bundle\AsseticBundle\Tests\Factory\Resource;
+
+use Symfony\Bundle\AsseticBundle\Factory\Resource\CoalescingDirectoryResource;
+
+class CoalescingDirectoryResourceTest extends \PHPUnit_Framework_TestCase
+{
+ public function testFiltering()
+ {
+ $dir1 = $this->getMock('Assetic\\Factory\\Resource\\IteratorResourceInterface');
+ $file1a = $this->getMock('Assetic\\Factory\\Resource\\ResourceInterface');
+ $file1b = $this->getMock('Assetic\\Factory\\Resource\\ResourceInterface');
+
+ $dir2 = $this->getMock('Assetic\\Factory\\Resource\\IteratorResourceInterface');
+ $file2a = $this->getMock('Assetic\\Factory\\Resource\\ResourceInterface');
+ $file2c = $this->getMock('Assetic\\Factory\\Resource\\ResourceInterface');
+
+ $dir1->expects($this->any())
+ ->method('getIterator')
+ ->will($this->returnValue(new \ArrayIterator(array($file1a, $file1b))));
+ $file1a->expects($this->any())
+ ->method('__toString')
+ ->will($this->returnValue('FooBundle:Foo:file1.foo.bar'));
+ $file1b->expects($this->any())
+ ->method('__toString')
+ ->will($this->returnValue('FooBundle:Foo:file2.foo.bar'));
+
+ $dir2->expects($this->any())
+ ->method('getIterator')
+ ->will($this->returnValue(new \ArrayIterator(array($file2a, $file2c))));
+ $file2a->expects($this->any())
+ ->method('__toString')
+ ->will($this->returnValue('BarBundle:Foo:file1.foo.bar'));
+ $file2c->expects($this->any())
+ ->method('__toString')
+ ->will($this->returnValue('BarBundle:Foo:file3.foo.bar'));
+
+ $resource = new CoalescingDirectoryResource(array($dir1, $dir2));
+
+ $actual = array();
+ foreach ($resource as $file) {
+ $actual[] = (string) $file;
+ }
+
+ $expected = array(
+ 'FooBundle:Foo:file1.foo.bar',
+ 'FooBundle:Foo:file2.foo.bar',
+ 'BarBundle:Foo:file3.foo.bar',
+ );
+
+ $this->assertEquals($expected, $actual);
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Tests/Factory/Resource/FileResourceTest.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Tests/Factory/Resource/FileResourceTest.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,31 @@
+
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+
+namespace Symfony\Bundle\AsseticBundle\Tests\Factory\Resource;
+
+use Symfony\Bundle\AsseticBundle\Factory\Resource\FileResource;
+
+class FileResourceTest extends \PHPUnit_Framework_TestCase
+{
+ private $loader;
+
+ protected function setUp()
+ {
+ $this->loader = $this->getMock('Symfony\\Component\\Templating\\Loader\\LoaderInterface');
+ }
+
+ public function testCastAsString()
+ {
+ $baseDir = '/path/to/MyBundle/Resources/views/';
+ $resource = new FileResource($this->loader, 'MyBundle', $baseDir, $baseDir.'Section/template.html.twig');
+ $this->assertEquals('MyBundle:Section:template.html.twig', (string) $resource);
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Tests/FilterManagerTest.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Tests/FilterManagerTest.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,59 @@
+
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+
+namespace Symfony\Bundle\AsseticBundle\Tests;
+
+use Symfony\Bundle\AsseticBundle\FilterManager;
+
+class FilterManagerTest extends \PHPUnit_Framework_TestCase
+{
+ protected function setUp()
+ {
+ if (!class_exists('Assetic\\AssetManager')) {
+ $this->markTestSkipped('Assetic is not available.');
+ }
+ }
+
+ public function testGet()
+ {
+ $container = $this->getMock('Symfony\\Component\\DependencyInjection\\ContainerInterface');
+ $filter = $this->getMock('Assetic\\Filter\\FilterInterface');
+
+ $container->expects($this->exactly(2))
+ ->method('get')
+ ->with('assetic.filter.bar')
+ ->will($this->returnValue($filter));
+
+ $fm = new FilterManager($container, array('foo' => 'assetic.filter.bar'));
+
+ $this->assertSame($filter, $fm->get('foo'), '->get() loads the filter from the container');
+ $this->assertSame($filter, $fm->get('foo'), '->get() loads the filter from the container');
+ }
+
+ public function testHas()
+ {
+ $container = $this->getMock('Symfony\\Component\\DependencyInjection\\ContainerInterface');
+
+ $fm = new FilterManager($container, array('foo' => 'assetic.filter.bar'));
+ $this->assertTrue($fm->has('foo'), '->has() returns true for lazily mapped filters');
+ }
+
+ public function testGetNames()
+ {
+ $container = $this->getMock('Symfony\\Component\\DependencyInjection\\ContainerInterface');
+ $filter = $this->getMock('Assetic\\Filter\\FilterInterface');
+
+ $fm = new FilterManager($container, array('foo' => 'assetic.filter.bar'));
+ $fm->set('bar', $filter);
+
+ $this->assertEquals(array('foo', 'bar'), $fm->getNames(), '->getNames() returns all lazy and normal filter names');
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Tests/FunctionalTest.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Tests/FunctionalTest.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,75 @@
+
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+
+namespace Symfony\Bundle\AsseticBundle\Tests;
+
+use Symfony\Component\DomCrawler\Crawler;
+use Symfony\Component\HttpFoundation\Request;
+use Symfony\Component\HttpKernel\Util\Filesystem;
+
+/**
+ * @group functional
+ */
+class FunctionalTest extends \PHPUnit_Framework_TestCase
+{
+ protected $cacheDir;
+
+ protected function setUp()
+ {
+ if (!class_exists('Assetic\\AssetManager')) {
+ $this->markTestSkipped('Assetic is not available.');
+ }
+
+ $this->cacheDir = __DIR__.'/Resources/cache';
+ if (file_exists($this->cacheDir)) {
+ $filesystem = new Filesystem();
+ $filesystem->remove($this->cacheDir);
+ }
+
+ mkdir($this->cacheDir, 0777, true);
+ }
+
+ protected function tearDown()
+ {
+ $filesystem = new Filesystem();
+ $filesystem->remove($this->cacheDir);
+ }
+
+ public function testTwigRenderDebug()
+ {
+ $kernel = new TestKernel('test', true);
+ $kernel->boot();
+ $container = $kernel->getContainer();
+ $container->enterScope('request');
+ $container->set('request', new Request());
+
+ $content = $container->get('templating')->render('::layout.html.twig');
+ $crawler = new Crawler($content);
+
+ $this->assertEquals(3, count($crawler->filter('link[href$=".css"]')));
+ $this->assertEquals(2, count($crawler->filter('script[src$=".js"]')));
+ }
+
+ public function testPhpRenderDebug()
+ {
+ $kernel = new TestKernel('test', true);
+ $kernel->boot();
+ $container = $kernel->getContainer();
+ $container->enterScope('request');
+ $container->set('request', new Request());
+
+ $content = $container->get('templating')->render('::layout.html.php');
+ $crawler = new Crawler($content);
+
+ $this->assertEquals(3, count($crawler->filter('link[href$=".css"]')));
+ $this->assertEquals(2, count($crawler->filter('script[src$=".js"]')));
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Tests/Resources/Resources/views/base.html.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Tests/Resources/Resources/views/base.html.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,11 @@
+
+
+
+ output('title') ?>
+ output('stylesheets') ?>
+
+
+ output('_content') ?>
+ output('javascripts') ?>
+
+
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Tests/Resources/Resources/views/base.html.twig
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Tests/Resources/Resources/views/base.html.twig Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,11 @@
+
+
+
+ {% block title '' %}
+ {% block stylesheets '' %}
+
+
+ {% block content '' %}
+ {% block javascripts '' %}
+
+
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Tests/Resources/Resources/views/layout.html.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Tests/Resources/Resources/views/layout.html.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,17 @@
+extend('::base.html.php') ?>
+
+start('stylesheets') ?>
+ stylesheets('stylesheet1.css, stylesheet2.css, @TestBundle/Resources/css/bundle.css') as $url): ?>
+
+
+stop() ?>
+
+start('javascripts') ?>
+ javascripts('javascript1.js, javascript2.js') as $url): ?>
+
+
+stop() ?>
+
+image('logo.png') as $url): ?>
+
+
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Tests/Resources/Resources/views/layout.html.twig
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Tests/Resources/Resources/views/layout.html.twig Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,19 @@
+{% extends '::base.html.twig' %}
+
+{% block stylesheets %}
+ {% stylesheets 'stylesheet1.css' 'stylesheet2.css' '@TestBundle/Resources/css/bundle.css' %}
+
+ {% endstylesheets %}
+{% endblock %}
+
+{% block javascripts %}
+ {% javascripts 'javascript1.js' 'javascript2.js' %}
+
+ {% endjavascripts %}
+{% endblock %}
+
+{% block content %}
+ {% image 'logo.png' %}
+
+ {% endimage %}
+{% endblock %}
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Tests/Resources/config/config.yml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Tests/Resources/config/config.yml Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,41 @@
+framework:
+ charset: UTF-8
+ secret: xxxxxxxxxx
+ csrf_protection:
+ enabled: true
+ router: { resource: "%kernel.root_dir%/config/routing.yml" }
+ validation: { enabled: true, enable_annotations: true }
+ templating: { engines: ['twig', 'php'] }
+ session:
+ default_locale: en
+ lifetime: 3600
+ auto_start: false
+
+twig:
+ debug: %kernel.debug%
+ strict_variables: %kernel.debug%
+
+assetic:
+ use_controller: true
+ read_from: "%kernel.root_dir%/web"
+ bundles: [ TestBundle ]
+ assets:
+ jquery: js/jquery.js
+ app_css:
+ inputs:
+ - css/main.css
+ - css/more.css
+ - @widget_css
+ filters: [ ?yui_css ]
+ output: css/packed/app.css
+ widget_css:
+ inputs: css/widget.sass
+ filters: sass
+ filters:
+ sass:
+ apply_to: "\.sass$"
+ yui_css:
+ jar: %kernel.root_dir/java/yui-compressor-2.4.6.jar
+ twig:
+ functions:
+ yui_css: { output: css/*.css }
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Tests/Resources/config/routing.yml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Tests/Resources/config/routing.yml Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,3 @@
+_assetic:
+ resource: .
+ type: assetic
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Tests/Resources/web/javascript1.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Tests/Resources/web/javascript1.js Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,1 @@
+// javascript1.js
\ No newline at end of file
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Tests/Resources/web/javascript2.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Tests/Resources/web/javascript2.js Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,1 @@
+// javascript2.js
\ No newline at end of file
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Tests/Resources/web/stylesheet1.css
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Tests/Resources/web/stylesheet1.css Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,1 @@
+/* stylesheet1.css */
\ No newline at end of file
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Tests/Resources/web/stylesheet2.css
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Tests/Resources/web/stylesheet2.css Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,1 @@
+/* stylesheet2.css */
\ No newline at end of file
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Tests/Templating/AsseticHelperTest.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Tests/Templating/AsseticHelperTest.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,56 @@
+
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+
+namespace Symfony\Bundle\AsseticBundle\Tests\Templating;
+
+use Assetic\Asset\AssetCollection;
+use Assetic\Asset\AssetInterface;
+use Assetic\Asset\StringAsset;
+use Assetic\Factory\AssetFactory;
+use Symfony\Bundle\AsseticBundle\Templating\AsseticHelper;
+
+class AsseticHelperTest extends \PHPUnit_Framework_TestCase
+{
+ protected function setUp()
+ {
+ if (!class_exists('Assetic\\AssetManager')) {
+ $this->markTestSkipped('Assetic is not available.');
+ }
+ }
+
+ /**
+ * @dataProvider getDebugAndCount
+ */
+ public function testUrls($debug, $count, $message)
+ {
+ $helper = new AsseticHelperForTest(new AssetFactory('/foo', $debug), $debug);
+ $urls = $helper->javascripts(array('js/jquery.js', 'js/jquery.plugin.js'));
+
+ $this->assertInstanceOf('Traversable', $urls, '->javascripts() returns an array');
+ $this->assertEquals($count, count($urls), $message);
+ }
+
+ public function getDebugAndCount()
+ {
+ return array(
+ array(false, 1, '->javascripts() returns one url when not in debug mode'),
+ array(true, 2, '->javascripts() returns many urls when in debug mode'),
+ );
+ }
+}
+
+class AsseticHelperForTest extends AsseticHelper
+{
+ protected function getAssetUrl(AssetInterface $asset, $options = array())
+ {
+ return $asset->getTargetPath();
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Tests/TestBundle/Resources/css/bundle.css
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Tests/TestBundle/Resources/css/bundle.css Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,1 @@
+/* bundle.css */
\ No newline at end of file
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Tests/TestBundle/TestBundle.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Tests/TestBundle/TestBundle.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,18 @@
+
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+
+namespace Symfony\Bundle\AsseticBundle\Tests\TestBundle;
+
+use Symfony\Component\HttpKernel\Bundle\Bundle;
+
+class TestBundle extends Bundle
+{
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Tests/TestKernel.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Tests/TestKernel.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,38 @@
+
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+
+namespace Symfony\Bundle\AsseticBundle\Tests;
+
+use Symfony\Component\Config\Loader\LoaderInterface;
+use Symfony\Component\HttpKernel\Kernel;
+
+class TestKernel extends Kernel
+{
+ public function getRootDir()
+ {
+ return __DIR__.'/Resources';
+ }
+
+ public function registerBundles()
+ {
+ return array(
+ new \Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
+ new \Symfony\Bundle\TwigBundle\TwigBundle(),
+ new \Symfony\Bundle\AsseticBundle\AsseticBundle(),
+ new \Symfony\Bundle\AsseticBundle\Tests\TestBundle\TestBundle(),
+ );
+ }
+
+ public function registerContainerConfiguration(LoaderInterface $loader)
+ {
+ $loader->load(__DIR__.'/Resources/config/config.yml');
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Tests/bootstrap.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Tests/bootstrap.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,17 @@
+registerNamespace('Symfony', $_SERVER['SYMFONY']);
+$loader->registerNamespace('Assetic', $_SERVER['ASSETIC']);
+$loader->registerPrefix('Twig_', $_SERVER['TWIG']);
+$loader->register();
+
+spl_autoload_register(function($class)
+{
+ if (0 === strpos($class, 'Symfony\\Bundle\\AsseticBundle\\') &&
+ file_exists($file = __DIR__.'/../'.implode('/', array_slice(explode('\\', $class), 3)).'.php')) {
+ require_once $file;
+ }
+});
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Twig/AsseticExtension.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Twig/AsseticExtension.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,54 @@
+
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+
+namespace Symfony\Bundle\AsseticBundle\Twig;
+
+use Assetic\Extension\Twig\AsseticExtension as BaseAsseticExtension;
+use Assetic\Factory\AssetFactory;
+
+/**
+ * Assetic extension.
+ *
+ * @author Kris Wallsmith
+ */
+class AsseticExtension extends BaseAsseticExtension
+{
+ private $useController;
+
+ public function __construct(AssetFactory $factory, $useController = false, $functions = array())
+ {
+ parent::__construct($factory, $functions);
+
+ $this->useController = $useController;
+ }
+
+ public function getTokenParsers()
+ {
+ return array(
+ new AsseticTokenParser($this->factory, 'javascripts', 'js/*.js', false, array('package')),
+ new AsseticTokenParser($this->factory, 'stylesheets', 'css/*.css', false, array('package')),
+ new AsseticTokenParser($this->factory, 'image', 'images/*', true, array('package')),
+ );
+ }
+
+ public function getNodeVisitors()
+ {
+ return array(new AsseticNodeVisitor());
+ }
+
+ public function getGlobals()
+ {
+ $globals = parent::getGlobals();
+ $globals['assetic']['use_controller'] = $this->useController;
+
+ return $globals;
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Twig/AsseticNode.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Twig/AsseticNode.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,57 @@
+
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+
+namespace Symfony\Bundle\AsseticBundle\Twig;
+
+use Assetic\Asset\AssetInterface;
+use Assetic\Extension\Twig\AsseticNode as BaseAsseticNode;
+
+/**
+ * Assetic node.
+ *
+ * @author Kris Wallsmith
+ */
+class AsseticNode extends BaseAsseticNode
+{
+ protected function compileAssetUrl(\Twig_Compiler $compiler, AssetInterface $asset, $name)
+ {
+ $compiler
+ ->raw('isset($context[\'assetic\'][\'use_controller\']) && $context[\'assetic\'][\'use_controller\'] ? ')
+ ->subcompile($this->getPathFunction($name))
+ ->raw(' : ')
+ ->subcompile($this->getAssetFunction($asset->getTargetPath()))
+ ;
+ }
+
+ private function getPathFunction($name)
+ {
+ return new \Twig_Node_Expression_Function(
+ new \Twig_Node_Expression_Name('path', $this->getLine()),
+ new \Twig_Node(array(new \Twig_Node_Expression_Constant('_assetic_'.$name, $this->getLine()))),
+ $this->getLine()
+ );
+ }
+
+ private function getAssetFunction($path)
+ {
+ $arguments = array(new \Twig_Node_Expression_Constant($path, $this->getLine()));
+
+ if ($this->hasAttribute('package')) {
+ $arguments[] = new \Twig_Node_Expression_Constant($this->getAttribute('package'), $this->getLine());
+ }
+
+ return new \Twig_Node_Expression_Function(
+ new \Twig_Node_Expression_Name('asset', $this->getLine()),
+ new \Twig_Node($arguments),
+ $this->getLine()
+ );
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Twig/AsseticNodeVisitor.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Twig/AsseticNodeVisitor.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,97 @@
+
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+
+namespace Symfony\Bundle\AsseticBundle\Twig;
+
+use Assetic\Extension\Twig\AsseticFilterFunction;
+
+/**
+ * Assetic node visitor.
+ *
+ * @author Kris Wallsmith
+ */
+class AsseticNodeVisitor implements \Twig_NodeVisitorInterface
+{
+ public function enterNode(\Twig_NodeInterface $node, \Twig_Environment $env)
+ {
+ return $node;
+ }
+
+ public function leaveNode(\Twig_NodeInterface $node, \Twig_Environment $env)
+ {
+ if (!$formula = $this->checkNode($node, $env)) {
+ return $node;
+ }
+
+ list($input, $filters, $options) = $formula;
+ $line = $node->getLine();
+
+ // check context and call either asset() or path()
+ return new \Twig_Node_Expression_Conditional(
+ new \Twig_Node_Expression_GetAttr(
+ new \Twig_Node_Expression_Name('assetic', $line),
+ new \Twig_Node_Expression_Constant('use_controller', $line),
+ new \Twig_Node(),
+ \Twig_TemplateInterface::ARRAY_CALL,
+ $line
+ ),
+ new \Twig_Node_Expression_Function(
+ new \Twig_Node_Expression_Name('path', $line),
+ new \Twig_Node(array(
+ new \Twig_Node_Expression_Constant('_assetic_'.$options['name'], $line),
+ )),
+ $line
+ ),
+ new \Twig_Node_Expression_Function(
+ new \Twig_Node_Expression_Name('asset', $line),
+ new \Twig_Node(array($node, new \Twig_Node_Expression_Constant(isset($options['package']) ? $options['package'] : null, $line))),
+ $line
+ ),
+ $line
+ );
+ }
+
+ /**
+ * Extracts formulae from filter function nodes.
+ *
+ * @return array|null The formula
+ */
+ private function checkNode(\Twig_NodeInterface $node, \Twig_Environment $env)
+ {
+ if ($node instanceof \Twig_Node_Expression_Function) {
+ $name = $node->getNode('name')->getAttribute('name');
+ if ($env->getFunction($name) instanceof AsseticFilterFunction) {
+ $arguments = array();
+ foreach ($node->getNode('arguments') as $argument) {
+ $arguments[] = eval('return '.$env->compile($argument).';');
+ }
+
+ $invoker = $env->getExtension('assetic')->getFilterInvoker($name);
+ $factory = $invoker->getFactory();
+
+ $inputs = isset($arguments[0]) ? (array) $arguments[0] : array();
+ $filters = $invoker->getFilters();
+ $options = array_replace($invoker->getOptions(), isset($arguments[1]) ? $arguments[1] : array());
+
+ if (!isset($options['name'])) {
+ $options['name'] = $factory->generateAssetName($inputs, $filters);
+ }
+
+ return array($inputs, $filters, $options);
+ }
+ }
+ }
+
+ public function getPriority()
+ {
+ return 0;
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/Twig/AsseticTokenParser.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Twig/AsseticTokenParser.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,28 @@
+
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+
+namespace Symfony\Bundle\AsseticBundle\Twig;
+
+use Assetic\Asset\AssetInterface;
+use Assetic\Extension\Twig\AsseticTokenParser as BaseAsseticTokenParser;
+
+/**
+ * Assetic token parser.
+ *
+ * @author Kris Wallsmith
+ */
+class AsseticTokenParser extends BaseAsseticTokenParser
+{
+ protected function createNode(AssetInterface $asset, \Twig_NodeInterface $body, array $inputs, array $filters, $name, array $attributes = array(), $lineno = 0, $tag = null)
+ {
+ return new AsseticNode($asset, $body, $inputs, $filters, $name, $attributes, $lineno, $tag);
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/bundles/Symfony/Bundle/AsseticBundle/phpunit.xml.dist
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/phpunit.xml.dist Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,35 @@
+
+
+
+
+
+ ./Tests/
+
+
+
+
+
+
+
+
+
+
+
+ ./
+
+ ./Resources
+ ./Tests
+
+
+
+
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-common/LICENSE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-common/LICENSE Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,504 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+ When we speak of free software, we are referring to freedom of use,
+not price. Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+ To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+ Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+ Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License. This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License. We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+ When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+ We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less
+of an advantage over competing non-free programs. These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+ For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard. To achieve this, non-free programs must be
+allowed to use the library. A more frequent case is that a free
+library does the same job as widely used non-free libraries. In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+ In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software. For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+ Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+ 6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ d) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ e) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ , 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
+
+
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-common/UPGRADE_TO_2_1
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-common/UPGRADE_TO_2_1 Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,39 @@
+This document details all the possible changes that you should investigate when updating
+your project from Doctrine Common 2.0.x to 2.1
+
+## AnnotationReader changes
+
+The annotation reader was heavily refactored between 2.0 and 2.1-RC1. In theory the operation of the new reader should be backwards compatible, but it has to be setup differently to work that way:
+
+ $reader = new \Doctrine\Common\Annotations\AnnotationReader();
+ $reader->setDefaultAnnotationNamespace('Doctrine\ORM\Mapping\\');
+ // new code necessary starting here
+ $reader->setIgnoreNotImportedAnnotations(true);
+ $reader->setEnableParsePhpImports(false);
+ $reader = new \Doctrine\Common\Annotations\CachedReader(
+ new \Doctrine\Common\Annotations\IndexedReader($reader), new ArrayCache()
+ );
+
+## Annotation Base class or @Annotation
+
+Beginning after 2.1-RC2 you have to either extend ``Doctrine\Common\Annotations\Annotation`` or add @Annotation to your annotations class-level docblock, otherwise the class will simply be ignored.
+
+## Removed methods on AnnotationReader
+
+* AnnotationReader::setAutoloadAnnotations()
+* AnnotationReader::getAutoloadAnnotations()
+* AnnotationReader::isAutoloadAnnotations()
+
+## AnnotationRegistry
+
+Autoloading through the PHP autoloader is removed from the 2.1 AnnotationReader. Instead you have to use the global AnnotationRegistry for loading purposes:
+
+ \Doctrine\Common\Annotations\AnnotationRegistry::registerFile($fileWithAnnotations);
+ \Doctrine\Common\Annotations\AnnotationRegistry::registerAutoloadNamespace($namespace, $dirs = null);
+ \Doctrine\Common\Annotations\AnnotationRegistry::registerAutoloadNamespaces($namespaces);
+ \Doctrine\Common\Annotations\AnnotationRegistry::registerLoader($callable);
+
+The $callable for registering a loader accepts a class as first and only parameter and must try to silently autoload it. On success true has to be returned.
+The registerAutoloadNamespace function registers a PSR-0 compatible silent autoloader for all classes with the given namespace in the given directories.
+If null is passed as directory the include path will be used.
+
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-common/lib/Doctrine/Common/Annotations/Annotation.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-common/lib/Doctrine/Common/Annotations/Annotation.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,75 @@
+.
+ */
+
+namespace Doctrine\Common\Annotations;
+
+/**
+ * Annotations class
+ *
+ * @author Benjamin Eberlei
+ * @author Guilherme Blanco
+ * @author Jonathan Wage
+ * @author Roman Borschel
+ */
+class Annotation
+{
+ /**
+ * Value property. Common among all derived classes.
+ *
+ * @var string
+ */
+ public $value;
+
+ /**
+ * Constructor
+ *
+ * @param array $data Key-value for properties to be defined in this class
+ */
+ public final function __construct(array $data)
+ {
+ foreach ($data as $key => $value) {
+ $this->$key = $value;
+ }
+ }
+
+ /**
+ * Error handler for unknown property accessor in Annotation class.
+ *
+ * @param string $name Unknown property name
+ */
+ public function __get($name)
+ {
+ throw new \BadMethodCallException(
+ sprintf("Unknown property '%s' on annotation '%s'.", $name, get_class($this))
+ );
+ }
+
+ /**
+ * Error handler for unknown property mutator in Annotation class.
+ *
+ * @param string $name Unkown property name
+ * @param mixed $value Property value
+ */
+ public function __set($name, $value)
+ {
+ throw new \BadMethodCallException(
+ sprintf("Unknown property '%s' on annotation '%s'.", $name, get_class($this))
+ );
+ }
+}
\ No newline at end of file
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-common/lib/Doctrine/Common/Annotations/Annotation/IgnoreAnnotation.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-common/lib/Doctrine/Common/Annotations/Annotation/IgnoreAnnotation.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,43 @@
+.
+ */
+
+namespace Doctrine\Common\Annotations\Annotation;
+
+/**
+ * Annotation that can be used to signal to the parser to ignore specific
+ * annotations during the parsing process.
+ *
+ * @author Johannes M. Schmitt
+ */
+final class IgnoreAnnotation
+{
+ public $names;
+
+ public function __construct(array $values)
+ {
+ if (is_string($values['value'])) {
+ $values['value'] = array($values['value']);
+ }
+ if (!is_array($values['value'])) {
+ throw new \RuntimeException(sprintf('@IgnoreAnnotation expects either a string name, or an array of strings, but got %s.', json_encode($values['value'])));
+ }
+
+ $this->names = $values['value'];
+ }
+}
\ No newline at end of file
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-common/lib/Doctrine/Common/Annotations/AnnotationException.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-common/lib/Doctrine/Common/Annotations/AnnotationException.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,54 @@
+.
+ */
+
+namespace Doctrine\Common\Annotations;
+
+/**
+ * Description of AnnotationException
+ *
+ * @since 2.0
+ * @author Benjamin Eberlei
+ * @author Guilherme Blanco
+ * @author Jonathan Wage
+ * @author Roman Borschel
+ */
+class AnnotationException extends \Exception
+{
+ /**
+ * Creates a new AnnotationException describing a Syntax error.
+ *
+ * @param string $message Exception message
+ * @return AnnotationException
+ */
+ public static function syntaxError($message)
+ {
+ return new self('[Syntax Error] ' . $message);
+ }
+
+ /**
+ * Creates a new AnnotationException describing a Semantical error.
+ *
+ * @param string $message Exception message
+ * @return AnnotationException
+ */
+ public static function semanticalError($message)
+ {
+ return new self('[Semantical Error] ' . $message);
+ }
+}
\ No newline at end of file
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-common/lib/Doctrine/Common/Annotations/AnnotationReader.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-common/lib/Doctrine/Common/Annotations/AnnotationReader.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,383 @@
+.
+ */
+
+namespace Doctrine\Common\Annotations;
+
+use Doctrine\Common\Annotations\Annotation\IgnoreAnnotation;
+use Closure;
+use ReflectionClass;
+use ReflectionMethod;
+use ReflectionProperty;
+
+require_once __DIR__ . '/Annotation/IgnoreAnnotation.php';
+
+/**
+ * A reader for docblock annotations.
+ *
+ * @author Benjamin Eberlei
+ * @author Guilherme Blanco
+ * @author Jonathan Wage
+ * @author Roman Borschel
+ * @author Johannes M. Schmitt
+ */
+final class AnnotationReader implements Reader
+{
+ /**
+ * Global map for imports.
+ *
+ * @var array
+ */
+ private static $globalImports = array(
+ 'ignoreannotation' => 'Doctrine\Common\Annotations\Annotation\IgnoreAnnotation',
+ );
+
+ /**
+ * A list with annotations that are not causing exceptions when not resolved to an annotation class.
+ *
+ * The names are case sensitive.
+ *
+ * @var array
+ */
+ private static $globalIgnoredNames = array(
+ 'access'=> true, 'author'=> true, 'copyright'=> true, 'deprecated'=> true,
+ 'example'=> true, 'ignore'=> true, 'internal'=> true, 'link'=> true, 'see'=> true,
+ 'since'=> true, 'tutorial'=> true, 'version'=> true, 'package'=> true,
+ 'subpackage'=> true, 'name'=> true, 'global'=> true, 'param'=> true,
+ 'return'=> true, 'staticvar'=> true, 'category'=> true, 'staticVar'=> true,
+ 'static'=> true, 'var'=> true, 'throws'=> true, 'inheritdoc'=> true,
+ 'inheritDoc'=> true, 'license'=> true, 'todo'=> true, 'deprecated'=> true,
+ 'deprec'=> true, 'author'=> true, 'property' => true, 'method' => true,
+ 'abstract'=> true, 'exception'=> true, 'magic' => true, 'api' => true,
+ 'final'=> true, 'filesource'=> true, 'throw' => true, 'uses' => true,
+ 'usedby'=> true, 'private' => true, 'Annotation' => true,
+ );
+
+ /**
+ * Add a new annotation to the globally ignored annotation names with regard to exception handling.
+ *
+ * @param string $name
+ */
+ static public function addGlobalIgnoredName($name)
+ {
+ self::$globalIgnoredNames[$name] = true;
+ }
+
+ /**
+ * Annotations Parser
+ *
+ * @var Doctrine\Common\Annotations\DocParser
+ */
+ private $parser;
+
+ /**
+ * Annotations Parser used to collect parsing metadata
+ *
+ * @var Doctrine\Common\Annotations\DocParser
+ */
+ private $preParser;
+
+ /**
+ * PHP Parser used to collect imports.
+ *
+ * @var Doctrine\Common\Annotations\PhpParser
+ */
+ private $phpParser;
+
+ /**
+ * In-memory cache mechanism to store imported annotations per class.
+ *
+ * @var array
+ */
+ private $imports = array();
+
+ /**
+ * In-memory cache mechanism to store ignored annotations per class.
+ *
+ * @var array
+ */
+ private $ignoredAnnotationNames = array();
+
+ /**
+ * @var string
+ */
+ private $defaultAnnotationNamespace = false;
+
+ /**
+ * @var bool
+ */
+ private $enablePhpImports = true;
+
+ /**
+ * Constructor. Initializes a new AnnotationReader that uses the given Cache provider.
+ *
+ * @param DocParser $parser The parser to use. If none is provided, the default parser is used.
+ */
+ public function __construct()
+ {
+ AnnotationRegistry::registerFile(__DIR__ . '/Annotation/IgnoreAnnotation.php');
+
+ $this->parser = new DocParser;
+
+ $this->preParser = new DocParser;
+ $this->preParser->setImports(self::$globalImports);
+ $this->preParser->setIgnoreNotImportedAnnotations(true);
+
+ $this->phpParser = new PhpParser;
+ }
+
+ /**
+ * Ignore not imported annotations and not throw an exception.
+ *
+ * @param bool $bool
+ */
+ public function setIgnoreNotImportedAnnotations($bool)
+ {
+ $this->parser->setIgnoreNotImportedAnnotations($bool);
+ }
+
+ /**
+ * Detect imports by parsing the use statements of affected files.
+ *
+ * @deprecated Will be removed in 3.0, imports will always be enabled.
+ * @param bool $flag
+ */
+ public function setEnableParsePhpImports($flag)
+ {
+ $this->enablePhpImports = $flag;
+ }
+
+ /**
+ * @deprecated Will be removed in 3.0, imports will always be enabled.
+ * @return bool
+ */
+ public function isParsePhpImportsEnabled()
+ {
+ return $this->enablePhpImports;
+ }
+
+ /**
+ * Sets the default namespace that the AnnotationReader should assume for annotations
+ * with not fully qualified names.
+ *
+ * @deprecated This method will be removed in Doctrine Common 3.0
+ * @param string $defaultNamespace
+ */
+ public function setDefaultAnnotationNamespace($defaultNamespace)
+ {
+ $this->defaultAnnotationNamespace = $defaultNamespace;
+ }
+
+ /**
+ * Sets the custom function to use for creating new annotations on the
+ * underlying parser.
+ *
+ * The function is supplied two arguments. The first argument is the name
+ * of the annotation and the second argument an array of values for this
+ * annotation. The function is assumed to return an object or NULL.
+ * Whenever the function returns NULL for an annotation, the implementation falls
+ * back to the default annotation creation process of the underlying parser.
+ *
+ * @deprecated This method will be removed in Doctrine Common 3.0
+ * @param Closure $func
+ */
+ public function setAnnotationCreationFunction(Closure $func)
+ {
+ $this->parser->setAnnotationCreationFunction($func);
+ }
+
+ /**
+ * Sets an alias for an annotation namespace.
+ *
+ * @param string $namespace
+ * @param string $alias
+ */
+ public function setAnnotationNamespaceAlias($namespace, $alias)
+ {
+ $this->parser->setAnnotationNamespaceAlias($namespace, $alias);
+ }
+
+ /**
+ * Gets the annotations applied to a class.
+ *
+ * @param string|ReflectionClass $class The name or ReflectionClass of the class from which
+ * the class annotations should be read.
+ * @return array An array of Annotations.
+ */
+ public function getClassAnnotations(ReflectionClass $class)
+ {
+ $this->parser->setImports($this->getImports($class));
+ $this->parser->setIgnoredAnnotationNames($this->getIgnoredAnnotationNames($class));
+
+ return $this->parser->parse($class->getDocComment(), 'class ' . $class->getName());
+ }
+
+ /**
+ * Gets a class annotation.
+ *
+ * @param ReflectionClass $class The ReflectionClass of the class from which
+ * the class annotations should be read.
+ * @param string $annotationName The name of the annotation.
+ * @return The Annotation or NULL, if the requested annotation does not exist.
+ */
+ public function getClassAnnotation(ReflectionClass $class, $annotationName)
+ {
+ $annotations = $this->getClassAnnotations($class);
+
+ foreach ($annotations as $annotation) {
+ if ($annotation instanceof $annotationName) {
+ return $annotation;
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Gets the annotations applied to a property.
+ *
+ * @param string|ReflectionProperty $property The name or ReflectionProperty of the property
+ * from which the annotations should be read.
+ * @return array An array of Annotations.
+ */
+ public function getPropertyAnnotations(ReflectionProperty $property)
+ {
+ $class = $property->getDeclaringClass();
+ $context = 'property ' . $class->getName() . "::\$" . $property->getName();
+ $this->parser->setImports($this->getImports($class));
+ $this->parser->setIgnoredAnnotationNames($this->getIgnoredAnnotationNames($class));
+
+ return $this->parser->parse($property->getDocComment(), $context);
+ }
+
+ /**
+ * Gets a property annotation.
+ *
+ * @param ReflectionProperty $property
+ * @param string $annotationName The name of the annotation.
+ * @return The Annotation or NULL, if the requested annotation does not exist.
+ */
+ public function getPropertyAnnotation(ReflectionProperty $property, $annotationName)
+ {
+ $annotations = $this->getPropertyAnnotations($property);
+
+ foreach ($annotations as $annotation) {
+ if ($annotation instanceof $annotationName) {
+ return $annotation;
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Gets the annotations applied to a method.
+ *
+ * @param ReflectionMethod $property The name or ReflectionMethod of the method from which
+ * the annotations should be read.
+ * @return array An array of Annotations.
+ */
+ public function getMethodAnnotations(ReflectionMethod $method)
+ {
+ $class = $method->getDeclaringClass();
+ $context = 'method ' . $class->getName() . '::' . $method->getName() . '()';
+ $this->parser->setImports($this->getImports($class));
+ $this->parser->setIgnoredAnnotationNames($this->getIgnoredAnnotationNames($class));
+
+ return $this->parser->parse($method->getDocComment(), $context);
+ }
+
+ /**
+ * Gets a method annotation.
+ *
+ * @param ReflectionMethod $method
+ * @param string $annotationName The name of the annotation.
+ * @return The Annotation or NULL, if the requested annotation does not exist.
+ */
+ public function getMethodAnnotation(ReflectionMethod $method, $annotationName)
+ {
+ $annotations = $this->getMethodAnnotations($method);
+
+ foreach ($annotations as $annotation) {
+ if ($annotation instanceof $annotationName) {
+ return $annotation;
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the ignored annotations for the given class.
+ *
+ * @param ReflectionClass $class
+ * @return array
+ */
+ private function getIgnoredAnnotationNames(ReflectionClass $class)
+ {
+ if (isset($this->ignoredAnnotationNames[$name = $class->getName()])) {
+ return $this->ignoredAnnotationNames[$name];
+ }
+ $this->collectParsingMetadata($class);
+
+ return $this->ignoredAnnotationNames[$name];
+ }
+
+ private function getImports(ReflectionClass $class)
+ {
+ if (isset($this->imports[$name = $class->getName()])) {
+ return $this->imports[$name];
+ }
+ $this->collectParsingMetadata($class);
+
+ return $this->imports[$name];
+ }
+
+ /**
+ * Collects parsing metadata for a given class
+ *
+ * @param ReflectionClass $class
+ */
+ private function collectParsingMetadata(ReflectionClass $class)
+ {
+ $imports = self::$globalImports;
+ $ignoredAnnotationNames = self::$globalIgnoredNames;
+
+ if ($this->enablePhpImports) {
+ $annotations = $this->preParser->parse($class->getDocComment());
+ foreach ($annotations as $annotation) {
+ if ($annotation instanceof IgnoreAnnotation) {
+ foreach ($annotation->names AS $annot) {
+ $ignoredAnnotationNames[$annot] = true;
+ }
+ }
+ }
+ }
+
+ $name = $class->getName();
+ $this->imports[$name] = array_merge(
+ self::$globalImports,
+ ($this->enablePhpImports) ? $this->phpParser->parseClass($class) : array(),
+ ($this->enablePhpImports) ? array('__NAMESPACE__' => $class->getNamespaceName()) : array()
+ );
+ if ($this->defaultAnnotationNamespace) {
+ $this->imports[$name]['__DEFAULT__'] = $this->defaultAnnotationNamespace;
+ }
+ $this->ignoredAnnotationNames[$name] = $ignoredAnnotationNames;
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-common/lib/Doctrine/Common/Annotations/AnnotationRegistry.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-common/lib/Doctrine/Common/Annotations/AnnotationRegistry.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,129 @@
+.
+ */
+
+namespace Doctrine\Common\Annotations;
+
+final class AnnotationRegistry
+{
+ /**
+ * A map of namespaces to use for autoloading purposes based on a PSR-0 convention.
+ *
+ * Contains the namespace as key and an array of direectories as value. If the value is NULL
+ * the include path is used for checking for the corresponding file.
+ *
+ * This autoloading mechanism does not utilize the PHP autoloading but implements autoloading on its own.
+ *
+ * @var array
+ */
+ static private $autoloadNamespaces = array();
+
+ /**
+ * A map of autoloader callables.
+ *
+ * @var array
+ */
+ static private $loaders = array();
+
+ static public function reset()
+ {
+ self::$autoloadNamespaces = array();
+ self::$loaders = array();
+ }
+
+ static public function registerFile($file)
+ {
+ require_once $file;
+ }
+
+ /**
+ * Add a namespace with one or many directories to look for files or null for the include path.
+ *
+ * Loading of this namespaces will be done with a PSR-0 namespace loading algorithm.
+ *
+ * @param string $namespace
+ * @param string|array|null $dirs
+ */
+ static public function registerAutoloadNamespace($namespace, $dirs = null)
+ {
+ self::$autoloadNamespaces[$namespace] = $dirs;
+ }
+
+ /**
+ * Register multiple namespaces
+ *
+ * Loading of this namespaces will be done with a PSR-0 namespace loading algorithm.
+ *
+ * @param array $namespaces
+ */
+ static public function registerAutoloadNamespaces(array $namespaces)
+ {
+ self::$autoloadNamespaces = array_merge(self::$autoloadNamespaces, $namespaces);
+ }
+
+ /**
+ * Register an autoloading callabale for annotations, much like spl_autoload_register().
+ *
+ * NOTE: These class loaders HAVE to be silent when a class was not found!
+ * IMPORTANT: Loaders have to return true if they loaded a class that could contain the searched annotation class.
+ *
+ * @param callabale $callabale
+ */
+ static public function registerLoader($callabale)
+ {
+ if (!is_callable($callabale)) {
+ throw new \InvalidArgumentException("A callable is expected in AnnotationRegistry::registerLoader().");
+ }
+ self::$loaders[] = $callabale;
+ }
+
+ /**
+ * Autoload an annotation class silently.
+ *
+ * @param string $class
+ * @return void
+ */
+ static public function loadAnnotationClass($class)
+ {
+ foreach (self::$autoloadNamespaces AS $namespace => $dirs) {
+ if (strpos($class, $namespace) === 0) {
+ $file = str_replace("\\", DIRECTORY_SEPARATOR, $class) . ".php";
+ if ($dirs === null) {
+ if ($path = stream_resolve_include_path($file)) {
+ require $path;
+ return true;
+ }
+ } else {
+ foreach((array)$dirs AS $dir) {
+ if (file_exists($dir . DIRECTORY_SEPARATOR . $file)) {
+ require $dir . DIRECTORY_SEPARATOR . $file;
+ return true;
+ }
+ }
+ }
+ }
+ }
+
+ foreach (self::$loaders AS $loader) {
+ if (call_user_func($loader, $class) === true) {
+ return true;
+ }
+ }
+ return false;
+ }
+}
\ No newline at end of file
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-common/lib/Doctrine/Common/Annotations/CachedReader.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-common/lib/Doctrine/Common/Annotations/CachedReader.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,179 @@
+.
+ */
+
+namespace Doctrine\Common\Annotations;
+
+use Doctrine\Common\Cache\Cache;
+
+/**
+ * A cache aware annotation reader.
+ *
+ * @author Johannes M. Schmitt
+ * @author Benjamin Eberlei
+ */
+final class CachedReader implements Reader
+{
+ private static $CACHE_SALT = '@[Annot]';
+
+ /**
+ * @var Reader
+ */
+ private $delegate;
+
+ /**
+ * @var Cache
+ */
+ private $cache;
+
+ /**
+ * @var boolean
+ */
+ private $debug;
+
+ /**
+ * @var array
+ */
+ private $loadedAnnotations;
+
+ /**
+ * @param Reader $reader
+ * @param Cache $cache
+ */
+ public function __construct(Reader $reader, Cache $cache, $debug = false)
+ {
+ $this->delegate = $reader;
+ $this->cache = $cache;
+ $this->debug = $debug;
+ }
+
+ public function getClassAnnotations(\ReflectionClass $class)
+ {
+ $cacheKey = $class->getName() . self::$CACHE_SALT;
+
+ if (isset($this->loadedAnnotations[$cacheKey])) {
+ return $this->loadedAnnotations[$cacheKey];
+ }
+
+ // Attempt to grab data from cache
+ if (($data = $this->cache->fetch($cacheKey)) !== false) {
+ if (!$this->debug || $this->isCacheFresh($cacheKey, $class)) {
+ return $data;
+ }
+ }
+
+ $annots = $this->delegate->getClassAnnotations($class);
+ $this->cache->save($cacheKey, $annots);
+ $this->cache->save('[C]'.$cacheKey, time());
+
+ return $this->loadedAnnotations[$cacheKey] = $annots;
+ }
+
+ public function getClassAnnotation(\ReflectionClass $class, $annotationName)
+ {
+ foreach ($this->getClassAnnotations($class) as $annot) {
+ if ($annot instanceof $annotationName) {
+ return $annot;
+ }
+ }
+
+ return null;
+ }
+
+ public function getPropertyAnnotations(\ReflectionProperty $property)
+ {
+ $class = $property->getDeclaringClass();
+ $cacheKey = $class->getName().'$'.$property->getName().self::$CACHE_SALT;
+
+ if (isset($this->loadedAnnotations[$cacheKey])) {
+ return $this->loadedAnnotations[$cacheKey];
+ }
+
+ // Attempt to grab data from cache
+ if (($data = $this->cache->fetch($cacheKey)) !== false) {
+ if (!$this->debug || $this->isCacheFresh($cacheKey, $class)) {
+ return $data;
+ }
+ }
+
+ $annots = $this->delegate->getPropertyAnnotations($property);
+ $this->cache->save($cacheKey, $annots);
+ $this->cache->save('[C]'.$cacheKey, time());
+
+ return $this->loadedAnnotations[$cacheKey] = $annots;
+ }
+
+ public function getPropertyAnnotation(\ReflectionProperty $property, $annotationName)
+ {
+ foreach ($this->getPropertyAnnotations($property) as $annot) {
+ if ($annot instanceof $annotationName) {
+ return $annot;
+ }
+ }
+
+ return null;
+ }
+
+ public function getMethodAnnotations(\ReflectionMethod $method)
+ {
+ $class = $method->getDeclaringClass();
+ $cacheKey = $class->getName().'#'.$method->getName().self::$CACHE_SALT;
+
+ if (isset($this->loadedAnnotations[$cacheKey])) {
+ return $this->loadedAnnotations[$cacheKey];
+ }
+
+ // Attempt to grab data from cache
+ if (($data = $this->cache->fetch($cacheKey)) !== false) {
+ if (!$this->debug || $this->isCacheFresh($cacheKey, $class)) {
+ return $data;
+ }
+ }
+
+ $annots = $this->delegate->getMethodAnnotations($method);
+ $this->cache->save($cacheKey, $annots);
+ $this->cache->save('[C]'.$cacheKey, time());
+
+ return $this->loadedAnnotations[$cacheKey] = $annots;
+ }
+
+ public function getMethodAnnotation(\ReflectionMethod $method, $annotationName)
+ {
+ foreach ($this->getMethodAnnotations($method) as $annot) {
+ if ($annot instanceof $annotationName) {
+ return $annot;
+ }
+ }
+
+ return null;
+ }
+
+ public function clearLoadedAnnotations()
+ {
+ $this->loadedAnnotations = array();
+ }
+
+ private function isCacheFresh($cacheKey, \ReflectionClass $class)
+ {
+ if (false === $filename = $class->getFilename()) {
+ return true;
+ }
+
+ return $this->cache->fetch('[C]'.$cacheKey) >= filemtime($filename);
+ }
+}
\ No newline at end of file
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-common/lib/Doctrine/Common/Annotations/DocLexer.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-common/lib/Doctrine/Common/Annotations/DocLexer.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,136 @@
+.
+ */
+
+namespace Doctrine\Common\Annotations;
+
+use Doctrine\Common\Lexer;
+
+/**
+ * Simple lexer for docblock annotations.
+ *
+ * @author Benjamin Eberlei
+ * @author Guilherme Blanco
+ * @author Jonathan Wage
+ * @author Roman Borschel
+ * @author Johannes M. Schmitt
+ */
+final class DocLexer extends Lexer
+{
+ const T_NONE = 1;
+ const T_IDENTIFIER = 2;
+ const T_INTEGER = 3;
+ const T_STRING = 4;
+ const T_FLOAT = 5;
+
+ const T_AT = 101;
+ const T_CLOSE_CURLY_BRACES = 102;
+ const T_CLOSE_PARENTHESIS = 103;
+ const T_COMMA = 104;
+ const T_EQUALS = 105;
+ const T_FALSE = 106;
+ const T_NAMESPACE_SEPARATOR = 107;
+ const T_OPEN_CURLY_BRACES = 108;
+ const T_OPEN_PARENTHESIS = 109;
+ const T_TRUE = 110;
+ const T_NULL = 111;
+
+ /**
+ * @inheritdoc
+ */
+ protected function getCatchablePatterns()
+ {
+ return array(
+ '[a-z_][a-z0-9_:]*',
+ '(?:[0-9]+(?:[\.][0-9]+)*)(?:e[+-]?[0-9]+)?',
+ '"(?:[^"]|"")*"',
+ );
+ }
+
+ /**
+ * @inheritdoc
+ */
+ protected function getNonCatchablePatterns()
+ {
+ return array('\s+', '\*+', '(.)');
+ }
+
+ /**
+ * @inheritdoc
+ */
+ protected function getType(&$value)
+ {
+ $type = self::T_NONE;
+
+ // Checking numeric value
+ if (is_numeric($value)) {
+ return (strpos($value, '.') !== false || stripos($value, 'e') !== false)
+ ? self::T_FLOAT : self::T_INTEGER;
+ }
+
+ if ($value[0] === '"') {
+ $value = str_replace('""', '"', substr($value, 1, strlen($value) - 2));
+
+ return self::T_STRING;
+ } else {
+ switch (strtolower($value)) {
+ case '@':
+ return self::T_AT;
+
+ case ',':
+ return self::T_COMMA;
+
+ case '(':
+ return self::T_OPEN_PARENTHESIS;
+
+ case ')':
+ return self::T_CLOSE_PARENTHESIS;
+
+ case '{':
+ return self::T_OPEN_CURLY_BRACES;
+
+ case '}':
+ return self::T_CLOSE_CURLY_BRACES;
+
+ case '=':
+ return self::T_EQUALS;
+
+ case '\\':
+ return self::T_NAMESPACE_SEPARATOR;
+
+ case 'true':
+ return self::T_TRUE;
+
+ case 'false':
+ return self::T_FALSE;
+
+ case 'null':
+ return self::T_NULL;
+
+ default:
+ if (ctype_alpha($value[0]) || $value[0] === '_') {
+ return self::T_IDENTIFIER;
+ }
+
+ break;
+ }
+ }
+
+ return $type;
+ }
+}
\ No newline at end of file
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-common/lib/Doctrine/Common/Annotations/DocParser.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-common/lib/Doctrine/Common/Annotations/DocParser.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,623 @@
+.
+ */
+
+namespace Doctrine\Common\Annotations;
+
+use Closure;
+use ReflectionClass;
+
+/**
+ * A parser for docblock annotations.
+ *
+ * It is strongly discouraged to change the default annotation parsing process.
+ *
+ * @author Benjamin Eberlei
+ * @author Guilherme Blanco
+ * @author Jonathan Wage
+ * @author Roman Borschel
+ * @author Johannes M. Schmitt
+ */
+final class DocParser
+{
+ /**
+ * An array of all valid tokens for a class name.
+ *
+ * @var array
+ */
+ private static $classIdentifiers = array(DocLexer::T_IDENTIFIER, DocLexer::T_TRUE, DocLexer::T_FALSE, DocLexer::T_NULL);
+
+ /**
+ * The lexer.
+ *
+ * @var Doctrine\Common\Annotations\DocLexer
+ */
+ private $lexer;
+
+ /**
+ * Flag to control if the current annotation is nested or not.
+ *
+ * @var boolean
+ */
+ private $isNestedAnnotation = false;
+
+ /**
+ * Hashmap containing all use-statements that are to be used when parsing
+ * the given doc block.
+ *
+ * @var array
+ */
+ private $imports = array();
+
+ /**
+ * This hashmap is used internally to cache results of class_exists()
+ * look-ups.
+ *
+ * @var array
+ */
+ private $classExists = array();
+
+ /**
+ *
+ * @var This hashmap is used internally to cache if a class is an annotation or not.
+ *
+ * @var array
+ */
+ private $isAnnotation = array();
+
+ /**
+ * Whether annotations that have not been imported should be ignored.
+ *
+ * @var boolean
+ */
+ private $ignoreNotImportedAnnotations = false;
+
+ /**
+ * A list with annotations that are not causing exceptions when not resolved to an annotation class.
+ *
+ * The names must be the raw names as used in the class, not the fully qualified
+ * class names.
+ *
+ * @var array
+ */
+ private $ignoredAnnotationNames = array();
+
+ /**
+ * @var array
+ */
+ private $namespaceAliases = array();
+
+ /**
+ * @var string
+ */
+ private $context = '';
+
+ /**
+ * @var Closure
+ */
+ private $creationFn = null;
+
+ /**
+ * Constructs a new DocParser.
+ */
+ public function __construct()
+ {
+ $this->lexer = new DocLexer;
+ }
+
+ /**
+ * Sets the annotation names that are ignored during the parsing process.
+ *
+ * The names are supposed to be the raw names as used in the class, not the
+ * fully qualified class names.
+ *
+ * @param array $names
+ */
+ public function setIgnoredAnnotationNames(array $names)
+ {
+ $this->ignoredAnnotationNames = $names;
+ }
+
+ /**
+ * @deprecated Will be removed in 3.0
+ * @param \Closure $func
+ */
+ public function setAnnotationCreationFunction(\Closure $func)
+ {
+ $this->creationFn = $func;
+ }
+
+ public function setImports(array $imports)
+ {
+ $this->imports = $imports;
+ }
+
+ public function setIgnoreNotImportedAnnotations($bool)
+ {
+ $this->ignoreNotImportedAnnotations = (Boolean) $bool;
+ }
+
+ public function setAnnotationNamespaceAlias($namespace, $alias)
+ {
+ $this->namespaceAliases[$alias] = $namespace;
+ }
+
+ /**
+ * Parses the given docblock string for annotations.
+ *
+ * @param string $input The docblock string to parse.
+ * @param string $context The parsing context.
+ * @return array Array of annotations. If no annotations are found, an empty array is returned.
+ */
+ public function parse($input, $context = '')
+ {
+ if (false === $pos = strpos($input, '@')) {
+ return array();
+ }
+
+ // also parse whatever character is before the @
+ if ($pos > 0) {
+ $pos -= 1;
+ }
+
+ $this->context = $context;
+ $this->lexer->setInput(trim(substr($input, $pos), '* /'));
+ $this->lexer->moveNext();
+
+ return $this->Annotations();
+ }
+
+ /**
+ * Attempts to match the given token with the current lookahead token.
+ * If they match, updates the lookahead token; otherwise raises a syntax error.
+ *
+ * @param int Token type.
+ * @return bool True if tokens match; false otherwise.
+ */
+ private function match($token)
+ {
+ if ( ! $this->lexer->isNextToken($token) ) {
+ $this->syntaxError($this->lexer->getLiteral($token));
+ }
+
+ return $this->lexer->moveNext();
+ }
+
+ /**
+ * Attempts to match the current lookahead token with any of the given tokens.
+ *
+ * If any of them matches, this method updates the lookahead token; otherwise
+ * a syntax error is raised.
+ *
+ * @param array $tokens
+ * @return bool
+ */
+ private function matchAny(array $tokens)
+ {
+ if ( ! $this->lexer->isNextTokenAny($tokens)) {
+ $this->syntaxError(implode(' or ', array_map(array($this->lexer, 'getLiteral'), $tokens)));
+ }
+
+ return $this->lexer->moveNext();
+ }
+
+ /**
+ * Generates a new syntax error.
+ *
+ * @param string $expected Expected string.
+ * @param array $token Optional token.
+ * @throws SyntaxException
+ */
+ private function syntaxError($expected, $token = null)
+ {
+ if ($token === null) {
+ $token = $this->lexer->lookahead;
+ }
+
+ $message = "Expected {$expected}, got ";
+
+ if ($this->lexer->lookahead === null) {
+ $message .= 'end of string';
+ } else {
+ $message .= "'{$token['value']}' at position {$token['position']}";
+ }
+
+ if (strlen($this->context)) {
+ $message .= ' in ' . $this->context;
+ }
+
+ $message .= '.';
+
+ throw AnnotationException::syntaxError($message);
+ }
+
+ /**
+ * Attempt to check if a class exists or not. This never goes through the PHP autoloading mechanism
+ * but uses the {@link AnnotationRegistry} to load classes.
+ *
+ * @param string $fqcn
+ * @return boolean
+ */
+ private function classExists($fqcn)
+ {
+ if (isset($this->classExists[$fqcn])) {
+ return $this->classExists[$fqcn];
+ }
+
+ // first check if the class already exists, maybe loaded through another AnnotationReader
+ if (class_exists($fqcn, false)) {
+ return $this->classExists[$fqcn] = true;
+ }
+
+ // final check, does this class exist?
+ return $this->classExists[$fqcn] = AnnotationRegistry::loadAnnotationClass($fqcn);
+ }
+
+ /**
+ * Annotations ::= Annotation {[ "*" ]* [Annotation]}*
+ *
+ * @return array
+ */
+ private function Annotations()
+ {
+ $annotations = array();
+
+ while (null !== $this->lexer->lookahead) {
+ if (DocLexer::T_AT !== $this->lexer->lookahead['type']) {
+ $this->lexer->moveNext();
+ continue;
+ }
+
+ // make sure the @ is preceded by non-catchable pattern
+ if (null !== $this->lexer->token && $this->lexer->lookahead['position'] === $this->lexer->token['position'] + strlen($this->lexer->token['value'])) {
+ $this->lexer->moveNext();
+ continue;
+ }
+
+ // make sure the @ is followed by either a namespace separator, or
+ // an identifier token
+ if ((null === $peek = $this->lexer->glimpse())
+ || (DocLexer::T_NAMESPACE_SEPARATOR !== $peek['type'] && !in_array($peek['type'], self::$classIdentifiers, true))
+ || $peek['position'] !== $this->lexer->lookahead['position'] + 1) {
+ $this->lexer->moveNext();
+ continue;
+ }
+
+ $this->isNestedAnnotation = false;
+ if (false !== $annot = $this->Annotation()) {
+ $annotations[] = $annot;
+ }
+ }
+
+ return $annotations;
+ }
+
+ /**
+ * Annotation ::= "@" AnnotationName ["(" [Values] ")"]
+ * AnnotationName ::= QualifiedName | SimpleName
+ * QualifiedName ::= NameSpacePart "\" {NameSpacePart "\"}* SimpleName
+ * NameSpacePart ::= identifier | null | false | true
+ * SimpleName ::= identifier | null | false | true
+ *
+ * @return mixed False if it is not a valid annotation.
+ */
+ private function Annotation()
+ {
+ $this->match(DocLexer::T_AT);
+
+ // check if we have an annotation
+ if ($this->lexer->isNextTokenAny(self::$classIdentifiers)) {
+ $this->lexer->moveNext();
+ $name = $this->lexer->token['value'];
+ } else if ($this->lexer->isNextToken(DocLexer::T_NAMESPACE_SEPARATOR)) {
+ $name = '';
+ } else {
+ $this->syntaxError('namespace separator or identifier');
+ }
+
+ while ($this->lexer->lookahead['position'] === $this->lexer->token['position'] + strlen($this->lexer->token['value']) && $this->lexer->isNextToken(DocLexer::T_NAMESPACE_SEPARATOR)) {
+ $this->match(DocLexer::T_NAMESPACE_SEPARATOR);
+ $this->matchAny(self::$classIdentifiers);
+ $name .= '\\'.$this->lexer->token['value'];
+ }
+
+ if (strpos($name, ":") !== false) {
+ list ($alias, $name) = explode(':', $name);
+ // If the namespace alias doesnt exist, skip until next annotation
+ if ( ! isset($this->namespaceAliases[$alias])) {
+ $this->lexer->skipUntil(DocLexer::T_AT);
+ return false;
+ }
+ $name = $this->namespaceAliases[$alias] . $name;
+ }
+
+ // only process names which are not fully qualified, yet
+ if ('\\' !== $name[0] && !$this->classExists($name)) {
+ $alias = (false === $pos = strpos($name, '\\'))? $name : substr($name, 0, $pos);
+
+ if (isset($this->imports[$loweredAlias = strtolower($alias)])) {
+ if (false !== $pos) {
+ $name = $this->imports[$loweredAlias].substr($name, $pos);
+ } else {
+ $name = $this->imports[$loweredAlias];
+ }
+ } elseif (isset($this->imports['__DEFAULT__']) && $this->classExists($this->imports['__DEFAULT__'].$name)) {
+ $name = $this->imports['__DEFAULT__'].$name;
+ } elseif (isset($this->imports['__NAMESPACE__']) && $this->classExists($this->imports['__NAMESPACE__'].'\\'.$name)) {
+ $name = $this->imports['__NAMESPACE__'].'\\'.$name;
+ } else {
+ if ($this->ignoreNotImportedAnnotations || isset($this->ignoredAnnotationNames[$name])) {
+ return false;
+ }
+
+ throw AnnotationException::semanticalError(sprintf('The annotation "@%s" in %s was never imported.', $name, $this->context));
+ }
+ }
+
+ if (!$this->classExists($name)) {
+ throw AnnotationException::semanticalError(sprintf('The annotation "@%s" in %s does not exist, or could not be auto-loaded.', $name, $this->context));
+ }
+
+ if (!$this->isAnnotation($name)) {
+ return false;
+ }
+
+ // Verifies that the annotation class extends any class that contains "Annotation".
+ // This is done to avoid coupling of Doctrine Annotations against other libraries.
+
+
+ // at this point, $name contains the fully qualified class name of the
+ // annotation, and it is also guaranteed that this class exists, and
+ // that it is loaded
+
+ // Next will be nested
+ $this->isNestedAnnotation = true;
+
+ $values = array();
+ if ($this->lexer->isNextToken(DocLexer::T_OPEN_PARENTHESIS)) {
+ $this->match(DocLexer::T_OPEN_PARENTHESIS);
+
+ if ( ! $this->lexer->isNextToken(DocLexer::T_CLOSE_PARENTHESIS)) {
+ $values = $this->Values();
+ }
+
+ $this->match(DocLexer::T_CLOSE_PARENTHESIS);
+ }
+
+ return $this->newAnnotation($name, $values);
+ }
+
+ /**
+ * Verify that the found class is actually an annotation.
+ *
+ * This can be detected through two mechanisms:
+ * 1. Class extends Doctrine\Common\Annotations\Annotation
+ * 2. The class level docblock contains the string "@Annotation"
+ *
+ * @param string $name
+ * @return bool
+ */
+ private function isAnnotation($name)
+ {
+ if (!isset($this->isAnnotation[$name])) {
+ if (is_subclass_of($name, 'Doctrine\Common\Annotations\Annotation')) {
+ $this->isAnnotation[$name] = true;
+ } else {
+ $reflClass = new \ReflectionClass($name);
+ $this->isAnnotation[$name] = strpos($reflClass->getDocComment(), "@Annotation") !== false;
+ }
+ }
+ return $this->isAnnotation[$name];
+ }
+
+ private function newAnnotation($name, $values)
+ {
+ if ($this->creationFn !== null) {
+ $fn = $this->creationFn;
+ return $fn($name, $values);
+ }
+
+ return new $name($values);
+ }
+
+ /**
+ * Values ::= Array | Value {"," Value}*
+ *
+ * @return array
+ */
+ private function Values()
+ {
+ $values = array();
+
+ // Handle the case of a single array as value, i.e. @Foo({....})
+ if ($this->lexer->isNextToken(DocLexer::T_OPEN_CURLY_BRACES)) {
+ $values['value'] = $this->Value();
+ return $values;
+ }
+
+ $values[] = $this->Value();
+
+ while ($this->lexer->isNextToken(DocLexer::T_COMMA)) {
+ $this->match(DocLexer::T_COMMA);
+ $token = $this->lexer->lookahead;
+ $value = $this->Value();
+
+ if ( ! is_object($value) && ! is_array($value)) {
+ $this->syntaxError('Value', $token);
+ }
+
+ $values[] = $value;
+ }
+
+ foreach ($values as $k => $value) {
+ if (is_object($value) && $value instanceof \stdClass) {
+ $values[$value->name] = $value->value;
+ } else if ( ! isset($values['value'])){
+ $values['value'] = $value;
+ } else {
+ if ( ! is_array($values['value'])) {
+ $values['value'] = array($values['value']);
+ }
+
+ $values['value'][] = $value;
+ }
+
+ unset($values[$k]);
+ }
+
+ return $values;
+ }
+
+ /**
+ * Value ::= PlainValue | FieldAssignment
+ *
+ * @return mixed
+ */
+ private function Value()
+ {
+ $peek = $this->lexer->glimpse();
+
+ if (DocLexer::T_EQUALS === $peek['type']) {
+ return $this->FieldAssignment();
+ }
+
+ return $this->PlainValue();
+ }
+
+ /**
+ * PlainValue ::= integer | string | float | boolean | Array | Annotation
+ *
+ * @return mixed
+ */
+ private function PlainValue()
+ {
+ if ($this->lexer->isNextToken(DocLexer::T_OPEN_CURLY_BRACES)) {
+ return $this->Arrayx();
+ }
+
+ if ($this->lexer->isNextToken(DocLexer::T_AT)) {
+ return $this->Annotation();
+ }
+
+ switch ($this->lexer->lookahead['type']) {
+ case DocLexer::T_STRING:
+ $this->match(DocLexer::T_STRING);
+ return $this->lexer->token['value'];
+
+ case DocLexer::T_INTEGER:
+ $this->match(DocLexer::T_INTEGER);
+ return (int)$this->lexer->token['value'];
+
+ case DocLexer::T_FLOAT:
+ $this->match(DocLexer::T_FLOAT);
+ return (float)$this->lexer->token['value'];
+
+ case DocLexer::T_TRUE:
+ $this->match(DocLexer::T_TRUE);
+ return true;
+
+ case DocLexer::T_FALSE:
+ $this->match(DocLexer::T_FALSE);
+ return false;
+
+ case DocLexer::T_NULL:
+ $this->match(DocLexer::T_NULL);
+ return null;
+
+ default:
+ $this->syntaxError('PlainValue');
+ }
+ }
+
+ /**
+ * FieldAssignment ::= FieldName "=" PlainValue
+ * FieldName ::= identifier
+ *
+ * @return array
+ */
+ private function FieldAssignment()
+ {
+ $this->match(DocLexer::T_IDENTIFIER);
+ $fieldName = $this->lexer->token['value'];
+
+ $this->match(DocLexer::T_EQUALS);
+
+ $item = new \stdClass();
+ $item->name = $fieldName;
+ $item->value = $this->PlainValue();
+
+ return $item;
+ }
+
+ /**
+ * Array ::= "{" ArrayEntry {"," ArrayEntry}* "}"
+ *
+ * @return array
+ */
+ private function Arrayx()
+ {
+ $array = $values = array();
+
+ $this->match(DocLexer::T_OPEN_CURLY_BRACES);
+ $values[] = $this->ArrayEntry();
+
+ while ($this->lexer->isNextToken(DocLexer::T_COMMA)) {
+ $this->match(DocLexer::T_COMMA);
+ $values[] = $this->ArrayEntry();
+ }
+
+ $this->match(DocLexer::T_CLOSE_CURLY_BRACES);
+
+ foreach ($values as $value) {
+ list ($key, $val) = $value;
+
+ if ($key !== null) {
+ $array[$key] = $val;
+ } else {
+ $array[] = $val;
+ }
+ }
+
+ return $array;
+ }
+
+ /**
+ * ArrayEntry ::= Value | KeyValuePair
+ * KeyValuePair ::= Key "=" PlainValue
+ * Key ::= string | integer
+ *
+ * @return array
+ */
+ private function ArrayEntry()
+ {
+ $peek = $this->lexer->glimpse();
+
+ if (DocLexer::T_EQUALS === $peek['type']) {
+ $this->match(
+ $this->lexer->isNextToken(DocLexer::T_INTEGER) ? DocLexer::T_INTEGER : DocLexer::T_STRING
+ );
+
+ $key = $this->lexer->token['value'];
+ $this->match(DocLexer::T_EQUALS);
+
+ return array($key, $this->PlainValue());
+ }
+
+ return array(null, $this->Value());
+ }
+}
\ No newline at end of file
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-common/lib/Doctrine/Common/Annotations/FileCacheReader.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-common/lib/Doctrine/Common/Annotations/FileCacheReader.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,209 @@
+.
+ */
+
+namespace Doctrine\Common\Annotations;
+
+
+/**
+ * File cache reader for annotations.
+ *
+ * @author Johannes M. Schmitt
+ * @author Benjamin Eberlei
+ */
+class FileCacheReader implements Reader
+{
+ /**
+ * @var Reader
+ */
+ private $reader;
+ private $dir;
+ private $debug;
+ private $loadedAnnotations = array();
+
+ public function __construct(Reader $reader, $cacheDir, $debug = false)
+ {
+ $this->reader = $reader;
+ if (!is_dir($cacheDir)) {
+ throw new \InvalidArgumentException(sprintf('The directory "%s" does not exist.', $cacheDir));
+ }
+ if (!is_writable($cacheDir)) {
+ throw new \InvalidArgumentException(sprintf('The directory "%s" is not writable.', $cacheDir));
+ }
+
+ $this->dir = rtrim($cacheDir, '\\/');
+ $this->debug = $debug;
+ }
+
+ public function getClassAnnotations(\ReflectionClass $class)
+ {
+ $key = $class->getName();
+
+ if (isset($this->loadedAnnotations[$key])) {
+ return $this->loadedAnnotations[$key];
+ }
+
+ $path = $this->dir.'/'.strtr($key, '\\', '-').'.cache.php';
+ if (!file_exists($path)) {
+ $annot = $this->reader->getClassAnnotations($class);
+ $this->saveCacheFile($path, $annot);
+ return $this->loadedAnnotations[$key] = $annot;
+ }
+
+ if ($this->debug
+ && (false !== $filename = $class->getFilename())
+ && filemtime($path) < filemtime($filename)) {
+ @unlink($path);
+
+ $annot = $this->reader->getClassAnnotations($class);
+ $this->saveCacheFile($path, $annot);
+ return $this->loadedAnnotations[$key] = $annot;
+ }
+
+ return $this->loadedAnnotations[$key] = include $path;
+ }
+
+ public function getPropertyAnnotations(\ReflectionProperty $property)
+ {
+ $class = $property->getDeclaringClass();
+ $key = $class->getName().'$'.$property->getName();
+
+ if (isset($this->loadedAnnotations[$key])) {
+ return $this->loadedAnnotations[$key];
+ }
+
+ $path = $this->dir.'/'.strtr($key, '\\', '-').'.cache.php';
+ if (!file_exists($path)) {
+ $annot = $this->reader->getPropertyAnnotations($property);
+ $this->saveCacheFile($path, $annot);
+ return $this->loadedAnnotations[$key] = $annot;
+ }
+
+ if ($this->debug
+ && (false !== $filename = $class->getFilename())
+ && filemtime($path) < filemtime($filename)) {
+ unlink($path);
+
+ $annot = $this->reader->getPropertyAnnotations($property);
+ $this->saveCacheFile($path, $annot);
+ return $this->loadedAnnotations[$key] = $annot;
+ }
+
+ return $this->loadedAnnotations[$key] = include $path;
+ }
+
+ public function getMethodAnnotations(\ReflectionMethod $method)
+ {
+ $class = $method->getDeclaringClass();
+ $key = $class->getName().'#'.$method->getName();
+
+ if (isset($this->loadedAnnotations[$key])) {
+ return $this->loadedAnnotations[$key];
+ }
+
+ $path = $this->dir.'/'.strtr($key, '\\', '-').'.cache.php';
+ if (!file_exists($path)) {
+ $annot = $this->reader->getMethodAnnotations($method);
+ $this->saveCacheFile($path, $annot);
+ return $this->loadedAnnotations[$key] = $annot;
+ }
+
+ if ($this->debug
+ && (false !== $filename = $class->getFilename())
+ && filemtime($path) < filemtime($filename)) {
+ unlink($path);
+
+ $annot = $this->reader->getMethodAnnotations($method);
+ $this->saveCacheFile($path, $annot);
+ return $this->loadedAnnotations[$key] = $annot;
+ }
+
+ return $this->loadedAnnotations[$key] = include $path;
+ }
+
+ private function saveCacheFile($path, $data)
+ {
+ file_put_contents($path, 'getClassAnnotations($class);
+
+ foreach ($annotations as $annotation) {
+ if ($annotation instanceof $annotationName) {
+ return $annotation;
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Gets a method annotation.
+ *
+ * @param ReflectionMethod $method
+ * @param string $annotationName The name of the annotation.
+ * @return The Annotation or NULL, if the requested annotation does not exist.
+ */
+ public function getMethodAnnotation(\ReflectionMethod $method, $annotationName)
+ {
+ $annotations = $this->getMethodAnnotations($method);
+
+ foreach ($annotations as $annotation) {
+ if ($annotation instanceof $annotationName) {
+ return $annotation;
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Gets a property annotation.
+ *
+ * @param ReflectionProperty $property
+ * @param string $annotationName The name of the annotation.
+ * @return The Annotation or NULL, if the requested annotation does not exist.
+ */
+ public function getPropertyAnnotation(\ReflectionProperty $property, $annotationName)
+ {
+ $annotations = $this->getPropertyAnnotations($property);
+
+ foreach ($annotations as $annotation) {
+ if ($annotation instanceof $annotationName) {
+ return $annotation;
+ }
+ }
+
+ return null;
+ }
+
+ public function clearLoadedAnnotations()
+ {
+ $this->loadedAnnotations = array();
+ }
+}
\ No newline at end of file
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-common/lib/Doctrine/Common/Annotations/IndexedReader.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-common/lib/Doctrine/Common/Annotations/IndexedReader.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,94 @@
+.
+ */
+
+namespace Doctrine\Common\Annotations;
+
+use Doctrine\Common\Annotations\Reader;
+
+/**
+ * Allows the reader to be used in-place of Doctrine's reader.
+ *
+ * @author Johannes M. Schmitt
+ */
+class IndexedReader implements Reader
+{
+ private $delegate;
+
+ public function __construct(Reader $reader)
+ {
+ $this->delegate = $reader;
+ }
+
+ public function getClassAnnotations(\ReflectionClass $class)
+ {
+ $annotations = array();
+ foreach ($this->delegate->getClassAnnotations($class) as $annot) {
+ $annotations[get_class($annot)] = $annot;
+ }
+
+ return $annotations;
+ }
+
+ public function getClassAnnotation(\ReflectionClass $class, $annotation)
+ {
+ return $this->delegate->getClassAnnotation($class, $annotation);
+ }
+
+ public function getMethodAnnotations(\ReflectionMethod $method)
+ {
+ $annotations = array();
+ foreach ($this->delegate->getMethodAnnotations($method) as $annot) {
+ $annotations[get_class($annot)] = $annot;
+ }
+
+ return $annotations;
+ }
+
+ public function getMethodAnnotation(\ReflectionMethod $method, $annotation)
+ {
+ return $this->delegate->getMethodAnnotation($method, $annotation);
+ }
+
+ public function getPropertyAnnotations(\ReflectionProperty $property)
+ {
+ $annotations = array();
+ foreach ($this->delegate->getPropertyAnnotations($property) as $annot) {
+ $annotations[get_class($annot)] = $annot;
+ }
+
+ return $annotations;
+ }
+
+ public function getPropertyAnnotation(\ReflectionProperty $property, $annotation)
+ {
+ return $this->delegate->getPropertyAnnotation($property, $annotation);
+ }
+
+ /**
+ * Proxy all methods to the delegate.
+ *
+ * @param type $method
+ * @param type $args
+ * @return type
+ */
+ public function __call($method, $args)
+ {
+ return call_user_func_array(array($this->delegate, $method), $args);
+ }
+}
\ No newline at end of file
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-common/lib/Doctrine/Common/Annotations/PhpParser.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-common/lib/Doctrine/Common/Annotations/PhpParser.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,152 @@
+.
+ */
+
+namespace Doctrine\Common\Annotations;
+
+/**
+ * Parses a file for namespaces/use/class declarations.
+ *
+ * @author Fabien Potencier
+ */
+final class PhpParser
+{
+ private $tokens;
+
+ /**
+ * Parses a class.
+ *
+ * @param \ReflectionClass $class
+ */
+ public function parseClass(\ReflectionClass $class)
+ {
+ if (false === $filename = $class->getFilename()) {
+ return array();
+ }
+ $src = file_get_contents($filename);
+ $name = $class->getName();
+
+ // This is a short-cut for code that follows some conventions:
+ // - namespaced
+ // - one class per file
+ if (preg_match_all('#\bnamespace\s+'.str_replace('\\', '\\\\', $class->getNamespaceName()).'\s*;.*?\b(?:class|interface)\s+'.$class->getShortName().'\b#s', $src, $matches)) {
+ foreach ($matches[0] as $match) {
+ $classes = $this->parse('parse($src, $name);
+
+ return $classes[$name];
+ }
+
+ private function parse($src, $interestedClass = null)
+ {
+ $this->tokens = token_get_all($src);
+ $classes = $uses = array();
+ $namespace = '';
+ while ($token = $this->next()) {
+ if (T_NAMESPACE === $token[0]) {
+ $namespace = $this->parseNamespace();
+ $uses = array();
+ } elseif (T_CLASS === $token[0] || T_INTERFACE === $token[0]) {
+ if ('' !== $namespace) {
+ $class = $namespace.'\\'.$this->nextValue();
+ } else {
+ $class = $this->nextValue();
+ }
+ $classes[$class] = $uses;
+
+ if (null !== $interestedClass && $interestedClass === $class) {
+ return $classes;
+ }
+ } elseif (T_USE === $token[0]) {
+ foreach ($this->parseUseStatement() as $useStatement) {
+ list($alias, $class) = $useStatement;
+ $uses[strtolower($alias)] = $class;
+ }
+ }
+ }
+
+ return $classes;
+ }
+
+ private function parseNamespace()
+ {
+ $namespace = '';
+ while ($token = $this->next()) {
+ if (T_NS_SEPARATOR === $token[0] || T_STRING === $token[0]) {
+ $namespace .= $token[1];
+ } elseif (is_string($token) && in_array($token, array(';', '{'))) {
+ return $namespace;
+ }
+ }
+ }
+
+ private function parseUseStatement()
+ {
+ $statements = $class = array();
+ $alias = '';
+ while ($token = $this->next()) {
+ if (T_NS_SEPARATOR === $token[0] || T_STRING === $token[0]) {
+ $class[] = $token[1];
+ } else if (T_AS === $token[0]) {
+ $alias = $this->nextValue();
+ } else if (is_string($token)) {
+ if (',' === $token || ';' === $token) {
+ $statements[] = array(
+ $alias ? $alias : $class[count($class) - 1],
+ implode('', $class)
+ );
+ }
+
+ if (';' === $token) {
+ return $statements;
+ }
+ if (',' === $token) {
+ $class = array();
+ $alias = '';
+
+ continue;
+ }
+ }
+ }
+ }
+
+ private function next()
+ {
+ while ($token = array_shift($this->tokens)) {
+ if (in_array($token[0], array(T_WHITESPACE, T_COMMENT, T_DOC_COMMENT))) {
+ continue;
+ }
+
+ return $token;
+ }
+ }
+
+ private function nextValue()
+ {
+ $token = $this->next();
+
+ return is_array($token) ? $token[1] : $token;
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-common/lib/Doctrine/Common/Annotations/Reader.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-common/lib/Doctrine/Common/Annotations/Reader.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,35 @@
+.
+ */
+
+namespace Doctrine\Common\Annotations;
+
+/**
+ * Interface for annotation readers.
+ *
+ * @author Johannes M. Schmitt
+ */
+interface Reader
+{
+ function getClassAnnotations(\ReflectionClass $class);
+ function getClassAnnotation(\ReflectionClass $class, $annotationName);
+ function getMethodAnnotations(\ReflectionMethod $method);
+ function getMethodAnnotation(\ReflectionMethod $method, $annotationName);
+ function getPropertyAnnotations(\ReflectionProperty $property);
+ function getPropertyAnnotation(\ReflectionProperty $property, $annotationName);
+}
\ No newline at end of file
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-common/lib/Doctrine/Common/Cache/AbstractCache.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-common/lib/Doctrine/Common/Cache/AbstractCache.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,219 @@
+.
+ */
+
+namespace Doctrine\Common\Cache;
+
+/**
+ * Base class for cache driver implementations.
+ *
+ * @since 2.0
+ * @author Benjamin Eberlei
+ * @author Guilherme Blanco
+ * @author Jonathan Wage
+ * @author Roman Borschel
+ */
+abstract class AbstractCache implements Cache
+{
+ /** @var string The namespace to prefix all cache ids with */
+ private $_namespace = '';
+
+ /**
+ * Set the namespace to prefix all cache ids with.
+ *
+ * @param string $namespace
+ * @return void
+ */
+ public function setNamespace($namespace)
+ {
+ $this->_namespace = (string) $namespace;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function fetch($id)
+ {
+ return $this->_doFetch($this->_getNamespacedId($id));
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function contains($id)
+ {
+ return $this->_doContains($this->_getNamespacedId($id));
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function save($id, $data, $lifeTime = 0)
+ {
+ return $this->_doSave($this->_getNamespacedId($id), $data, $lifeTime);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function delete($id)
+ {
+ $id = $this->_getNamespacedId($id);
+
+ if (strpos($id, '*') !== false) {
+ return $this->deleteByRegex('/' . str_replace('*', '.*', $id) . '/');
+ }
+
+ return $this->_doDelete($id);
+ }
+
+ /**
+ * Delete all cache entries.
+ *
+ * @return array $deleted Array of the deleted cache ids
+ */
+ public function deleteAll()
+ {
+ $ids = $this->getIds();
+
+ foreach ($ids as $id) {
+ $this->delete($id);
+ }
+
+ return $ids;
+ }
+
+ /**
+ * Delete cache entries where the id matches a PHP regular expressions
+ *
+ * @param string $regex
+ * @return array $deleted Array of the deleted cache ids
+ */
+ public function deleteByRegex($regex)
+ {
+ $deleted = array();
+
+ $ids = $this->getIds();
+
+ foreach ($ids as $id) {
+ if (preg_match($regex, $id)) {
+ $this->delete($id);
+ $deleted[] = $id;
+ }
+ }
+
+ return $deleted;
+ }
+
+ /**
+ * Delete cache entries where the id has the passed prefix
+ *
+ * @param string $prefix
+ * @return array $deleted Array of the deleted cache ids
+ */
+ public function deleteByPrefix($prefix)
+ {
+ $deleted = array();
+
+ $prefix = $this->_getNamespacedId($prefix);
+ $ids = $this->getIds();
+
+ foreach ($ids as $id) {
+ if (strpos($id, $prefix) === 0) {
+ $this->delete($id);
+ $deleted[] = $id;
+ }
+ }
+
+ return $deleted;
+ }
+
+ /**
+ * Delete cache entries where the id has the passed suffix
+ *
+ * @param string $suffix
+ * @return array $deleted Array of the deleted cache ids
+ */
+ public function deleteBySuffix($suffix)
+ {
+ $deleted = array();
+
+ $ids = $this->getIds();
+
+ foreach ($ids as $id) {
+ if (substr($id, -1 * strlen($suffix)) === $suffix) {
+ $this->delete($id);
+ $deleted[] = $id;
+ }
+ }
+
+ return $deleted;
+ }
+
+ /**
+ * Prefix the passed id with the configured namespace value
+ *
+ * @param string $id The id to namespace
+ * @return string $id The namespaced id
+ */
+ private function _getNamespacedId($id)
+ {
+ return $this->_namespace . $id;
+ }
+
+ /**
+ * Fetches an entry from the cache.
+ *
+ * @param string $id cache id The id of the cache entry to fetch.
+ * @return string The cached data or FALSE, if no cache entry exists for the given id.
+ */
+ abstract protected function _doFetch($id);
+
+ /**
+ * Test if an entry exists in the cache.
+ *
+ * @param string $id cache id The cache id of the entry to check for.
+ * @return boolean TRUE if a cache entry exists for the given cache id, FALSE otherwise.
+ */
+ abstract protected function _doContains($id);
+
+ /**
+ * Puts data into the cache.
+ *
+ * @param string $id The cache id.
+ * @param string $data The cache entry/data.
+ * @param int $lifeTime The lifetime. If != false, sets a specific lifetime for this cache entry (null => infinite lifeTime).
+ * @return boolean TRUE if the entry was successfully stored in the cache, FALSE otherwise.
+ */
+ abstract protected function _doSave($id, $data, $lifeTime = false);
+
+ /**
+ * Deletes a cache entry.
+ *
+ * @param string $id cache id
+ * @return boolean TRUE if the cache entry was successfully deleted, FALSE otherwise.
+ */
+ abstract protected function _doDelete($id);
+
+ /**
+ * Get an array of all the cache ids stored
+ *
+ * @return array $ids
+ */
+ abstract public function getIds();
+}
\ No newline at end of file
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-common/lib/Doctrine/Common/Cache/ApcCache.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-common/lib/Doctrine/Common/Cache/ApcCache.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,90 @@
+.
+ */
+
+namespace Doctrine\Common\Cache;
+
+/**
+ * APC cache driver.
+ *
+ * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
+ * @link www.doctrine-project.org
+ * @since 2.0
+ * @version $Revision$
+ * @author Benjamin Eberlei
+ * @author Guilherme Blanco
+ * @author Jonathan Wage
+ * @author Roman Borschel
+ * @author David Abdemoulaie
+ * @todo Rename: APCCache
+ */
+class ApcCache extends AbstractCache
+{
+ /**
+ * {@inheritdoc}
+ */
+ public function getIds()
+ {
+ $ci = apc_cache_info('user');
+ $keys = array();
+
+ foreach ($ci['cache_list'] as $entry) {
+ $keys[] = $entry['info'];
+ }
+
+ return $keys;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function _doFetch($id)
+ {
+ return apc_fetch($id);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function _doContains($id)
+ {
+ $found = false;
+
+ apc_fetch($id, $found);
+
+ return $found;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function _doSave($id, $data, $lifeTime = 0)
+ {
+ return (bool) apc_store($id, $data, (int) $lifeTime);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function _doDelete($id)
+ {
+ return apc_delete($id);
+ }
+}
\ No newline at end of file
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-common/lib/Doctrine/Common/Cache/ArrayCache.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-common/lib/Doctrine/Common/Cache/ArrayCache.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,91 @@
+.
+ */
+
+namespace Doctrine\Common\Cache;
+
+/**
+ * Array cache driver.
+ *
+ * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
+ * @link www.doctrine-project.org
+ * @since 2.0
+ * @version $Revision: 3938 $
+ * @author Benjamin Eberlei
+ * @author Guilherme Blanco
+ * @author Jonathan Wage
+ * @author Roman Borschel
+ * @author David Abdemoulaie
+ */
+class ArrayCache extends AbstractCache
+{
+ /**
+ * @var array $data
+ */
+ private $data = array();
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getIds()
+ {
+ return array_keys($this->data);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function _doFetch($id)
+ {
+ if (isset($this->data[$id])) {
+ return $this->data[$id];
+ }
+
+ return false;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function _doContains($id)
+ {
+ return isset($this->data[$id]);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function _doSave($id, $data, $lifeTime = 0)
+ {
+ $this->data[$id] = $data;
+
+ return true;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function _doDelete($id)
+ {
+ unset($this->data[$id]);
+
+ return true;
+ }
+}
\ No newline at end of file
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-common/lib/Doctrine/Common/Cache/Cache.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-common/lib/Doctrine/Common/Cache/Cache.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,71 @@
+.
+ */
+
+namespace Doctrine\Common\Cache;
+
+/**
+ * Interface for cache drivers.
+ *
+ * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
+ * @link www.doctrine-project.org
+ * @since 2.0
+ * @version $Revision: 3938 $
+ * @author Benjamin Eberlei
+ * @author Guilherme Blanco
+ * @author Jonathan Wage
+ * @author Roman Borschel
+ */
+interface Cache
+{
+ /**
+ * Fetches an entry from the cache.
+ *
+ * @param string $id cache id The id of the cache entry to fetch.
+ * @return string The cached data or FALSE, if no cache entry exists for the given id.
+ */
+ function fetch($id);
+
+ /**
+ * Test if an entry exists in the cache.
+ *
+ * @param string $id cache id The cache id of the entry to check for.
+ * @return boolean TRUE if a cache entry exists for the given cache id, FALSE otherwise.
+ */
+ function contains($id);
+
+ /**
+ * Puts data into the cache.
+ *
+ * @param string $id The cache id.
+ * @param string $data The cache entry/data.
+ * @param int $lifeTime The lifetime. If != 0, sets a specific lifetime for this cache entry (0 => infinite lifeTime).
+ * @return boolean TRUE if the entry was successfully stored in the cache, FALSE otherwise.
+ */
+ function save($id, $data, $lifeTime = 0);
+
+ /**
+ * Deletes a cache entry.
+ *
+ * @param string $id cache id
+ * @return boolean TRUE if the cache entry was successfully deleted, FALSE otherwise.
+ */
+ function delete($id);
+}
\ No newline at end of file
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-common/lib/Doctrine/Common/Cache/MemcacheCache.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-common/lib/Doctrine/Common/Cache/MemcacheCache.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,123 @@
+.
+ */
+
+namespace Doctrine\Common\Cache;
+
+use \Memcache;
+
+/**
+ * Memcache cache driver.
+ *
+ * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
+ * @link www.doctrine-project.org
+ * @since 2.0
+ * @version $Revision: 3938 $
+ * @author Benjamin Eberlei
+ * @author Guilherme Blanco
+ * @author Jonathan Wage
+ * @author Roman Borschel
+ * @author David Abdemoulaie
+ */
+class MemcacheCache extends AbstractCache
+{
+ /**
+ * @var Memcache
+ */
+ private $_memcache;
+
+ /**
+ * Sets the memcache instance to use.
+ *
+ * @param Memcache $memcache
+ */
+ public function setMemcache(Memcache $memcache)
+ {
+ $this->_memcache = $memcache;
+ }
+
+ /**
+ * Gets the memcache instance used by the cache.
+ *
+ * @return Memcache
+ */
+ public function getMemcache()
+ {
+ return $this->_memcache;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getIds()
+ {
+ $keys = array();
+ $allSlabs = $this->_memcache->getExtendedStats('slabs');
+
+ foreach ($allSlabs as $server => $slabs) {
+ if (is_array($slabs)) {
+ foreach (array_keys($slabs) as $slabId) {
+ $dump = $this->_memcache->getExtendedStats('cachedump', (int) $slabId);
+
+ if ($dump) {
+ foreach ($dump as $entries) {
+ if ($entries) {
+ $keys = array_merge($keys, array_keys($entries));
+ }
+ }
+ }
+ }
+ }
+ }
+ return $keys;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function _doFetch($id)
+ {
+ return $this->_memcache->get($id);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function _doContains($id)
+ {
+ return (bool) $this->_memcache->get($id);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function _doSave($id, $data, $lifeTime = 0)
+ {
+ return $this->_memcache->set($id, $data, 0, (int) $lifeTime);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function _doDelete($id)
+ {
+ return $this->_memcache->delete($id);
+ }
+}
\ No newline at end of file
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-common/lib/Doctrine/Common/Cache/XcacheCache.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-common/lib/Doctrine/Common/Cache/XcacheCache.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,105 @@
+.
+ */
+
+namespace Doctrine\Common\Cache;
+
+/**
+ * Xcache cache driver.
+ *
+ * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
+ * @link www.doctrine-project.org
+ * @since 2.0
+ * @version $Revision: 3938 $
+ * @author Benjamin Eberlei
+ * @author Guilherme Blanco
+ * @author Jonathan Wage
+ * @author Roman Borschel
+ * @author David Abdemoulaie
+ */
+class XcacheCache extends AbstractCache
+{
+ /**
+ * {@inheritdoc}
+ */
+ public function getIds()
+ {
+ $this->_checkAuth();
+ $keys = array();
+
+ for ($i = 0, $count = xcache_count(XC_TYPE_VAR); $i < $count; $i++) {
+ $entries = xcache_list(XC_TYPE_VAR, $i);
+
+ if (is_array($entries['cache_list'])) {
+ foreach ($entries['cache_list'] as $entry) {
+ $keys[] = $entry['name'];
+ }
+ }
+ }
+
+ return $keys;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function _doFetch($id)
+ {
+ return $this->_doContains($id) ? unserialize(xcache_get($id)) : false;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function _doContains($id)
+ {
+ return xcache_isset($id);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function _doSave($id, $data, $lifeTime = 0)
+ {
+ return xcache_set($id, serialize($data), (int) $lifeTime);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function _doDelete($id)
+ {
+ return xcache_unset($id);
+ }
+
+
+ /**
+ * Checks that xcache.admin.enable_auth is Off
+ *
+ * @throws \BadMethodCallException When xcache.admin.enable_auth is On
+ * @return void
+ */
+ protected function _checkAuth()
+ {
+ if (ini_get('xcache.admin.enable_auth')) {
+ throw new \BadMethodCallException('To use all features of \Doctrine\Common\Cache\XcacheCache, you must set "xcache.admin.enable_auth" to "Off" in your php.ini.');
+ }
+ }
+}
\ No newline at end of file
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-common/lib/Doctrine/Common/Cache/ZendDataCache.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-common/lib/Doctrine/Common/Cache/ZendDataCache.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,76 @@
+.
+ */
+
+namespace Doctrine\Common\Cache;
+
+/**
+ * Zend Data Cache cache driver.
+ *
+ * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
+ * @link www.doctrine-project.org
+ * @since 2.0
+ * @author Ralph Schindler
+ */
+class ZendDataCache extends AbstractCache
+{
+ public function __construct()
+ {
+ $this->setNamespace('doctrine::'); // zend data cache format for namespaces ends in ::
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getIds()
+ {
+ throw new \BadMethodCallException("getIds() is not supported by ZendDataCache");
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function _doFetch($id)
+ {
+ return zend_shm_cache_fetch($id);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function _doContains($id)
+ {
+ return (zend_shm_cache_fetch($id) !== FALSE);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function _doSave($id, $data, $lifeTime = 0)
+ {
+ return zend_shm_cache_store($id, $data, $lifeTime);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function _doDelete($id)
+ {
+ return zend_shm_cache_delete($id);
+ }
+}
\ No newline at end of file
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-common/lib/Doctrine/Common/ClassLoader.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-common/lib/Doctrine/Common/ClassLoader.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,261 @@
+.
+ */
+
+namespace Doctrine\Common;
+
+/**
+ * A ClassLoader is an autoloader for class files that can be
+ * installed on the SPL autoload stack. It is a class loader that either loads only classes
+ * of a specific namespace or all namespaces and it is suitable for working together
+ * with other autoloaders in the SPL autoload stack.
+ *
+ * If no include path is configured through the constructor or {@link setIncludePath}, a ClassLoader
+ * relies on the PHP include_path.
+ *
+ * @author Roman Borschel
+ * @since 2.0
+ */
+class ClassLoader
+{
+ private $fileExtension = '.php';
+ private $namespace;
+ private $includePath;
+ private $namespaceSeparator = '\\';
+
+ /**
+ * Creates a new ClassLoader that loads classes of the
+ * specified namespace from the specified include path.
+ *
+ * If no include path is given, the ClassLoader relies on the PHP include_path.
+ * If neither a namespace nor an include path is given, the ClassLoader will
+ * be responsible for loading all classes, thereby relying on the PHP include_path.
+ *
+ * @param string $ns The namespace of the classes to load.
+ * @param string $includePath The base include path to use.
+ */
+ public function __construct($ns = null, $includePath = null)
+ {
+ $this->namespace = $ns;
+ $this->includePath = $includePath;
+ }
+
+ /**
+ * Sets the namespace separator used by classes in the namespace of this ClassLoader.
+ *
+ * @param string $sep The separator to use.
+ */
+ public function setNamespaceSeparator($sep)
+ {
+ $this->namespaceSeparator = $sep;
+ }
+
+ /**
+ * Gets the namespace separator used by classes in the namespace of this ClassLoader.
+ *
+ * @return string
+ */
+ public function getNamespaceSeparator()
+ {
+ return $this->namespaceSeparator;
+ }
+
+ /**
+ * Sets the base include path for all class files in the namespace of this ClassLoader.
+ *
+ * @param string $includePath
+ */
+ public function setIncludePath($includePath)
+ {
+ $this->includePath = $includePath;
+ }
+
+ /**
+ * Gets the base include path for all class files in the namespace of this ClassLoader.
+ *
+ * @return string
+ */
+ public function getIncludePath()
+ {
+ return $this->includePath;
+ }
+
+ /**
+ * Sets the file extension of class files in the namespace of this ClassLoader.
+ *
+ * @param string $fileExtension
+ */
+ public function setFileExtension($fileExtension)
+ {
+ $this->fileExtension = $fileExtension;
+ }
+
+ /**
+ * Gets the file extension of class files in the namespace of this ClassLoader.
+ *
+ * @return string
+ */
+ public function getFileExtension()
+ {
+ return $this->fileExtension;
+ }
+
+ /**
+ * Registers this ClassLoader on the SPL autoload stack.
+ */
+ public function register()
+ {
+ spl_autoload_register(array($this, 'loadClass'));
+ }
+
+ /**
+ * Removes this ClassLoader from the SPL autoload stack.
+ */
+ public function unregister()
+ {
+ spl_autoload_unregister(array($this, 'loadClass'));
+ }
+
+ /**
+ * Loads the given class or interface.
+ *
+ * @param string $classname The name of the class to load.
+ * @return boolean TRUE if the class has been successfully loaded, FALSE otherwise.
+ */
+ public function loadClass($className)
+ {
+ if ($this->namespace !== null && strpos($className, $this->namespace.$this->namespaceSeparator) !== 0) {
+ return false;
+ }
+
+ require ($this->includePath !== null ? $this->includePath . DIRECTORY_SEPARATOR : '')
+ . str_replace($this->namespaceSeparator, DIRECTORY_SEPARATOR, $className)
+ . $this->fileExtension;
+
+ return true;
+ }
+
+ /**
+ * Asks this ClassLoader whether it can potentially load the class (file) with
+ * the given name.
+ *
+ * @param string $className The fully-qualified name of the class.
+ * @return boolean TRUE if this ClassLoader can load the class, FALSE otherwise.
+ */
+ public function canLoadClass($className)
+ {
+ if ($this->namespace !== null && strpos($className, $this->namespace.$this->namespaceSeparator) !== 0) {
+ return false;
+ }
+
+ $file = str_replace($this->namespaceSeparator, DIRECTORY_SEPARATOR, $className) . $this->fileExtension;
+
+ if ($this->includePath !== null) {
+ return file_exists($this->includePath . DIRECTORY_SEPARATOR . $file);
+ }
+
+ return self::fileExistsInIncludePath($file);
+ }
+
+ /**
+ * Checks whether a class with a given name exists. A class "exists" if it is either
+ * already defined in the current request or if there is an autoloader on the SPL
+ * autoload stack that is a) responsible for the class in question and b) is able to
+ * load a class file in which the class definition resides.
+ *
+ * If the class is not already defined, each autoloader in the SPL autoload stack
+ * is asked whether it is able to tell if the class exists. If the autoloader is
+ * a ClassLoader, {@link canLoadClass} is used, otherwise the autoload
+ * function of the autoloader is invoked and expected to return a value that
+ * evaluates to TRUE if the class (file) exists. As soon as one autoloader reports
+ * that the class exists, TRUE is returned.
+ *
+ * Note that, depending on what kinds of autoloaders are installed on the SPL
+ * autoload stack, the class (file) might already be loaded as a result of checking
+ * for its existence. This is not the case with a ClassLoader, who separates
+ * these responsibilities.
+ *
+ * @param string $className The fully-qualified name of the class.
+ * @return boolean TRUE if the class exists as per the definition given above, FALSE otherwise.
+ */
+ public static function classExists($className)
+ {
+ if (class_exists($className, false)) {
+ return true;
+ }
+
+ foreach (spl_autoload_functions() as $loader) {
+ if (is_array($loader)) { // array(???, ???)
+ if (is_object($loader[0])) {
+ if ($loader[0] instanceof ClassLoader) { // array($obj, 'methodName')
+ if ($loader[0]->canLoadClass($className)) {
+ return true;
+ }
+ } else if ($loader[0]->{$loader[1]}($className)) {
+ return true;
+ }
+ } else if ($loader[0]::$loader[1]($className)) { // array('ClassName', 'methodName')
+ return true;
+ }
+ } else if ($loader instanceof \Closure) { // function($className) {..}
+ if ($loader($className)) {
+ return true;
+ }
+ } else if (is_string($loader) && $loader($className)) { // "MyClass::loadClass"
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Gets the ClassLoader from the SPL autoload stack that is responsible
+ * for (and is able to load) the class with the given name.
+ *
+ * @param string $className The name of the class.
+ * @return The ClassLoader for the class or NULL if no such ClassLoader exists.
+ */
+ public static function getClassLoader($className)
+ {
+ foreach (spl_autoload_functions() as $loader) {
+ if (is_array($loader)
+ && $loader[0] instanceof ClassLoader
+ && $loader[0]->canLoadClass($className)
+ ) {
+ return $loader[0];
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * @param string $file The file relative path.
+ * @return boolean Whether file exists in include_path.
+ */
+ public static function fileExistsInIncludePath($file)
+ {
+ foreach (explode(PATH_SEPARATOR, get_include_path()) as $dir) {
+ if (file_exists($dir . DIRECTORY_SEPARATOR . $file)) {
+ return true;
+ }
+ }
+ return false;
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-common/lib/Doctrine/Common/Collections/ArrayCollection.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-common/lib/Doctrine/Common/Collections/ArrayCollection.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,441 @@
+.
+ */
+
+namespace Doctrine\Common\Collections;
+
+use Closure, ArrayIterator;
+
+/**
+ * An ArrayCollection is a Collection implementation that wraps a regular PHP array.
+ *
+ * @since 2.0
+ * @author Guilherme Blanco
+ * @author Jonathan Wage
+ * @author Roman Borschel
+ */
+class ArrayCollection implements Collection
+{
+ /**
+ * An array containing the entries of this collection.
+ *
+ * @var array
+ */
+ private $_elements;
+
+ /**
+ * Initializes a new ArrayCollection.
+ *
+ * @param array $elements
+ */
+ public function __construct(array $elements = array())
+ {
+ $this->_elements = $elements;
+ }
+
+ /**
+ * Gets the PHP array representation of this collection.
+ *
+ * @return array The PHP array representation of this collection.
+ */
+ public function toArray()
+ {
+ return $this->_elements;
+ }
+
+ /**
+ * Sets the internal iterator to the first element in the collection and
+ * returns this element.
+ *
+ * @return mixed
+ */
+ public function first()
+ {
+ return reset($this->_elements);
+ }
+
+ /**
+ * Sets the internal iterator to the last element in the collection and
+ * returns this element.
+ *
+ * @return mixed
+ */
+ public function last()
+ {
+ return end($this->_elements);
+ }
+
+ /**
+ * Gets the current key/index at the current internal iterator position.
+ *
+ * @return mixed
+ */
+ public function key()
+ {
+ return key($this->_elements);
+ }
+
+ /**
+ * Moves the internal iterator position to the next element.
+ *
+ * @return mixed
+ */
+ public function next()
+ {
+ return next($this->_elements);
+ }
+
+ /**
+ * Gets the element of the collection at the current internal iterator position.
+ *
+ * @return mixed
+ */
+ public function current()
+ {
+ return current($this->_elements);
+ }
+
+ /**
+ * Removes an element with a specific key/index from the collection.
+ *
+ * @param mixed $key
+ * @return mixed The removed element or NULL, if no element exists for the given key.
+ */
+ public function remove($key)
+ {
+ if (isset($this->_elements[$key])) {
+ $removed = $this->_elements[$key];
+ unset($this->_elements[$key]);
+
+ return $removed;
+ }
+
+ return null;
+ }
+
+ /**
+ * Removes the specified element from the collection, if it is found.
+ *
+ * @param mixed $element The element to remove.
+ * @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
+ */
+ public function removeElement($element)
+ {
+ $key = array_search($element, $this->_elements, true);
+
+ if ($key !== false) {
+ unset($this->_elements[$key]);
+
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * ArrayAccess implementation of offsetExists()
+ *
+ * @see containsKey()
+ */
+ public function offsetExists($offset)
+ {
+ return $this->containsKey($offset);
+ }
+
+ /**
+ * ArrayAccess implementation of offsetGet()
+ *
+ * @see get()
+ */
+ public function offsetGet($offset)
+ {
+ return $this->get($offset);
+ }
+
+ /**
+ * ArrayAccess implementation of offsetGet()
+ *
+ * @see add()
+ * @see set()
+ */
+ public function offsetSet($offset, $value)
+ {
+ if ( ! isset($offset)) {
+ return $this->add($value);
+ }
+ return $this->set($offset, $value);
+ }
+
+ /**
+ * ArrayAccess implementation of offsetUnset()
+ *
+ * @see remove()
+ */
+ public function offsetUnset($offset)
+ {
+ return $this->remove($offset);
+ }
+
+ /**
+ * Checks whether the collection contains a specific key/index.
+ *
+ * @param mixed $key The key to check for.
+ * @return boolean TRUE if the given key/index exists, FALSE otherwise.
+ */
+ public function containsKey($key)
+ {
+ return isset($this->_elements[$key]);
+ }
+
+ /**
+ * Checks whether the given element is contained in the collection.
+ * Only element values are compared, not keys. The comparison of two elements
+ * is strict, that means not only the value but also the type must match.
+ * For objects this means reference equality.
+ *
+ * @param mixed $element
+ * @return boolean TRUE if the given element is contained in the collection,
+ * FALSE otherwise.
+ */
+ public function contains($element)
+ {
+ return in_array($element, $this->_elements, true);
+ }
+
+ /**
+ * Tests for the existance of an element that satisfies the given predicate.
+ *
+ * @param Closure $p The predicate.
+ * @return boolean TRUE if the predicate is TRUE for at least one element, FALSE otherwise.
+ */
+ public function exists(Closure $p)
+ {
+ foreach ($this->_elements as $key => $element) {
+ if ($p($key, $element)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Searches for a given element and, if found, returns the corresponding key/index
+ * of that element. The comparison of two elements is strict, that means not
+ * only the value but also the type must match.
+ * For objects this means reference equality.
+ *
+ * @param mixed $element The element to search for.
+ * @return mixed The key/index of the element or FALSE if the element was not found.
+ */
+ public function indexOf($element)
+ {
+ return array_search($element, $this->_elements, true);
+ }
+
+ /**
+ * Gets the element with the given key/index.
+ *
+ * @param mixed $key The key.
+ * @return mixed The element or NULL, if no element exists for the given key.
+ */
+ public function get($key)
+ {
+ if (isset($this->_elements[$key])) {
+ return $this->_elements[$key];
+ }
+ return null;
+ }
+
+ /**
+ * Gets all keys/indexes of the collection elements.
+ *
+ * @return array
+ */
+ public function getKeys()
+ {
+ return array_keys($this->_elements);
+ }
+
+ /**
+ * Gets all elements.
+ *
+ * @return array
+ */
+ public function getValues()
+ {
+ return array_values($this->_elements);
+ }
+
+ /**
+ * Returns the number of elements in the collection.
+ *
+ * Implementation of the Countable interface.
+ *
+ * @return integer The number of elements in the collection.
+ */
+ public function count()
+ {
+ return count($this->_elements);
+ }
+
+ /**
+ * Adds/sets an element in the collection at the index / with the specified key.
+ *
+ * When the collection is a Map this is like put(key,value)/add(key,value).
+ * When the collection is a List this is like add(position,value).
+ *
+ * @param mixed $key
+ * @param mixed $value
+ */
+ public function set($key, $value)
+ {
+ $this->_elements[$key] = $value;
+ }
+
+ /**
+ * Adds an element to the collection.
+ *
+ * @param mixed $value
+ * @return boolean Always TRUE.
+ */
+ public function add($value)
+ {
+ $this->_elements[] = $value;
+ return true;
+ }
+
+ /**
+ * Checks whether the collection is empty.
+ *
+ * Note: This is preferrable over count() == 0.
+ *
+ * @return boolean TRUE if the collection is empty, FALSE otherwise.
+ */
+ public function isEmpty()
+ {
+ return ! $this->_elements;
+ }
+
+ /**
+ * Gets an iterator for iterating over the elements in the collection.
+ *
+ * @return ArrayIterator
+ */
+ public function getIterator()
+ {
+ return new ArrayIterator($this->_elements);
+ }
+
+ /**
+ * Applies the given function to each element in the collection and returns
+ * a new collection with the elements returned by the function.
+ *
+ * @param Closure $func
+ * @return Collection
+ */
+ public function map(Closure $func)
+ {
+ return new static(array_map($func, $this->_elements));
+ }
+
+ /**
+ * Returns all the elements of this collection that satisfy the predicate p.
+ * The order of the elements is preserved.
+ *
+ * @param Closure $p The predicate used for filtering.
+ * @return Collection A collection with the results of the filter operation.
+ */
+ public function filter(Closure $p)
+ {
+ return new static(array_filter($this->_elements, $p));
+ }
+
+ /**
+ * Applies the given predicate p to all elements of this collection,
+ * returning true, if the predicate yields true for all elements.
+ *
+ * @param Closure $p The predicate.
+ * @return boolean TRUE, if the predicate yields TRUE for all elements, FALSE otherwise.
+ */
+ public function forAll(Closure $p)
+ {
+ foreach ($this->_elements as $key => $element) {
+ if ( ! $p($key, $element)) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ * Partitions this collection in two collections according to a predicate.
+ * Keys are preserved in the resulting collections.
+ *
+ * @param Closure $p The predicate on which to partition.
+ * @return array An array with two elements. The first element contains the collection
+ * of elements where the predicate returned TRUE, the second element
+ * contains the collection of elements where the predicate returned FALSE.
+ */
+ public function partition(Closure $p)
+ {
+ $coll1 = $coll2 = array();
+ foreach ($this->_elements as $key => $element) {
+ if ($p($key, $element)) {
+ $coll1[$key] = $element;
+ } else {
+ $coll2[$key] = $element;
+ }
+ }
+ return array(new static($coll1), new static($coll2));
+ }
+
+ /**
+ * Returns a string representation of this object.
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return __CLASS__ . '@' . spl_object_hash($this);
+ }
+
+ /**
+ * Clears the collection.
+ */
+ public function clear()
+ {
+ $this->_elements = array();
+ }
+
+ /**
+ * Extract a slice of $length elements starting at position $offset from the Collection.
+ *
+ * If $length is null it returns all elements from $offset to the end of the Collection.
+ * Keys have to be preserved by this method. Calling this method will only return the
+ * selected slice and NOT change the elements contained in the collection slice is called on.
+ *
+ * @param int $offset
+ * @param int $length
+ * @return array
+ */
+ public function slice($offset, $length = null)
+ {
+ return array_slice($this->_elements, $offset, $length, true);
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-common/lib/Doctrine/Common/Collections/Collection.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-common/lib/Doctrine/Common/Collections/Collection.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,243 @@
+.
+ */
+
+namespace Doctrine\Common\Collections;
+
+use Closure, Countable, IteratorAggregate, ArrayAccess;
+
+/**
+ * The missing (SPL) Collection/Array/OrderedMap interface.
+ *
+ * A Collection resembles the nature of a regular PHP array. That is,
+ * it is essentially an ordered map that can also be used
+ * like a list.
+ *
+ * A Collection has an internal iterator just like a PHP array. In addition,
+ * a Collection can be iterated with external iterators, which is preferrable.
+ * To use an external iterator simply use the foreach language construct to
+ * iterate over the collection (which calls {@link getIterator()} internally) or
+ * explicitly retrieve an iterator though {@link getIterator()} which can then be
+ * used to iterate over the collection.
+ * You can not rely on the internal iterator of the collection being at a certain
+ * position unless you explicitly positioned it before. Prefer iteration with
+ * external iterators.
+ *
+ * @since 2.0
+ * @author Guilherme Blanco
+ * @author Jonathan Wage
+ * @author Roman Borschel
+ */
+interface Collection extends Countable, IteratorAggregate, ArrayAccess
+{
+ /**
+ * Adds an element at the end of the collection.
+ *
+ * @param mixed $element The element to add.
+ * @return boolean Always TRUE.
+ */
+ function add($element);
+
+ /**
+ * Clears the collection, removing all elements.
+ */
+ function clear();
+
+ /**
+ * Checks whether an element is contained in the collection.
+ * This is an O(n) operation, where n is the size of the collection.
+ *
+ * @param mixed $element The element to search for.
+ * @return boolean TRUE if the collection contains the element, FALSE otherwise.
+ */
+ function contains($element);
+
+ /**
+ * Checks whether the collection is empty (contains no elements).
+ *
+ * @return boolean TRUE if the collection is empty, FALSE otherwise.
+ */
+ function isEmpty();
+
+ /**
+ * Removes the element at the specified index from the collection.
+ *
+ * @param string|integer $key The kex/index of the element to remove.
+ * @return mixed The removed element or NULL, if the collection did not contain the element.
+ */
+ function remove($key);
+
+ /**
+ * Removes the specified element from the collection, if it is found.
+ *
+ * @param mixed $element The element to remove.
+ * @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
+ */
+ function removeElement($element);
+
+ /**
+ * Checks whether the collection contains an element with the specified key/index.
+ *
+ * @param string|integer $key The key/index to check for.
+ * @return boolean TRUE if the collection contains an element with the specified key/index,
+ * FALSE otherwise.
+ */
+ function containsKey($key);
+
+ /**
+ * Gets the element at the specified key/index.
+ *
+ * @param string|integer $key The key/index of the element to retrieve.
+ * @return mixed
+ */
+ function get($key);
+
+ /**
+ * Gets all keys/indices of the collection.
+ *
+ * @return array The keys/indices of the collection, in the order of the corresponding
+ * elements in the collection.
+ */
+ function getKeys();
+
+ /**
+ * Gets all values of the collection.
+ *
+ * @return array The values of all elements in the collection, in the order they
+ * appear in the collection.
+ */
+ function getValues();
+
+ /**
+ * Sets an element in the collection at the specified key/index.
+ *
+ * @param string|integer $key The key/index of the element to set.
+ * @param mixed $value The element to set.
+ */
+ function set($key, $value);
+
+ /**
+ * Gets a native PHP array representation of the collection.
+ *
+ * @return array
+ */
+ function toArray();
+
+ /**
+ * Sets the internal iterator to the first element in the collection and
+ * returns this element.
+ *
+ * @return mixed
+ */
+ function first();
+
+ /**
+ * Sets the internal iterator to the last element in the collection and
+ * returns this element.
+ *
+ * @return mixed
+ */
+ function last();
+
+ /**
+ * Gets the key/index of the element at the current iterator position.
+ *
+ */
+ function key();
+
+ /**
+ * Gets the element of the collection at the current iterator position.
+ *
+ */
+ function current();
+
+ /**
+ * Moves the internal iterator position to the next element.
+ *
+ */
+ function next();
+
+ /**
+ * Tests for the existence of an element that satisfies the given predicate.
+ *
+ * @param Closure $p The predicate.
+ * @return boolean TRUE if the predicate is TRUE for at least one element, FALSE otherwise.
+ */
+ function exists(Closure $p);
+
+ /**
+ * Returns all the elements of this collection that satisfy the predicate p.
+ * The order of the elements is preserved.
+ *
+ * @param Closure $p The predicate used for filtering.
+ * @return Collection A collection with the results of the filter operation.
+ */
+ function filter(Closure $p);
+
+ /**
+ * Applies the given predicate p to all elements of this collection,
+ * returning true, if the predicate yields true for all elements.
+ *
+ * @param Closure $p The predicate.
+ * @return boolean TRUE, if the predicate yields TRUE for all elements, FALSE otherwise.
+ */
+ function forAll(Closure $p);
+
+ /**
+ * Applies the given function to each element in the collection and returns
+ * a new collection with the elements returned by the function.
+ *
+ * @param Closure $func
+ * @return Collection
+ */
+ function map(Closure $func);
+
+ /**
+ * Partitions this collection in two collections according to a predicate.
+ * Keys are preserved in the resulting collections.
+ *
+ * @param Closure $p The predicate on which to partition.
+ * @return array An array with two elements. The first element contains the collection
+ * of elements where the predicate returned TRUE, the second element
+ * contains the collection of elements where the predicate returned FALSE.
+ */
+ function partition(Closure $p);
+
+ /**
+ * Gets the index/key of a given element. The comparison of two elements is strict,
+ * that means not only the value but also the type must match.
+ * For objects this means reference equality.
+ *
+ * @param mixed $element The element to search for.
+ * @return mixed The key/index of the element or FALSE if the element was not found.
+ */
+ function indexOf($element);
+
+ /**
+ * Extract a slice of $length elements starting at position $offset from the Collection.
+ *
+ * If $length is null it returns all elements from $offset to the end of the Collection.
+ * Keys have to be preserved by this method. Calling this method will only return the
+ * selected slice and NOT change the elements contained in the collection slice is called on.
+ *
+ * @param int $offset
+ * @param int $length
+ * @return array
+ */
+ public function slice($offset, $length = null);
+}
\ No newline at end of file
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-common/lib/Doctrine/Common/CommonException.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-common/lib/Doctrine/Common/CommonException.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,28 @@
+.
+ */
+
+namespace Doctrine\Common;
+
+/**
+ * Base exception class for package Doctrine\Common
+ * @author heinrich
+ *
+ */
+class CommonException extends \Exception {
+}
\ No newline at end of file
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-common/lib/Doctrine/Common/EventArgs.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-common/lib/Doctrine/Common/EventArgs.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,69 @@
+.
+ */
+
+namespace Doctrine\Common;
+
+/**
+ * EventArgs is the base class for classes containing event data.
+ *
+ * This class contains no event data. It is used by events that do not pass state
+ * information to an event handler when an event is raised. The single empty EventArgs
+ * instance can be obtained through {@link getEmptyInstance}.
+ *
+ * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
+ * @link www.doctrine-project.org
+ * @since 2.0
+ * @version $Revision: 3938 $
+ * @author Guilherme Blanco
+ * @author Jonathan Wage
+ * @author Roman Borschel
+ */
+class EventArgs
+{
+ /**
+ * @var EventArgs Single instance of EventArgs
+ * @static
+ */
+ private static $_emptyEventArgsInstance;
+
+ /**
+ * Gets the single, empty and immutable EventArgs instance.
+ *
+ * This instance will be used when events are dispatched without any parameter,
+ * like this: EventManager::dispatchEvent('eventname');
+ *
+ * The benefit from this is that only one empty instance is instantiated and shared
+ * (otherwise there would be instances for every dispatched in the abovementioned form)
+ *
+ * @see EventManager::dispatchEvent
+ * @link http://msdn.microsoft.com/en-us/library/system.eventargs.aspx
+ * @static
+ * @return EventArgs
+ */
+ public static function getEmptyInstance()
+ {
+ if ( ! self::$_emptyEventArgsInstance) {
+ self::$_emptyEventArgsInstance = new EventArgs;
+ }
+
+ return self::$_emptyEventArgsInstance;
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-common/lib/Doctrine/Common/EventManager.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-common/lib/Doctrine/Common/EventManager.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,138 @@
+.
+ */
+
+namespace Doctrine\Common;
+
+use Doctrine\Common\Events\Event;
+
+/**
+ * The EventManager is the central point of Doctrine's event listener system.
+ * Listeners are registered on the manager and events are dispatched through the
+ * manager.
+ *
+ * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
+ * @link www.doctrine-project.org
+ * @since 2.0
+ * @version $Revision: 3938 $
+ * @author Guilherme Blanco
+ * @author Jonathan Wage
+ * @author Roman Borschel
+ */
+class EventManager
+{
+ /**
+ * Map of registered listeners.
+ * =>
+ *
+ * @var array
+ */
+ private $_listeners = array();
+
+ /**
+ * Dispatches an event to all registered listeners.
+ *
+ * @param string $eventName The name of the event to dispatch. The name of the event is
+ * the name of the method that is invoked on listeners.
+ * @param EventArgs $eventArgs The event arguments to pass to the event handlers/listeners.
+ * If not supplied, the single empty EventArgs instance is used.
+ * @return boolean
+ */
+ public function dispatchEvent($eventName, EventArgs $eventArgs = null)
+ {
+ if (isset($this->_listeners[$eventName])) {
+ $eventArgs = $eventArgs === null ? EventArgs::getEmptyInstance() : $eventArgs;
+
+ foreach ($this->_listeners[$eventName] as $listener) {
+ $listener->$eventName($eventArgs);
+ }
+ }
+ }
+
+ /**
+ * Gets the listeners of a specific event or all listeners.
+ *
+ * @param string $event The name of the event.
+ * @return array The event listeners for the specified event, or all event listeners.
+ */
+ public function getListeners($event = null)
+ {
+ return $event ? $this->_listeners[$event] : $this->_listeners;
+ }
+
+ /**
+ * Checks whether an event has any registered listeners.
+ *
+ * @param string $event
+ * @return boolean TRUE if the specified event has any listeners, FALSE otherwise.
+ */
+ public function hasListeners($event)
+ {
+ return isset($this->_listeners[$event]) && $this->_listeners[$event];
+ }
+
+ /**
+ * Adds an event listener that listens on the specified events.
+ *
+ * @param string|array $events The event(s) to listen on.
+ * @param object $listener The listener object.
+ */
+ public function addEventListener($events, $listener)
+ {
+ // Picks the hash code related to that listener
+ $hash = spl_object_hash($listener);
+
+ foreach ((array) $events as $event) {
+ // Overrides listener if a previous one was associated already
+ // Prevents duplicate listeners on same event (same instance only)
+ $this->_listeners[$event][$hash] = $listener;
+ }
+ }
+
+ /**
+ * Removes an event listener from the specified events.
+ *
+ * @param string|array $events
+ * @param object $listener
+ */
+ public function removeEventListener($events, $listener)
+ {
+ // Picks the hash code related to that listener
+ $hash = spl_object_hash($listener);
+
+ foreach ((array) $events as $event) {
+ // Check if actually have this listener associated
+ if (isset($this->_listeners[$event][$hash])) {
+ unset($this->_listeners[$event][$hash]);
+ }
+ }
+ }
+
+ /**
+ * Adds an EventSubscriber. The subscriber is asked for all the events he is
+ * interested in and added as a listener for these events.
+ *
+ * @param Doctrine\Common\EventSubscriber $subscriber The subscriber.
+ */
+ public function addEventSubscriber(EventSubscriber $subscriber)
+ {
+ $this->addEventListener($subscriber->getSubscribedEvents(), $subscriber);
+ }
+}
\ No newline at end of file
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-common/lib/Doctrine/Common/EventSubscriber.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-common/lib/Doctrine/Common/EventSubscriber.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,45 @@
+.
+ */
+
+namespace Doctrine\Common;
+
+/**
+ * An EventSubscriber knows himself what events he is interested in.
+ * If an EventSubscriber is added to an EventManager, the manager invokes
+ * {@link getSubscribedEvents} and registers the subscriber as a listener for all
+ * returned events.
+ *
+ * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
+ * @link www.doctrine-project.org
+ * @since 2.0
+ * @author Guilherme Blanco
+ * @author Jonathan Wage
+ * @author Roman Borschel
+ */
+interface EventSubscriber
+{
+ /**
+ * Returns an array of events this subscriber wants to listen to.
+ *
+ * @return array
+ */
+ public function getSubscribedEvents();
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-common/lib/Doctrine/Common/Lexer.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-common/lib/Doctrine/Common/Lexer.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,266 @@
+.
+ */
+
+namespace Doctrine\Common;
+
+/**
+ * Base class for writing simple lexers, i.e. for creating small DSLs.
+ *
+ * @since 2.0
+ * @author Guilherme Blanco
+ * @author Jonathan Wage
+ * @author Roman Borschel
+ * @todo Rename: AbstractLexer
+ */
+abstract class Lexer
+{
+ /**
+ * @var array Array of scanned tokens
+ */
+ private $tokens = array();
+
+ /**
+ * @var integer Current lexer position in input string
+ */
+ private $position = 0;
+
+ /**
+ * @var integer Current peek of current lexer position
+ */
+ private $peek = 0;
+
+ /**
+ * @var array The next token in the input.
+ */
+ public $lookahead;
+
+ /**
+ * @var array The last matched/seen token.
+ */
+ public $token;
+
+ /**
+ * Sets the input data to be tokenized.
+ *
+ * The Lexer is immediately reset and the new input tokenized.
+ * Any unprocessed tokens from any previous input are lost.
+ *
+ * @param string $input The input to be tokenized.
+ */
+ public function setInput($input)
+ {
+ $this->tokens = array();
+ $this->reset();
+ $this->scan($input);
+ }
+
+ /**
+ * Resets the lexer.
+ */
+ public function reset()
+ {
+ $this->lookahead = null;
+ $this->token = null;
+ $this->peek = 0;
+ $this->position = 0;
+ }
+
+ /**
+ * Resets the peek pointer to 0.
+ */
+ public function resetPeek()
+ {
+ $this->peek = 0;
+ }
+
+ /**
+ * Resets the lexer position on the input to the given position.
+ *
+ * @param integer $position Position to place the lexical scanner
+ */
+ public function resetPosition($position = 0)
+ {
+ $this->position = $position;
+ }
+
+ /**
+ * Checks whether a given token matches the current lookahead.
+ *
+ * @param integer|string $token
+ * @return boolean
+ */
+ public function isNextToken($token)
+ {
+ return null !== $this->lookahead && $this->lookahead['type'] === $token;
+ }
+
+ /**
+ * Checks whether any of the given tokens matches the current lookahead
+ *
+ * @param array $tokens
+ * @return boolean
+ */
+ public function isNextTokenAny(array $tokens)
+ {
+ return null !== $this->lookahead && in_array($this->lookahead['type'], $tokens, true);
+ }
+
+ /**
+ * Moves to the next token in the input string.
+ *
+ * A token is an associative array containing three items:
+ * - 'value' : the string value of the token in the input string
+ * - 'type' : the type of the token (identifier, numeric, string, input
+ * parameter, none)
+ * - 'position' : the position of the token in the input string
+ *
+ * @return array|null the next token; null if there is no more tokens left
+ */
+ public function moveNext()
+ {
+ $this->peek = 0;
+ $this->token = $this->lookahead;
+ $this->lookahead = (isset($this->tokens[$this->position]))
+ ? $this->tokens[$this->position++] : null;
+
+ return $this->lookahead !== null;
+ }
+
+ /**
+ * Tells the lexer to skip input tokens until it sees a token with the given value.
+ *
+ * @param $type The token type to skip until.
+ */
+ public function skipUntil($type)
+ {
+ while ($this->lookahead !== null && $this->lookahead['type'] !== $type) {
+ $this->moveNext();
+ }
+ }
+
+ /**
+ * Checks if given value is identical to the given token
+ *
+ * @param mixed $value
+ * @param integer $token
+ * @return boolean
+ */
+ public function isA($value, $token)
+ {
+ return $this->getType($value) === $token;
+ }
+
+ /**
+ * Moves the lookahead token forward.
+ *
+ * @return array | null The next token or NULL if there are no more tokens ahead.
+ */
+ public function peek()
+ {
+ if (isset($this->tokens[$this->position + $this->peek])) {
+ return $this->tokens[$this->position + $this->peek++];
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Peeks at the next token, returns it and immediately resets the peek.
+ *
+ * @return array|null The next token or NULL if there are no more tokens ahead.
+ */
+ public function glimpse()
+ {
+ $peek = $this->peek();
+ $this->peek = 0;
+ return $peek;
+ }
+
+ /**
+ * Scans the input string for tokens.
+ *
+ * @param string $input a query string
+ */
+ protected function scan($input)
+ {
+ static $regex;
+
+ if ( ! isset($regex)) {
+ $regex = '/(' . implode(')|(', $this->getCatchablePatterns()) . ')|'
+ . implode('|', $this->getNonCatchablePatterns()) . '/i';
+ }
+
+ $flags = PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_OFFSET_CAPTURE;
+ $matches = preg_split($regex, $input, -1, $flags);
+
+ foreach ($matches as $match) {
+ // Must remain before 'value' assignment since it can change content
+ $type = $this->getType($match[0]);
+
+ $this->tokens[] = array(
+ 'value' => $match[0],
+ 'type' => $type,
+ 'position' => $match[1],
+ );
+ }
+ }
+
+ /**
+ * Gets the literal for a given token.
+ *
+ * @param integer $token
+ * @return string
+ */
+ public function getLiteral($token)
+ {
+ $className = get_class($this);
+ $reflClass = new \ReflectionClass($className);
+ $constants = $reflClass->getConstants();
+
+ foreach ($constants as $name => $value) {
+ if ($value === $token) {
+ return $className . '::' . $name;
+ }
+ }
+
+ return $token;
+ }
+
+ /**
+ * Lexical catchable patterns.
+ *
+ * @return array
+ */
+ abstract protected function getCatchablePatterns();
+
+ /**
+ * Lexical non-catchable patterns.
+ *
+ * @return array
+ */
+ abstract protected function getNonCatchablePatterns();
+
+ /**
+ * Retrieve token type. Also processes the token value if necessary.
+ *
+ * @param string $value
+ * @return integer
+ */
+ abstract protected function getType(&$value);
+}
\ No newline at end of file
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-common/lib/Doctrine/Common/NotifyPropertyChanged.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-common/lib/Doctrine/Common/NotifyPropertyChanged.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,45 @@
+.
+ */
+
+namespace Doctrine\Common;
+
+/**
+ * Contract for classes that provide the service of notifying listeners of
+ * changes to their properties.
+ *
+ * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
+ * @link www.doctrine-project.org
+ * @since 2.0
+ * @version $Revision: 3938 $
+ * @author Guilherme Blanco
+ * @author Jonathan Wage
+ * @author Roman Borschel
+ */
+interface NotifyPropertyChanged
+{
+ /**
+ * Adds a listener that wants to be notified about property changes.
+ *
+ * @param PropertyChangedListener $listener
+ */
+ function addPropertyChangedListener(PropertyChangedListener $listener);
+}
+
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-common/lib/Doctrine/Common/Persistence/Mapping/ClassMetadata.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-common/lib/Doctrine/Common/Persistence/Mapping/ClassMetadata.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,132 @@
+.
+ */
+
+namespace Doctrine\Common\Persistence\Mapping;
+
+/**
+ * Contract for a Doctrine persistence layer ClassMetadata class to implement.
+ *
+ * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
+ * @link www.doctrine-project.org
+ * @since 2.1
+ * @author Benjamin Eberlei
+ * @author Jonathan Wage
+ */
+interface ClassMetadata
+{
+ /**
+ * Get fully-qualified class name of this persistent class.
+ *
+ * @return string
+ */
+ public function getName();
+
+ /**
+ * Gets the mapped identifier field name.
+ *
+ * The returned structure is an array of the identifier field names.
+ *
+ * @return array
+ */
+ public function getIdentifier();
+
+ /**
+ * Gets the ReflectionClass instance for this mapped class.
+ *
+ * @return ReflectionClass
+ */
+ public function getReflectionClass();
+
+ /**
+ * Checks if the given field name is a mapped identifier for this class.
+ *
+ * @param string $fieldName
+ * @return boolean
+ */
+ public function isIdentifier($fieldName);
+
+ /**
+ * Checks if the given field is a mapped property for this class.
+ *
+ * @param string $fieldName
+ * @return boolean
+ */
+ public function hasField($fieldName);
+
+ /**
+ * Checks if the given field is a mapped association for this class.
+ *
+ * @param string $fieldName
+ * @return boolean
+ */
+ public function hasAssociation($fieldName);
+
+ /**
+ * Checks if the given field is a mapped single valued association for this class.
+ *
+ * @param string $fieldName
+ * @return boolean
+ */
+ public function isSingleValuedAssociation($fieldName);
+
+ /**
+ * Checks if the given field is a mapped collection valued association for this class.
+ *
+ * @param string $fieldName
+ * @return boolean
+ */
+ public function isCollectionValuedAssociation($fieldName);
+
+ /**
+ * A numerically indexed list of field names of this persistent class.
+ *
+ * This array includes identifier fields if present on this class.
+ *
+ * @return array
+ */
+ public function getFieldNames();
+
+ /**
+ * A numerically indexed list of association names of this persistent class.
+ *
+ * This array includes identifier associations if present on this class.
+ *
+ * @return array
+ */
+ public function getAssociationNames();
+
+ /**
+ * Returns a type name of this field.
+ *
+ * This type names can be implementation specific but should at least include the php types:
+ * integer, string, boolean, float/double, datetime.
+ *
+ * @param string $fieldName
+ * @return string
+ */
+ public function getTypeOfField($fieldName);
+
+ /**
+ * Returns the target class name of the given association.
+ *
+ * @param string $assocName
+ * @return string
+ */
+ public function getAssociationTargetClass($assocName);
+}
\ No newline at end of file
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-common/lib/Doctrine/Common/Persistence/Mapping/ClassMetadataFactory.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-common/lib/Doctrine/Common/Persistence/Mapping/ClassMetadataFactory.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,64 @@
+.
+ */
+
+namespace Doctrine\Common\Persistence\Mapping;
+
+/**
+ * Contract for a Doctrine persistence layer ClassMetadata class to implement.
+ *
+ * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
+ * @link www.doctrine-project.org
+ * @since 2.1
+ * @author Benjamin Eberlei
+ * @author Jonathan Wage
+ */
+interface ClassMetadataFactory
+{
+ /**
+ * Forces the factory to load the metadata of all classes known to the underlying
+ * mapping driver.
+ *
+ * @return array The ClassMetadata instances of all mapped classes.
+ */
+ public function getAllMetadata();
+
+ /**
+ * Gets the class metadata descriptor for a class.
+ *
+ * @param string $className The name of the class.
+ * @return Doctrine\ODM\MongoDB\Mapping\ClassMetadata
+ */
+ public function getMetadataFor($className);
+
+ /**
+ * Checks whether the factory has the metadata for a class loaded already.
+ *
+ * @param string $className
+ * @return boolean TRUE if the metadata of the class in question is already loaded, FALSE otherwise.
+ */
+ public function hasMetadataFor($className);
+
+ /**
+ * Sets the metadata descriptor for a specific class.
+ *
+ * @param string $className
+ * @param ClassMetadata $class
+ */
+ public function setMetadataFor($className, $class);
+}
\ No newline at end of file
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-common/lib/Doctrine/Common/Persistence/ObjectManager.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-common/lib/Doctrine/Common/Persistence/ObjectManager.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,125 @@
+.
+ */
+
+namespace Doctrine\Common\Persistence;
+
+/**
+ * Contract for a Doctrine persistence layer ObjectManager class to implement.
+ *
+ * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
+ * @link www.doctrine-project.org
+ * @since 2.1
+ * @author Benjamin Eberlei
+ * @author Jonathan Wage
+ */
+interface ObjectManager
+{
+ /**
+ * Finds a object by its identifier.
+ *
+ * This is just a convenient shortcut for getRepository($className)->find($id).
+ *
+ * @param string
+ * @param mixed
+ * @return object
+ */
+ public function find($className, $id);
+
+ /**
+ * Tells the ObjectManager to make an instance managed and persistent.
+ *
+ * The object will be entered into the database as a result of the flush operation.
+ *
+ * NOTE: The persist operation always considers objects that are not yet known to
+ * this ObjectManager as NEW. Do not pass detached objects to the persist operation.
+ *
+ * @param object $object The instance to make managed and persistent.
+ */
+ public function persist($object);
+
+ /**
+ * Removes an object instance.
+ *
+ * A removed object will be removed from the database as a result of the flush operation.
+ *
+ * @param object $object The object instance to remove.
+ */
+ public function remove($object);
+
+ /**
+ * Merges the state of a detached object into the persistence context
+ * of this ObjectManager and returns the managed copy of the object.
+ * The object passed to merge will not become associated/managed with this ObjectManager.
+ *
+ * @param object $object
+ */
+ public function merge($object);
+
+ /**
+ * Detaches an object from the ObjectManager, causing a managed object to
+ * become detached. Unflushed changes made to the object if any
+ * (including removal of the object), will not be synchronized to the database.
+ * Objects which previously referenced the detached object will continue to
+ * reference it.
+ *
+ * @param object $object The object to detach.
+ */
+ public function detach($object);
+
+ /**
+ * Refreshes the persistent state of an object from the database,
+ * overriding any local changes that have not yet been persisted.
+ *
+ * @param object $object The object to refresh.
+ */
+ public function refresh($object);
+
+ /**
+ * Flushes all changes to objects that have been queued up to now to the database.
+ * This effectively synchronizes the in-memory state of managed objects with the
+ * database.
+ */
+ public function flush();
+
+ /**
+ * Gets the repository for a class.
+ *
+ * @param string $className
+ * @return \Doctrine\Common\Persistence\ObjectRepository
+ */
+ public function getRepository($className);
+
+ /**
+ * Returns the ClassMetadata descriptor for a class.
+ *
+ * The class name must be the fully-qualified class name without a leading backslash
+ * (as it is returned by get_class($obj)).
+ *
+ * @param string $className
+ * @return \Doctrine\Common\Persistence\Mapping\ClassMetadata
+ */
+ public function getClassMetadata($className);
+
+ /**
+ * Gets the metadata factory used to gather the metadata of classes.
+ *
+ * @return Doctrine\Common\Persistence\Mapping\ClassMetadataFactory
+ */
+ public function getMetadataFactory();
+}
\ No newline at end of file
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-common/lib/Doctrine/Common/Persistence/ObjectRepository.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-common/lib/Doctrine/Common/Persistence/ObjectRepository.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,71 @@
+.
+ */
+
+namespace Doctrine\Common\Persistence;
+
+/**
+ * Contract for a Doctrine persistence layer ObjectRepository class to implement.
+ *
+ * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
+ * @link www.doctrine-project.org
+ * @since 2.1
+ * @author Benjamin Eberlei
+ * @author Jonathan Wage
+ */
+interface ObjectRepository
+{
+ /**
+ * Finds an object by its primary key / identifier.
+ *
+ * @param $id The identifier.
+ * @return object The object.
+ */
+ public function find($id);
+
+ /**
+ * Finds all objects in the repository.
+ *
+ * @return mixed The objects.
+ */
+ public function findAll();
+
+ /**
+ * Finds objects by a set of criteria.
+ *
+ * Optionally sorting and limiting details can be passed. An implementation may throw
+ * an UnexpectedValueException if certain values of the sorting or limiting details are
+ * not supported.
+ *
+ * @throws UnexpectedValueException
+ * @param array $criteria
+ * @param array|null $orderBy
+ * @param int|null $limit
+ * @param int|null $offset
+ * @return mixed The objects.
+ */
+ public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null);
+
+ /**
+ * Finds a single object by a set of criteria.
+ *
+ * @param array $criteria
+ * @return object The object.
+ */
+ public function findOneBy(array $criteria);
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-common/lib/Doctrine/Common/PropertyChangedListener.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-common/lib/Doctrine/Common/PropertyChangedListener.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,48 @@
+.
+ */
+
+namespace Doctrine\Common;
+
+/**
+ * Contract for classes that are potential listeners of a NotifyPropertyChanged
+ * implementor.
+ *
+ * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
+ * @link www.doctrine-project.org
+ * @since 2.0
+ * @version $Revision: 3938 $
+ * @author Guilherme Blanco
+ * @author Jonathan Wage
+ * @author Roman Borschel
+ */
+interface PropertyChangedListener
+{
+ /**
+ * Notifies the listener of a property change.
+ *
+ * @param object $sender The object on which the property changed.
+ * @param string $propertyName The name of the property that changed.
+ * @param mixed $oldValue The old value of the property that changed.
+ * @param mixed $newValue The new value of the property that changed.
+ */
+ function propertyChanged($sender, $propertyName, $oldValue, $newValue);
+}
+
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-common/lib/Doctrine/Common/Util/Debug.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-common/lib/Doctrine/Common/Util/Debug.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,136 @@
+.
+ */
+
+namespace Doctrine\Common\Util;
+
+/**
+ * Static class containing most used debug methods.
+ *
+ * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
+ * @link www.doctrine-project.org
+ * @since 2.0
+ * @version $Revision: 3938 $
+ * @author Guilherme Blanco
+ * @author Jonathan Wage
+ * @author Roman Borschel
+ * @author Giorgio Sironi
+ */
+final class Debug
+{
+ /**
+ * Private constructor (prevents from instantiation)
+ *
+ */
+ private function __construct() {}
+
+ /**
+ * Prints a dump of the public, protected and private properties of $var.
+ *
+ * @static
+ * @link http://xdebug.org/
+ * @param mixed $var
+ * @param integer $maxDepth Maximum nesting level for object properties
+ */
+ public static function dump($var, $maxDepth = 2)
+ {
+ ini_set('html_errors', 'On');
+
+ if (extension_loaded('xdebug')) {
+ ini_set('xdebug.var_display_max_depth', $maxDepth);
+ }
+
+ $var = self::export($var, $maxDepth++);
+
+ ob_start();
+ var_dump($var);
+ $dump = ob_get_contents();
+ ob_end_clean();
+
+ echo strip_tags(html_entity_decode($dump));
+
+ ini_set('html_errors', 'Off');
+ }
+
+ public static function export($var, $maxDepth)
+ {
+ $return = null;
+ $isObj = is_object($var);
+
+ if ($isObj && in_array('Doctrine\Common\Collections\Collection', class_implements($var))) {
+ $var = $var->toArray();
+ }
+
+ if ($maxDepth) {
+ if (is_array($var)) {
+ $return = array();
+
+ foreach ($var as $k => $v) {
+ $return[$k] = self::export($v, $maxDepth - 1);
+ }
+ } else if ($isObj) {
+ if ($var instanceof \DateTime) {
+ $return = $var->format('c');
+ } else {
+ $reflClass = new \ReflectionClass(get_class($var));
+ $return = new \stdclass();
+ $return->{'__CLASS__'} = get_class($var);
+
+ if ($var instanceof \Doctrine\ORM\Proxy\Proxy && ! $var->__isInitialized__) {
+ $reflProperty = $reflClass->getProperty('_identifier');
+ $reflProperty->setAccessible(true);
+
+ foreach ($reflProperty->getValue($var) as $name => $value) {
+ $return->$name = self::export($value, $maxDepth - 1);
+ }
+ } else {
+ $excludeProperties = array();
+
+ if ($var instanceof \Doctrine\ORM\Proxy\Proxy) {
+ $excludeProperties = array('_entityPersister', '__isInitialized__', '_identifier');
+ }
+
+ foreach ($reflClass->getProperties() as $reflProperty) {
+ $name = $reflProperty->getName();
+
+ if ( ! in_array($name, $excludeProperties)) {
+ $reflProperty->setAccessible(true);
+
+ $return->$name = self::export($reflProperty->getValue($var), $maxDepth - 1);
+ }
+ }
+ }
+ }
+ } else {
+ $return = $var;
+ }
+ } else {
+ $return = is_object($var) ? get_class($var)
+ : (is_array($var) ? 'Array(' . count($var) . ')' : $var);
+ }
+
+ return $return;
+ }
+
+ public static function toString($obj)
+ {
+ return method_exists('__toString', $obj) ? (string) $obj : get_class($obj) . '@' . spl_object_hash($obj);
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-common/lib/Doctrine/Common/Util/Inflector.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-common/lib/Doctrine/Common/Util/Inflector.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,72 @@
+.
+ */
+
+namespace Doctrine\Common\Util;
+
+/**
+ * Doctrine inflector has static methods for inflecting text
+ *
+ * The methods in these classes are from several different sources collected
+ * across several different php projects and several different authors. The
+ * original author names and emails are not known
+ *
+ * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
+ * @link www.doctrine-project.org
+ * @since 1.0
+ * @version $Revision: 3189 $
+ * @author Konsta Vesterinen
+ * @author Jonathan H. Wage
+ */
+class Inflector
+{
+ /**
+ * Convert word in to the format for a Doctrine table name. Converts 'ModelName' to 'model_name'
+ *
+ * @param string $word Word to tableize
+ * @return string $word Tableized word
+ */
+ public static function tableize($word)
+ {
+ return strtolower(preg_replace('~(?<=\\w)([A-Z])~', '_$1', $word));
+ }
+
+ /**
+ * Convert a word in to the format for a Doctrine class name. Converts 'table_name' to 'TableName'
+ *
+ * @param string $word Word to classify
+ * @return string $word Classified word
+ */
+ public static function classify($word)
+ {
+ return str_replace(" ", "", ucwords(strtr($word, "_-", " ")));
+ }
+
+ /**
+ * Camelize a word. This uses the classify() method and turns the first character to lowercase
+ *
+ * @param string $word
+ * @return string $word
+ */
+ public static function camelize($word)
+ {
+ return lcfirst(self::classify($word));
+ }
+}
\ No newline at end of file
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-common/lib/Doctrine/Common/Version.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-common/lib/Doctrine/Common/Version.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,55 @@
+.
+ */
+
+namespace Doctrine\Common;
+
+/**
+ * Class to store and retrieve the version of Doctrine
+ *
+ * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
+ * @link www.doctrine-project.org
+ * @since 2.0
+ * @version $Revision$
+ * @author Benjamin Eberlei
+ * @author Guilherme Blanco
+ * @author Jonathan Wage
+ * @author Roman Borschel
+ */
+class Version
+{
+ /**
+ * Current Doctrine Version
+ */
+ const VERSION = '2.1.1';
+
+ /**
+ * Compares a Doctrine version with the current one.
+ *
+ * @param string $version Doctrine version to compare.
+ * @return int Returns -1 if older, 0 if it is the same, 1 if version
+ * passed as argument is newer.
+ */
+ public static function compare($version)
+ {
+ $currentVersion = str_replace(' ', '', strtolower(self::VERSION));
+ $version = str_replace(' ', '', $version);
+
+ return version_compare($version, $currentVersion);
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-common/phpunit.xml.dist
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-common/phpunit.xml.dist Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,31 @@
+
+
+
+
+
+ ./tests/Doctrine/
+
+
+
+
+
+ ./lib/Doctrine/
+
+
+
+
+
+ performance
+
+
+
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-dbal/LICENSE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-dbal/LICENSE Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,504 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+ When we speak of free software, we are referring to freedom of use,
+not price. Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+ To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+ Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+ Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License. This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License. We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+ When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+ We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less
+of an advantage over competing non-free programs. These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+ For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard. To achieve this, non-free programs must be
+allowed to use the library. A more frequent case is that a free
+library does the same job as widely used non-free libraries. In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+ In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software. For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+ Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+ 6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ d) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ e) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ , 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
+
+
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-dbal/lib/Doctrine/DBAL/Configuration.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-dbal/lib/Doctrine/DBAL/Configuration.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,64 @@
+.
+ */
+
+namespace Doctrine\DBAL;
+
+use Doctrine\DBAL\Logging\SQLLogger;
+
+/**
+ * Configuration container for the Doctrine DBAL.
+ *
+ * @since 2.0
+ * @author Guilherme Blanco
+ * @author Jonathan Wage
+ * @author Roman Borschel
+ * @internal When adding a new configuration option just write a getter/setter
+ * pair and add the option to the _attributes array with a proper default value.
+ */
+class Configuration
+{
+ /**
+ * The attributes that are contained in the configuration.
+ * Values are default values.
+ *
+ * @var array
+ */
+ protected $_attributes = array();
+
+ /**
+ * Sets the SQL logger to use. Defaults to NULL which means SQL logging is disabled.
+ *
+ * @param SQLLogger $logger
+ */
+ public function setSQLLogger(SQLLogger $logger = null)
+ {
+ $this->_attributes['sqlLogger'] = $logger;
+ }
+
+ /**
+ * Gets the SQL logger that is used.
+ *
+ * @return SQLLogger
+ */
+ public function getSQLLogger()
+ {
+ return isset($this->_attributes['sqlLogger']) ?
+ $this->_attributes['sqlLogger'] : null;
+ }
+}
\ No newline at end of file
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-dbal/lib/Doctrine/DBAL/Connection.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-dbal/lib/Doctrine/DBAL/Connection.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,1118 @@
+.
+ */
+
+namespace Doctrine\DBAL;
+
+use PDO, Closure, Exception,
+ Doctrine\DBAL\Types\Type,
+ Doctrine\DBAL\Driver\Connection as DriverConnection,
+ Doctrine\Common\EventManager,
+ Doctrine\DBAL\DBALException;
+
+/**
+ * A wrapper around a Doctrine\DBAL\Driver\Connection that adds features like
+ * events, transaction isolation levels, configuration, emulated transaction nesting,
+ * lazy connecting and more.
+ *
+ * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
+ * @link www.doctrine-project.org
+ * @since 2.0
+ * @author Guilherme Blanco
+ * @author Jonathan Wage
+ * @author Roman Borschel
+ * @author Konsta Vesterinen
+ * @author Lukas Smith (MDB2 library)
+ * @author Benjamin Eberlei
+ */
+class Connection implements DriverConnection
+{
+ /**
+ * Constant for transaction isolation level READ UNCOMMITTED.
+ */
+ const TRANSACTION_READ_UNCOMMITTED = 1;
+
+ /**
+ * Constant for transaction isolation level READ COMMITTED.
+ */
+ const TRANSACTION_READ_COMMITTED = 2;
+
+ /**
+ * Constant for transaction isolation level REPEATABLE READ.
+ */
+ const TRANSACTION_REPEATABLE_READ = 3;
+
+ /**
+ * Constant for transaction isolation level SERIALIZABLE.
+ */
+ const TRANSACTION_SERIALIZABLE = 4;
+
+ /**
+ * Represents an array of ints to be expanded by Doctrine SQL parsing.
+ *
+ * @var int
+ */
+ const PARAM_INT_ARRAY = 101;
+
+ /**
+ * Represents an array of strings to be expanded by Doctrine SQL parsing.
+ *
+ * @var int
+ */
+ const PARAM_STR_ARRAY = 102;
+
+ /**
+ * Offset by which PARAM_* constants are detected as arrays of the param type.
+ *
+ * @var int
+ */
+ const ARRAY_PARAM_OFFSET = 100;
+
+ /**
+ * The wrapped driver connection.
+ *
+ * @var Doctrine\DBAL\Driver\Connection
+ */
+ protected $_conn;
+
+ /**
+ * @var Doctrine\DBAL\Configuration
+ */
+ protected $_config;
+
+ /**
+ * @var Doctrine\Common\EventManager
+ */
+ protected $_eventManager;
+
+ /**
+ * @var Doctrine\DBAL\Query\ExpressionBuilder
+ */
+ protected $_expr;
+
+ /**
+ * Whether or not a connection has been established.
+ *
+ * @var boolean
+ */
+ private $_isConnected = false;
+
+ /**
+ * The transaction nesting level.
+ *
+ * @var integer
+ */
+ private $_transactionNestingLevel = 0;
+
+ /**
+ * The currently active transaction isolation level.
+ *
+ * @var integer
+ */
+ private $_transactionIsolationLevel;
+
+ /**
+ * If nested transations should use savepoints
+ *
+ * @var integer
+ */
+ private $_nestTransactionsWithSavepoints;
+
+ /**
+ * The parameters used during creation of the Connection instance.
+ *
+ * @var array
+ */
+ private $_params = array();
+
+ /**
+ * The DatabasePlatform object that provides information about the
+ * database platform used by the connection.
+ *
+ * @var Doctrine\DBAL\Platforms\AbstractPlatform
+ */
+ protected $_platform;
+
+ /**
+ * The schema manager.
+ *
+ * @var Doctrine\DBAL\Schema\SchemaManager
+ */
+ protected $_schemaManager;
+
+ /**
+ * The used DBAL driver.
+ *
+ * @var Doctrine\DBAL\Driver
+ */
+ protected $_driver;
+
+ /**
+ * Flag that indicates whether the current transaction is marked for rollback only.
+ *
+ * @var boolean
+ */
+ private $_isRollbackOnly = false;
+
+ /**
+ * Initializes a new instance of the Connection class.
+ *
+ * @param array $params The connection parameters.
+ * @param Driver $driver
+ * @param Configuration $config
+ * @param EventManager $eventManager
+ */
+ public function __construct(array $params, Driver $driver, Configuration $config = null,
+ EventManager $eventManager = null)
+ {
+ $this->_driver = $driver;
+ $this->_params = $params;
+
+ if (isset($params['pdo'])) {
+ $this->_conn = $params['pdo'];
+ $this->_isConnected = true;
+ }
+
+ // Create default config and event manager if none given
+ if ( ! $config) {
+ $config = new Configuration();
+ }
+
+ if ( ! $eventManager) {
+ $eventManager = new EventManager();
+ }
+
+ $this->_config = $config;
+ $this->_eventManager = $eventManager;
+
+ $this->_expr = new Query\Expression\ExpressionBuilder($this);
+
+ if ( ! isset($params['platform'])) {
+ $this->_platform = $driver->getDatabasePlatform();
+ } else if ($params['platform'] instanceof Platforms\AbstractPlatform) {
+ $this->_platform = $params['platform'];
+ } else {
+ throw DBALException::invalidPlatformSpecified();
+ }
+
+ $this->_transactionIsolationLevel = $this->_platform->getDefaultTransactionIsolationLevel();
+ }
+
+ /**
+ * Gets the parameters used during instantiation.
+ *
+ * @return array $params
+ */
+ public function getParams()
+ {
+ return $this->_params;
+ }
+
+ /**
+ * Gets the name of the database this Connection is connected to.
+ *
+ * @return string $database
+ */
+ public function getDatabase()
+ {
+ return $this->_driver->getDatabase($this);
+ }
+
+ /**
+ * Gets the hostname of the currently connected database.
+ *
+ * @return string
+ */
+ public function getHost()
+ {
+ return isset($this->_params['host']) ? $this->_params['host'] : null;
+ }
+
+ /**
+ * Gets the port of the currently connected database.
+ *
+ * @return mixed
+ */
+ public function getPort()
+ {
+ return isset($this->_params['port']) ? $this->_params['port'] : null;
+ }
+
+ /**
+ * Gets the username used by this connection.
+ *
+ * @return string
+ */
+ public function getUsername()
+ {
+ return isset($this->_params['user']) ? $this->_params['user'] : null;
+ }
+
+ /**
+ * Gets the password used by this connection.
+ *
+ * @return string
+ */
+ public function getPassword()
+ {
+ return isset($this->_params['password']) ? $this->_params['password'] : null;
+ }
+
+ /**
+ * Gets the DBAL driver instance.
+ *
+ * @return Doctrine\DBAL\Driver
+ */
+ public function getDriver()
+ {
+ return $this->_driver;
+ }
+
+ /**
+ * Gets the Configuration used by the Connection.
+ *
+ * @return Doctrine\DBAL\Configuration
+ */
+ public function getConfiguration()
+ {
+ return $this->_config;
+ }
+
+ /**
+ * Gets the EventManager used by the Connection.
+ *
+ * @return Doctrine\Common\EventManager
+ */
+ public function getEventManager()
+ {
+ return $this->_eventManager;
+ }
+
+ /**
+ * Gets the DatabasePlatform for the connection.
+ *
+ * @return Doctrine\DBAL\Platforms\AbstractPlatform
+ */
+ public function getDatabasePlatform()
+ {
+ return $this->_platform;
+ }
+
+ /**
+ * Gets the ExpressionBuilder for the connection.
+ *
+ * @return Doctrine\DBAL\Query\ExpressionBuilder
+ */
+ public function getExpressionBuilder()
+ {
+ return $this->_expr;
+ }
+
+ /**
+ * Establishes the connection with the database.
+ *
+ * @return boolean TRUE if the connection was successfully established, FALSE if
+ * the connection is already open.
+ */
+ public function connect()
+ {
+ if ($this->_isConnected) return false;
+
+ $driverOptions = isset($this->_params['driverOptions']) ?
+ $this->_params['driverOptions'] : array();
+ $user = isset($this->_params['user']) ? $this->_params['user'] : null;
+ $password = isset($this->_params['password']) ?
+ $this->_params['password'] : null;
+
+ $this->_conn = $this->_driver->connect($this->_params, $user, $password, $driverOptions);
+ $this->_isConnected = true;
+
+ if ($this->_eventManager->hasListeners(Events::postConnect)) {
+ $eventArgs = new Event\ConnectionEventArgs($this);
+ $this->_eventManager->dispatchEvent(Events::postConnect, $eventArgs);
+ }
+
+ return true;
+ }
+
+ /**
+ * Prepares and executes an SQL query and returns the first row of the result
+ * as an associative array.
+ *
+ * @param string $statement The SQL query.
+ * @param array $params The query parameters.
+ * @return array
+ */
+ public function fetchAssoc($statement, array $params = array())
+ {
+ return $this->executeQuery($statement, $params)->fetch(PDO::FETCH_ASSOC);
+ }
+
+ /**
+ * Prepares and executes an SQL query and returns the first row of the result
+ * as a numerically indexed array.
+ *
+ * @param string $statement sql query to be executed
+ * @param array $params prepared statement params
+ * @return array
+ */
+ public function fetchArray($statement, array $params = array())
+ {
+ return $this->executeQuery($statement, $params)->fetch(PDO::FETCH_NUM);
+ }
+
+ /**
+ * Prepares and executes an SQL query and returns the value of a single column
+ * of the first row of the result.
+ *
+ * @param string $statement sql query to be executed
+ * @param array $params prepared statement params
+ * @param int $colnum 0-indexed column number to retrieve
+ * @return mixed
+ */
+ public function fetchColumn($statement, array $params = array(), $colnum = 0)
+ {
+ return $this->executeQuery($statement, $params)->fetchColumn($colnum);
+ }
+
+ /**
+ * Whether an actual connection to the database is established.
+ *
+ * @return boolean
+ */
+ public function isConnected()
+ {
+ return $this->_isConnected;
+ }
+
+ /**
+ * Checks whether a transaction is currently active.
+ *
+ * @return boolean TRUE if a transaction is currently active, FALSE otherwise.
+ */
+ public function isTransactionActive()
+ {
+ return $this->_transactionNestingLevel > 0;
+ }
+
+ /**
+ * Executes an SQL DELETE statement on a table.
+ *
+ * @param string $table The name of the table on which to delete.
+ * @param array $identifier The deletion criteria. An associateve array containing column-value pairs.
+ * @return integer The number of affected rows.
+ */
+ public function delete($tableName, array $identifier)
+ {
+ $this->connect();
+
+ $criteria = array();
+
+ foreach (array_keys($identifier) as $columnName) {
+ $criteria[] = $columnName . ' = ?';
+ }
+
+ $query = 'DELETE FROM ' . $tableName . ' WHERE ' . implode(' AND ', $criteria);
+
+ return $this->executeUpdate($query, array_values($identifier));
+ }
+
+ /**
+ * Closes the connection.
+ *
+ * @return void
+ */
+ public function close()
+ {
+ unset($this->_conn);
+
+ $this->_isConnected = false;
+ }
+
+ /**
+ * Sets the transaction isolation level.
+ *
+ * @param integer $level The level to set.
+ */
+ public function setTransactionIsolation($level)
+ {
+ $this->_transactionIsolationLevel = $level;
+
+ return $this->executeUpdate($this->_platform->getSetTransactionIsolationSQL($level));
+ }
+
+ /**
+ * Gets the currently active transaction isolation level.
+ *
+ * @return integer The current transaction isolation level.
+ */
+ public function getTransactionIsolation()
+ {
+ return $this->_transactionIsolationLevel;
+ }
+
+ /**
+ * Executes an SQL UPDATE statement on a table.
+ *
+ * @param string $table The name of the table to update.
+ * @param array $identifier The update criteria. An associative array containing column-value pairs.
+ * @return integer The number of affected rows.
+ */
+ public function update($tableName, array $data, array $identifier)
+ {
+ $this->connect();
+ $set = array();
+ foreach ($data as $columnName => $value) {
+ $set[] = $columnName . ' = ?';
+ }
+
+ $params = array_merge(array_values($data), array_values($identifier));
+
+ $sql = 'UPDATE ' . $tableName . ' SET ' . implode(', ', $set)
+ . ' WHERE ' . implode(' = ? AND ', array_keys($identifier))
+ . ' = ?';
+
+ return $this->executeUpdate($sql, $params);
+ }
+
+ /**
+ * Inserts a table row with specified data.
+ *
+ * @param string $table The name of the table to insert data into.
+ * @param array $data An associative array containing column-value pairs.
+ * @return integer The number of affected rows.
+ */
+ public function insert($tableName, array $data)
+ {
+ $this->connect();
+
+ // column names are specified as array keys
+ $cols = array();
+ $placeholders = array();
+
+ foreach ($data as $columnName => $value) {
+ $cols[] = $columnName;
+ $placeholders[] = '?';
+ }
+
+ $query = 'INSERT INTO ' . $tableName
+ . ' (' . implode(', ', $cols) . ')'
+ . ' VALUES (' . implode(', ', $placeholders) . ')';
+
+ return $this->executeUpdate($query, array_values($data));
+ }
+
+ /**
+ * Sets the given charset on the current connection.
+ *
+ * @param string $charset The charset to set.
+ */
+ public function setCharset($charset)
+ {
+ $this->executeUpdate($this->_platform->getSetCharsetSQL($charset));
+ }
+
+ /**
+ * Quote a string so it can be safely used as a table or column name, even if
+ * it is a reserved name.
+ *
+ * Delimiting style depends on the underlying database platform that is being used.
+ *
+ * NOTE: Just because you CAN use quoted identifiers does not mean
+ * you SHOULD use them. In general, they end up causing way more
+ * problems than they solve.
+ *
+ * @param string $str The name to be quoted.
+ * @return string The quoted name.
+ */
+ public function quoteIdentifier($str)
+ {
+ return $this->_platform->quoteIdentifier($str);
+ }
+
+ /**
+ * Quotes a given input parameter.
+ *
+ * @param mixed $input Parameter to be quoted.
+ * @param string $type Type of the parameter.
+ * @return string The quoted parameter.
+ */
+ public function quote($input, $type = null)
+ {
+ $this->connect();
+
+ return $this->_conn->quote($input, $type);
+ }
+
+ /**
+ * Prepares and executes an SQL query and returns the result as an associative array.
+ *
+ * @param string $sql The SQL query.
+ * @param array $params The query parameters.
+ * @return array
+ */
+ public function fetchAll($sql, array $params = array())
+ {
+ return $this->executeQuery($sql, $params)->fetchAll(PDO::FETCH_ASSOC);
+ }
+
+ /**
+ * Prepares an SQL statement.
+ *
+ * @param string $statement The SQL statement to prepare.
+ * @return Doctrine\DBAL\Driver\Statement The prepared statement.
+ */
+ public function prepare($statement)
+ {
+ $this->connect();
+
+ return new Statement($statement, $this);
+ }
+
+ /**
+ * Executes an, optionally parameterized, SQL query.
+ *
+ * If the query is parameterized, a prepared statement is used.
+ * If an SQLLogger is configured, the execution is logged.
+ *
+ * @param string $query The SQL query to execute.
+ * @param array $params The parameters to bind to the query, if any.
+ * @return Doctrine\DBAL\Driver\Statement The executed statement.
+ * @internal PERF: Directly prepares a driver statement, not a wrapper.
+ */
+ public function executeQuery($query, array $params = array(), $types = array())
+ {
+ $this->connect();
+
+ $hasLogger = $this->_config->getSQLLogger() !== null;
+ if ($hasLogger) {
+ $this->_config->getSQLLogger()->startQuery($query, $params, $types);
+ }
+
+ if ($params) {
+ list($query, $params, $types) = SQLParserUtils::expandListParameters($query, $params, $types);
+
+ $stmt = $this->_conn->prepare($query);
+ if ($types) {
+ $this->_bindTypedValues($stmt, $params, $types);
+ $stmt->execute();
+ } else {
+ $stmt->execute($params);
+ }
+ } else {
+ $stmt = $this->_conn->query($query);
+ }
+
+ if ($hasLogger) {
+ $this->_config->getSQLLogger()->stopQuery();
+ }
+
+ return $stmt;
+ }
+
+ /**
+ * Executes an, optionally parameterized, SQL query and returns the result,
+ * applying a given projection/transformation function on each row of the result.
+ *
+ * @param string $query The SQL query to execute.
+ * @param array $params The parameters, if any.
+ * @param Closure $mapper The transformation function that is applied on each row.
+ * The function receives a single paramater, an array, that
+ * represents a row of the result set.
+ * @return mixed The projected result of the query.
+ */
+ public function project($query, array $params, Closure $function)
+ {
+ $result = array();
+ $stmt = $this->executeQuery($query, $params ?: array());
+
+ while ($row = $stmt->fetch()) {
+ $result[] = $function($row);
+ }
+
+ $stmt->closeCursor();
+
+ return $result;
+ }
+
+ /**
+ * Executes an SQL statement, returning a result set as a Statement object.
+ *
+ * @param string $statement
+ * @param integer $fetchType
+ * @return Doctrine\DBAL\Driver\Statement
+ */
+ public function query()
+ {
+ $this->connect();
+
+ $args = func_get_args();
+
+ $logger = $this->getConfiguration()->getSQLLogger();
+ if ($logger) {
+ $logger->startQuery($args[0]);
+ }
+
+ $statement = call_user_func_array(array($this->_conn, 'query'), $args);
+
+ if ($logger) {
+ $logger->stopQuery();
+ }
+
+ return $statement;
+ }
+
+ /**
+ * Executes an SQL INSERT/UPDATE/DELETE query with the given parameters
+ * and returns the number of affected rows.
+ *
+ * This method supports PDO binding types as well as DBAL mapping types.
+ *
+ * @param string $query The SQL query.
+ * @param array $params The query parameters.
+ * @param array $types The parameter types.
+ * @return integer The number of affected rows.
+ * @internal PERF: Directly prepares a driver statement, not a wrapper.
+ */
+ public function executeUpdate($query, array $params = array(), array $types = array())
+ {
+ $this->connect();
+
+ $hasLogger = $this->_config->getSQLLogger() !== null;
+ if ($hasLogger) {
+ $this->_config->getSQLLogger()->startQuery($query, $params, $types);
+ }
+
+ if ($params) {
+ list($query, $params, $types) = SQLParserUtils::expandListParameters($query, $params, $types);
+
+ $stmt = $this->_conn->prepare($query);
+ if ($types) {
+ $this->_bindTypedValues($stmt, $params, $types);
+ $stmt->execute();
+ } else {
+ $stmt->execute($params);
+ }
+ $result = $stmt->rowCount();
+ } else {
+ $result = $this->_conn->exec($query);
+ }
+
+ if ($hasLogger) {
+ $this->_config->getSQLLogger()->stopQuery();
+ }
+
+ return $result;
+ }
+
+ /**
+ * Execute an SQL statement and return the number of affected rows.
+ *
+ * @param string $statement
+ * @return integer The number of affected rows.
+ */
+ public function exec($statement)
+ {
+ $this->connect();
+ return $this->_conn->exec($statement);
+ }
+
+ /**
+ * Returns the current transaction nesting level.
+ *
+ * @return integer The nesting level. A value of 0 means there's no active transaction.
+ */
+ public function getTransactionNestingLevel()
+ {
+ return $this->_transactionNestingLevel;
+ }
+
+ /**
+ * Fetch the SQLSTATE associated with the last database operation.
+ *
+ * @return integer The last error code.
+ */
+ public function errorCode()
+ {
+ $this->connect();
+ return $this->_conn->errorCode();
+ }
+
+ /**
+ * Fetch extended error information associated with the last database operation.
+ *
+ * @return array The last error information.
+ */
+ public function errorInfo()
+ {
+ $this->connect();
+ return $this->_conn->errorInfo();
+ }
+
+ /**
+ * Returns the ID of the last inserted row, or the last value from a sequence object,
+ * depending on the underlying driver.
+ *
+ * Note: This method may not return a meaningful or consistent result across different drivers,
+ * because the underlying database may not even support the notion of AUTO_INCREMENT/IDENTITY
+ * columns or sequences.
+ *
+ * @param string $seqName Name of the sequence object from which the ID should be returned.
+ * @return string A string representation of the last inserted ID.
+ */
+ public function lastInsertId($seqName = null)
+ {
+ $this->connect();
+ return $this->_conn->lastInsertId($seqName);
+ }
+
+ /**
+ * Executes a function in a transaction.
+ *
+ * The function gets passed this Connection instance as an (optional) parameter.
+ *
+ * If an exception occurs during execution of the function or transaction commit,
+ * the transaction is rolled back and the exception re-thrown.
+ *
+ * @param Closure $func The function to execute transactionally.
+ */
+ public function transactional(Closure $func)
+ {
+ $this->beginTransaction();
+ try {
+ $func($this);
+ $this->commit();
+ } catch (Exception $e) {
+ $this->rollback();
+ throw $e;
+ }
+ }
+
+ /**
+ * Set if nested transactions should use savepoints
+ *
+ * @param boolean
+ * @return void
+ */
+ public function setNestTransactionsWithSavepoints($nestTransactionsWithSavepoints)
+ {
+ if ($this->_transactionNestingLevel > 0) {
+ throw ConnectionException::mayNotAlterNestedTransactionWithSavepointsInTransaction();
+ }
+
+ if (!$this->_platform->supportsSavepoints()) {
+ throw ConnectionException::savepointsNotSupported();
+ }
+
+ $this->_nestTransactionsWithSavepoints = $nestTransactionsWithSavepoints;
+ }
+
+ /**
+ * Get if nested transactions should use savepoints
+ *
+ * @return boolean
+ */
+ public function getNestTransactionsWithSavepoints()
+ {
+ return $this->_nestTransactionsWithSavepoints;
+ }
+
+ /**
+ * Returns the savepoint name to use for nested transactions are false if they are not supported
+ * "savepointFormat" parameter is not set
+ *
+ * @return mixed a string with the savepoint name or false
+ */
+ protected function _getNestedTransactionSavePointName()
+ {
+ return 'DOCTRINE2_SAVEPOINT_'.$this->_transactionNestingLevel;
+ }
+
+ /**
+ * Starts a transaction by suspending auto-commit mode.
+ *
+ * @return void
+ */
+ public function beginTransaction()
+ {
+ $this->connect();
+
+ ++$this->_transactionNestingLevel;
+
+ if ($this->_transactionNestingLevel == 1) {
+ $this->_conn->beginTransaction();
+ } else if ($this->_nestTransactionsWithSavepoints) {
+ $this->createSavepoint($this->_getNestedTransactionSavePointName());
+ }
+ }
+
+ /**
+ * Commits the current transaction.
+ *
+ * @return void
+ * @throws ConnectionException If the commit failed due to no active transaction or
+ * because the transaction was marked for rollback only.
+ */
+ public function commit()
+ {
+ if ($this->_transactionNestingLevel == 0) {
+ throw ConnectionException::noActiveTransaction();
+ }
+ if ($this->_isRollbackOnly) {
+ throw ConnectionException::commitFailedRollbackOnly();
+ }
+
+ $this->connect();
+
+ if ($this->_transactionNestingLevel == 1) {
+ $this->_conn->commit();
+ } else if ($this->_nestTransactionsWithSavepoints) {
+ $this->releaseSavepoint($this->_getNestedTransactionSavePointName());
+ }
+
+ --$this->_transactionNestingLevel;
+ }
+
+ /**
+ * Cancel any database changes done during the current transaction.
+ *
+ * this method can be listened with onPreTransactionRollback and onTransactionRollback
+ * eventlistener methods
+ *
+ * @throws ConnectionException If the rollback operation failed.
+ */
+ public function rollback()
+ {
+ if ($this->_transactionNestingLevel == 0) {
+ throw ConnectionException::noActiveTransaction();
+ }
+
+ $this->connect();
+
+ if ($this->_transactionNestingLevel == 1) {
+ $this->_transactionNestingLevel = 0;
+ $this->_conn->rollback();
+ $this->_isRollbackOnly = false;
+ } else if ($this->_nestTransactionsWithSavepoints) {
+ $this->rollbackSavepoint($this->_getNestedTransactionSavePointName());
+ --$this->_transactionNestingLevel;
+ } else {
+ $this->_isRollbackOnly = true;
+ --$this->_transactionNestingLevel;
+ }
+ }
+
+ /**
+ * createSavepoint
+ * creates a new savepoint
+ *
+ * @param string $savepoint name of a savepoint to set
+ * @return void
+ */
+ public function createSavepoint($savepoint)
+ {
+ if (!$this->_platform->supportsSavepoints()) {
+ throw ConnectionException::savepointsNotSupported();
+ }
+
+ $this->_conn->exec($this->_platform->createSavePoint($savepoint));
+ }
+
+ /**
+ * releaseSavePoint
+ * releases given savepoint
+ *
+ * @param string $savepoint name of a savepoint to release
+ * @return void
+ */
+ public function releaseSavepoint($savepoint)
+ {
+ if (!$this->_platform->supportsSavepoints()) {
+ throw ConnectionException::savepointsNotSupported();
+ }
+
+ if ($this->_platform->supportsReleaseSavepoints()) {
+ $this->_conn->exec($this->_platform->releaseSavePoint($savepoint));
+ }
+ }
+
+ /**
+ * rollbackSavePoint
+ * releases given savepoint
+ *
+ * @param string $savepoint name of a savepoint to rollback to
+ * @return void
+ */
+ public function rollbackSavepoint($savepoint)
+ {
+ if (!$this->_platform->supportsSavepoints()) {
+ throw ConnectionException::savepointsNotSupported();
+ }
+
+ $this->_conn->exec($this->_platform->rollbackSavePoint($savepoint));
+ }
+
+ /**
+ * Gets the wrapped driver connection.
+ *
+ * @return Doctrine\DBAL\Driver\Connection
+ */
+ public function getWrappedConnection()
+ {
+ $this->connect();
+
+ return $this->_conn;
+ }
+
+ /**
+ * Gets the SchemaManager that can be used to inspect or change the
+ * database schema through the connection.
+ *
+ * @return Doctrine\DBAL\Schema\SchemaManager
+ */
+ public function getSchemaManager()
+ {
+ if ( ! $this->_schemaManager) {
+ $this->_schemaManager = $this->_driver->getSchemaManager($this);
+ }
+
+ return $this->_schemaManager;
+ }
+
+ /**
+ * Marks the current transaction so that the only possible
+ * outcome for the transaction to be rolled back.
+ *
+ * @throws ConnectionException If no transaction is active.
+ */
+ public function setRollbackOnly()
+ {
+ if ($this->_transactionNestingLevel == 0) {
+ throw ConnectionException::noActiveTransaction();
+ }
+ $this->_isRollbackOnly = true;
+ }
+
+ /**
+ * Check whether the current transaction is marked for rollback only.
+ *
+ * @return boolean
+ * @throws ConnectionException If no transaction is active.
+ */
+ public function isRollbackOnly()
+ {
+ if ($this->_transactionNestingLevel == 0) {
+ throw ConnectionException::noActiveTransaction();
+ }
+ return $this->_isRollbackOnly;
+ }
+
+ /**
+ * Converts a given value to its database representation according to the conversion
+ * rules of a specific DBAL mapping type.
+ *
+ * @param mixed $value The value to convert.
+ * @param string $type The name of the DBAL mapping type.
+ * @return mixed The converted value.
+ */
+ public function convertToDatabaseValue($value, $type)
+ {
+ return Type::getType($type)->convertToDatabaseValue($value, $this->_platform);
+ }
+
+ /**
+ * Converts a given value to its PHP representation according to the conversion
+ * rules of a specific DBAL mapping type.
+ *
+ * @param mixed $value The value to convert.
+ * @param string $type The name of the DBAL mapping type.
+ * @return mixed The converted type.
+ */
+ public function convertToPHPValue($value, $type)
+ {
+ return Type::getType($type)->convertToPHPValue($value, $this->_platform);
+ }
+
+ /**
+ * Binds a set of parameters, some or all of which are typed with a PDO binding type
+ * or DBAL mapping type, to a given statement.
+ *
+ * @param $stmt The statement to bind the values to.
+ * @param array $params The map/list of named/positional parameters.
+ * @param array $types The parameter types (PDO binding types or DBAL mapping types).
+ * @internal Duck-typing used on the $stmt parameter to support driver statements as well as
+ * raw PDOStatement instances.
+ */
+ private function _bindTypedValues($stmt, array $params, array $types)
+ {
+ // Check whether parameters are positional or named. Mixing is not allowed, just like in PDO.
+ if (is_int(key($params))) {
+ // Positional parameters
+ $typeOffset = array_key_exists(0, $types) ? -1 : 0;
+ $bindIndex = 1;
+ foreach ($params as $position => $value) {
+ $typeIndex = $bindIndex + $typeOffset;
+ if (isset($types[$typeIndex])) {
+ $type = $types[$typeIndex];
+ if (is_string($type)) {
+ $type = Type::getType($type);
+ }
+ if ($type instanceof Type) {
+ $value = $type->convertToDatabaseValue($value, $this->_platform);
+ $bindingType = $type->getBindingType();
+ } else {
+ $bindingType = $type; // PDO::PARAM_* constants
+ }
+ $stmt->bindValue($bindIndex, $value, $bindingType);
+ } else {
+ $stmt->bindValue($bindIndex, $value);
+ }
+ ++$bindIndex;
+ }
+ } else {
+ // Named parameters
+ foreach ($params as $name => $value) {
+ if (isset($types[$name])) {
+ $type = $types[$name];
+ if (is_string($type)) {
+ $type = Type::getType($type);
+ }
+ if ($type instanceof Type) {
+ $value = $type->convertToDatabaseValue($value, $this->_platform);
+ $bindingType = $type->getBindingType();
+ } else {
+ $bindingType = $type; // PDO::PARAM_* constants
+ }
+ $stmt->bindValue($name, $value, $bindingType);
+ } else {
+ $stmt->bindValue($name, $value);
+ }
+ }
+ }
+ }
+
+ /**
+ * Create a new instance of a SQL query builder.
+ *
+ * @return Query\QueryBuilder
+ */
+ public function createQueryBuilder()
+ {
+ return new Query\QueryBuilder($this);
+ }
+}
\ No newline at end of file
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-dbal/lib/Doctrine/DBAL/ConnectionException.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-dbal/lib/Doctrine/DBAL/ConnectionException.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,54 @@
+.
+ */
+
+namespace Doctrine\DBAL;
+
+/**
+ * Doctrine\DBAL\ConnectionException
+ *
+ * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
+ * @link www.doctrine-project.org
+ * @since 2.0
+ * @version $Revision: 4628 $
+ * @author Jonathan H. Wage .
+ */
+
+namespace Doctrine\DBAL;
+
+/**
+ * Driver interface.
+ * Interface that all DBAL drivers must implement.
+ *
+ * @since 2.0
+ */
+interface Driver
+{
+ /**
+ * Attempts to create a connection with the database.
+ *
+ * @param array $params All connection parameters passed by the user.
+ * @param string $username The username to use when connecting.
+ * @param string $password The password to use when connecting.
+ * @param array $driverOptions The driver options to use when connecting.
+ * @return Doctrine\DBAL\Driver\Connection The database connection.
+ */
+ public function connect(array $params, $username = null, $password = null, array $driverOptions = array());
+
+ /**
+ * Gets the DatabasePlatform instance that provides all the metadata about
+ * the platform this driver connects to.
+ *
+ * @return Doctrine\DBAL\Platforms\AbstractPlatform The database platform.
+ */
+ public function getDatabasePlatform();
+
+ /**
+ * Gets the SchemaManager that can be used to inspect and change the underlying
+ * database schema of the platform this driver connects to.
+ *
+ * @param Doctrine\DBAL\Connection $conn
+ * @return Doctrine\DBAL\SchemaManager
+ */
+ public function getSchemaManager(Connection $conn);
+
+ /**
+ * Gets the name of the driver.
+ *
+ * @return string The name of the driver.
+ */
+ public function getName();
+
+ /**
+ * Get the name of the database connected to for this driver.
+ *
+ * @param Doctrine\DBAL\Connection $conn
+ * @return string $database
+ */
+ public function getDatabase(Connection $conn);
+}
\ No newline at end of file
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-dbal/lib/Doctrine/DBAL/Driver/Connection.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-dbal/lib/Doctrine/DBAL/Driver/Connection.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,42 @@
+.
+ */
+
+namespace Doctrine\DBAL\Driver;
+
+/**
+ * Connection interface.
+ * Driver connections must implement this interface.
+ *
+ * This resembles (a subset of) the PDO interface.
+ *
+ * @since 2.0
+ */
+interface Connection
+{
+ function prepare($prepareString);
+ function query();
+ function quote($input, $type=\PDO::PARAM_STR);
+ function exec($statement);
+ function lastInsertId($name = null);
+ function beginTransaction();
+ function commit();
+ function rollBack();
+ function errorCode();
+ function errorInfo();
+}
\ No newline at end of file
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-dbal/lib/Doctrine/DBAL/Driver/IBMDB2/DB2Connection.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-dbal/lib/Doctrine/DBAL/Driver/IBMDB2/DB2Connection.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,115 @@
+.
+*/
+
+namespace Doctrine\DBAL\Driver\IBMDB2;
+
+class DB2Connection implements \Doctrine\DBAL\Driver\Connection
+{
+ private $_conn = null;
+
+ public function __construct(array $params, $username, $password, $driverOptions = array())
+ {
+ $isPersistant = (isset($params['persistent']) && $params['persistent'] == true);
+
+ if ($isPersistant) {
+ $this->_conn = db2_pconnect($params['dbname'], $username, $password, $driverOptions);
+ } else {
+ $this->_conn = db2_connect($params['dbname'], $username, $password, $driverOptions);
+ }
+ if (!$this->_conn) {
+ throw new DB2Exception(db2_conn_errormsg());
+ }
+ }
+
+ function prepare($sql)
+ {
+ $stmt = @db2_prepare($this->_conn, $sql);
+ if (!$stmt) {
+ throw new DB2Exception(db2_stmt_errormsg());
+ }
+ return new DB2Statement($stmt);
+ }
+
+ function query()
+ {
+ $args = func_get_args();
+ $sql = $args[0];
+ $stmt = $this->prepare($sql);
+ $stmt->execute();
+ return $stmt;
+ }
+
+ function quote($input, $type=\PDO::PARAM_STR)
+ {
+ $input = db2_escape_string($input);
+ if ($type == \PDO::PARAM_INT ) {
+ return $input;
+ } else {
+ return "'".$input."'";
+ }
+ }
+
+ function exec($statement)
+ {
+ $stmt = $this->prepare($statement);
+ $stmt->execute();
+ return $stmt->rowCount();
+ }
+
+ function lastInsertId($name = null)
+ {
+ return db2_last_insert_id($this->_conn);
+ }
+
+ function beginTransaction()
+ {
+ db2_autocommit($this->_conn, DB2_AUTOCOMMIT_OFF);
+ }
+
+ function commit()
+ {
+ if (!db2_commit($this->_conn)) {
+ throw new DB2Exception(db2_conn_errormsg($this->_conn));
+ }
+ db2_autocommit($this->_conn, DB2_AUTOCOMMIT_ON);
+ }
+
+ function rollBack()
+ {
+ if (!db2_rollback($this->_conn)) {
+ throw new DB2Exception(db2_conn_errormsg($this->_conn));
+ }
+ db2_autocommit($this->_conn, DB2_AUTOCOMMIT_ON);
+ }
+
+ function errorCode()
+ {
+ return db2_conn_error($this->_conn);
+ }
+
+ function errorInfo()
+ {
+ return array(
+ 0 => db2_conn_errormsg($this->_conn),
+ 1 => $this->errorCode(),
+ );
+ }
+}
\ No newline at end of file
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-dbal/lib/Doctrine/DBAL/Driver/IBMDB2/DB2Driver.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-dbal/lib/Doctrine/DBAL/Driver/IBMDB2/DB2Driver.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,108 @@
+.
+*/
+
+namespace Doctrine\DBAL\Driver\IBMDB2;
+
+use Doctrine\DBAL\Driver,
+ Doctrine\DBAL\Connection;
+
+/**
+ * IBM DB2 Driver
+ *
+ * @since 2.0
+ * @author Benjamin Eberlei
+ */
+class DB2Driver implements Driver
+{
+ /**
+ * Attempts to create a connection with the database.
+ *
+ * @param array $params All connection parameters passed by the user.
+ * @param string $username The username to use when connecting.
+ * @param string $password The password to use when connecting.
+ * @param array $driverOptions The driver options to use when connecting.
+ * @return Doctrine\DBAL\Driver\Connection The database connection.
+ */
+ public function connect(array $params, $username = null, $password = null, array $driverOptions = array())
+ {
+ if ( !isset($params['schema']) ) {
+
+ }
+
+ if ($params['host'] !== 'localhost' && $params['host'] != '127.0.0.1') {
+ // if the host isn't localhost, use extended connection params
+ $params['dbname'] = 'DRIVER={IBM DB2 ODBC DRIVER}' .
+ ';DATABASE=' . $params['dbname'] .
+ ';HOSTNAME=' . $params['host'] .
+ ';PORT=' . $params['port'] .
+ ';PROTOCOL=' . $params['protocol'] .
+ ';UID=' . $username .
+ ';PWD=' . $password .';';
+ $username = null;
+ $password = null;
+ }
+
+ return new DB2Connection($params, $username, $password, $driverOptions);
+ }
+
+ /**
+ * Gets the DatabasePlatform instance that provides all the metadata about
+ * the platform this driver connects to.
+ *
+ * @return Doctrine\DBAL\Platforms\AbstractPlatform The database platform.
+ */
+ public function getDatabasePlatform()
+ {
+ return new \Doctrine\DBAL\Platforms\DB2Platform;
+ }
+
+ /**
+ * Gets the SchemaManager that can be used to inspect and change the underlying
+ * database schema of the platform this driver connects to.
+ *
+ * @param Doctrine\DBAL\Connection $conn
+ * @return Doctrine\DBAL\SchemaManager
+ */
+ public function getSchemaManager(Connection $conn)
+ {
+ return new \Doctrine\DBAL\Schema\DB2SchemaManager($conn);
+ }
+
+ /**
+ * Gets the name of the driver.
+ *
+ * @return string The name of the driver.
+ */
+ public function getName()
+ {
+ return 'ibm_db2';
+ }
+
+ /**
+ * Get the name of the database connected to for this driver.
+ *
+ * @param Doctrine\DBAL\Connection $conn
+ * @return string $database
+ */
+ public function getDatabase(\Doctrine\DBAL\Connection $conn)
+ {
+ $params = $conn->getParams();
+ return $params['dbname'];
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-dbal/lib/Doctrine/DBAL/Driver/IBMDB2/DB2Exception.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-dbal/lib/Doctrine/DBAL/Driver/IBMDB2/DB2Exception.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,27 @@
+.
+*/
+
+namespace Doctrine\DBAL\Driver\IBMDB2;
+
+class DB2Exception extends \Exception
+{
+
+}
\ No newline at end of file
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-dbal/lib/Doctrine/DBAL/Driver/IBMDB2/DB2Statement.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-dbal/lib/Doctrine/DBAL/Driver/IBMDB2/DB2Statement.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,297 @@
+.
+*/
+
+namespace Doctrine\DBAL\Driver\IBMDB2;
+
+class DB2Statement implements \Doctrine\DBAL\Driver\Statement
+{
+ private $_stmt = null;
+
+ private $_bindParam = array();
+
+ /**
+ * DB2_BINARY, DB2_CHAR, DB2_DOUBLE, or DB2_LONG
+ * @var
+ */
+ static private $_typeMap = array(
+ \PDO::PARAM_INT => DB2_LONG,
+ \PDO::PARAM_STR => DB2_CHAR,
+ );
+
+ public function __construct($stmt)
+ {
+ $this->_stmt = $stmt;
+ }
+
+ /**
+ * Binds a value to a corresponding named or positional
+ * placeholder in the SQL statement that was used to prepare the statement.
+ *
+ * @param mixed $param Parameter identifier. For a prepared statement using named placeholders,
+ * this will be a parameter name of the form :name. For a prepared statement
+ * using question mark placeholders, this will be the 1-indexed position of the parameter
+ *
+ * @param mixed $value The value to bind to the parameter.
+ * @param integer $type Explicit data type for the parameter using the PDO::PARAM_* constants.
+ *
+ * @return boolean Returns TRUE on success or FALSE on failure.
+ */
+ function bindValue($param, $value, $type = null)
+ {
+ return $this->bindParam($param, $value, $type);
+ }
+
+ /**
+ * Binds a PHP variable to a corresponding named or question mark placeholder in the
+ * SQL statement that was use to prepare the statement. Unlike PDOStatement->bindValue(),
+ * the variable is bound as a reference and will only be evaluated at the time
+ * that PDOStatement->execute() is called.
+ *
+ * Most parameters are input parameters, that is, parameters that are
+ * used in a read-only fashion to build up the query. Some drivers support the invocation
+ * of stored procedures that return data as output parameters, and some also as input/output
+ * parameters that both send in data and are updated to receive it.
+ *
+ * @param mixed $param Parameter identifier. For a prepared statement using named placeholders,
+ * this will be a parameter name of the form :name. For a prepared statement
+ * using question mark placeholders, this will be the 1-indexed position of the parameter
+ *
+ * @param mixed $variable Name of the PHP variable to bind to the SQL statement parameter.
+ *
+ * @param integer $type Explicit data type for the parameter using the PDO::PARAM_* constants. To return
+ * an INOUT parameter from a stored procedure, use the bitwise OR operator to set the
+ * PDO::PARAM_INPUT_OUTPUT bits for the data_type parameter.
+ * @return boolean Returns TRUE on success or FALSE on failure.
+ */
+ function bindParam($column, &$variable, $type = null)
+ {
+ $this->_bindParam[$column] =& $variable;
+
+ if ($type && isset(self::$_typeMap[$type])) {
+ $type = self::$_typeMap[$type];
+ } else {
+ $type = DB2_CHAR;
+ }
+
+ if (!db2_bind_param($this->_stmt, $column, "variable", DB2_PARAM_IN, $type)) {
+ throw new DB2Exception(db2_stmt_errormsg());
+ }
+ return true;
+ }
+
+ /**
+ * Closes the cursor, enabling the statement to be executed again.
+ *
+ * @return boolean Returns TRUE on success or FALSE on failure.
+ */
+ function closeCursor()
+ {
+ if (!$this->_stmt) {
+ return false;
+ }
+
+ $this->_bindParam = array();
+ db2_free_result($this->_stmt);
+ $ret = db2_free_stmt($this->_stmt);
+ $this->_stmt = false;
+ return $ret;
+ }
+
+ /**
+ * columnCount
+ * Returns the number of columns in the result set
+ *
+ * @return integer Returns the number of columns in the result set represented
+ * by the PDOStatement object. If there is no result set,
+ * this method should return 0.
+ */
+ function columnCount()
+ {
+ if (!$this->_stmt) {
+ return false;
+ }
+ return db2_num_fields($this->_stmt);
+ }
+
+ /**
+ * errorCode
+ * Fetch the SQLSTATE associated with the last operation on the statement handle
+ *
+ * @see Doctrine_Adapter_Interface::errorCode()
+ * @return string error code string
+ */
+ function errorCode()
+ {
+ return db2_stmt_error();
+ }
+
+ /**
+ * errorInfo
+ * Fetch extended error information associated with the last operation on the statement handle
+ *
+ * @see Doctrine_Adapter_Interface::errorInfo()
+ * @return array error info array
+ */
+ function errorInfo()
+ {
+ return array(
+ 0 => db2_stmt_errormsg(),
+ 1 => db2_stmt_error(),
+ );
+ }
+
+ /**
+ * Executes a prepared statement
+ *
+ * If the prepared statement included parameter markers, you must either:
+ * call PDOStatement->bindParam() to bind PHP variables to the parameter markers:
+ * bound variables pass their value as input and receive the output value,
+ * if any, of their associated parameter markers or pass an array of input-only
+ * parameter values
+ *
+ *
+ * @param array $params An array of values with as many elements as there are
+ * bound parameters in the SQL statement being executed.
+ * @return boolean Returns TRUE on success or FALSE on failure.
+ */
+ function execute($params = null)
+ {
+ if (!$this->_stmt) {
+ return false;
+ }
+
+ /*$retval = true;
+ if ($params !== null) {
+ $retval = @db2_execute($this->_stmt, $params);
+ } else {
+ $retval = @db2_execute($this->_stmt);
+ }*/
+ if ($params === null) {
+ ksort($this->_bindParam);
+ $params = array_values($this->_bindParam);
+ }
+ $retval = @db2_execute($this->_stmt, $params);
+
+ if ($retval === false) {
+ throw new DB2Exception(db2_stmt_errormsg());
+ }
+ return $retval;
+ }
+
+ /**
+ * fetch
+ *
+ * @see Query::HYDRATE_* constants
+ * @param integer $fetchStyle Controls how the next row will be returned to the caller.
+ * This value must be one of the Query::HYDRATE_* constants,
+ * defaulting to Query::HYDRATE_BOTH
+ *
+ * @param integer $cursorOrientation For a PDOStatement object representing a scrollable cursor,
+ * this value determines which row will be returned to the caller.
+ * This value must be one of the Query::HYDRATE_ORI_* constants, defaulting to
+ * Query::HYDRATE_ORI_NEXT. To request a scrollable cursor for your
+ * PDOStatement object,
+ * you must set the PDO::ATTR_CURSOR attribute to Doctrine::CURSOR_SCROLL when you
+ * prepare the SQL statement with Doctrine_Adapter_Interface->prepare().
+ *
+ * @param integer $cursorOffset For a PDOStatement object representing a scrollable cursor for which the
+ * $cursorOrientation parameter is set to Query::HYDRATE_ORI_ABS, this value specifies
+ * the absolute number of the row in the result set that shall be fetched.
+ *
+ * For a PDOStatement object representing a scrollable cursor for
+ * which the $cursorOrientation parameter is set to Query::HYDRATE_ORI_REL, this value
+ * specifies the row to fetch relative to the cursor position before
+ * PDOStatement->fetch() was called.
+ *
+ * @return mixed
+ */
+ function fetch($fetchStyle = \PDO::FETCH_BOTH)
+ {
+ switch ($fetchStyle) {
+ case \PDO::FETCH_BOTH:
+ return db2_fetch_both($this->_stmt);
+ case \PDO::FETCH_ASSOC:
+ return db2_fetch_assoc($this->_stmt);
+ case \PDO::FETCH_NUM:
+ return db2_fetch_array($this->_stmt);
+ default:
+ throw new DB2Exception("Given Fetch-Style " . $fetchStyle . " is not supported.");
+ }
+ }
+
+ /**
+ * Returns an array containing all of the result set rows
+ *
+ * @param integer $fetchStyle Controls how the next row will be returned to the caller.
+ * This value must be one of the Query::HYDRATE_* constants,
+ * defaulting to Query::HYDRATE_BOTH
+ *
+ * @param integer $columnIndex Returns the indicated 0-indexed column when the value of $fetchStyle is
+ * Query::HYDRATE_COLUMN. Defaults to 0.
+ *
+ * @return array
+ */
+ function fetchAll($fetchStyle = \PDO::FETCH_BOTH)
+ {
+ $rows = array();
+ while ($row = $this->fetch($fetchStyle)) {
+ $rows[] = $row;
+ }
+ return $rows;
+ }
+
+ /**
+ * fetchColumn
+ * Returns a single column from the next row of a
+ * result set or FALSE if there are no more rows.
+ *
+ * @param integer $columnIndex 0-indexed number of the column you wish to retrieve from the row. If no
+ * value is supplied, PDOStatement->fetchColumn()
+ * fetches the first column.
+ *
+ * @return string returns a single column in the next row of a result set.
+ */
+ function fetchColumn($columnIndex = 0)
+ {
+ $row = $this->fetch(\PDO::FETCH_NUM);
+ if ($row && isset($row[$columnIndex])) {
+ return $row[$columnIndex];
+ }
+ return false;
+ }
+
+ /**
+ * rowCount
+ * rowCount() returns the number of rows affected by the last DELETE, INSERT, or UPDATE statement
+ * executed by the corresponding object.
+ *
+ * If the last SQL statement executed by the associated Statement object was a SELECT statement,
+ * some databases may return the number of rows returned by that statement. However,
+ * this behaviour is not guaranteed for all databases and should not be
+ * relied on for portable applications.
+ *
+ * @return integer Returns the number of rows.
+ */
+ function rowCount()
+ {
+ return (@db2_num_rows($this->_stmt))?:0;
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-dbal/lib/Doctrine/DBAL/Driver/OCI8/Driver.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-dbal/lib/Doctrine/DBAL/Driver/OCI8/Driver.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,95 @@
+.
+ */
+
+namespace Doctrine\DBAL\Driver\OCI8;
+
+use Doctrine\DBAL\Platforms;
+
+/**
+ * A Doctrine DBAL driver for the Oracle OCI8 PHP extensions.
+ *
+ * @author Roman Borschel
+ * @since 2.0
+ */
+class Driver implements \Doctrine\DBAL\Driver
+{
+ public function connect(array $params, $username = null, $password = null, array $driverOptions = array())
+ {
+ return new OCI8Connection(
+ $username,
+ $password,
+ $this->_constructDsn($params),
+ isset($params['charset']) ? $params['charset'] : null,
+ isset($params['sessionMode']) ? $params['sessionMode'] : OCI_DEFAULT
+ );
+ }
+
+ /**
+ * Constructs the Oracle DSN.
+ *
+ * @return string The DSN.
+ */
+ private function _constructDsn(array $params)
+ {
+ $dsn = '';
+ if (isset($params['host'])) {
+ $dsn .= '(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)' .
+ '(HOST=' . $params['host'] . ')';
+
+ if (isset($params['port'])) {
+ $dsn .= '(PORT=' . $params['port'] . ')';
+ } else {
+ $dsn .= '(PORT=1521)';
+ }
+
+ $dsn .= '))';
+ if (isset($params['dbname'])) {
+ $dsn .= '(CONNECT_DATA=(SID=' . $params['dbname'] . ')';
+ }
+ $dsn .= '))';
+ } else {
+ $dsn .= $params['dbname'];
+ }
+
+ return $dsn;
+ }
+
+ public function getDatabasePlatform()
+ {
+ return new \Doctrine\DBAL\Platforms\OraclePlatform();
+ }
+
+ public function getSchemaManager(\Doctrine\DBAL\Connection $conn)
+ {
+ return new \Doctrine\DBAL\Schema\OracleSchemaManager($conn);
+ }
+
+ public function getName()
+ {
+ return 'oci8';
+ }
+
+ public function getDatabase(\Doctrine\DBAL\Connection $conn)
+ {
+ $params = $conn->getParams();
+ return $params['user'];
+ }
+}
\ No newline at end of file
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-dbal/lib/Doctrine/DBAL/Driver/OCI8/OCI8Connection.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-dbal/lib/Doctrine/DBAL/Driver/OCI8/OCI8Connection.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,160 @@
+.
+ */
+
+namespace Doctrine\DBAL\Driver\OCI8;
+
+/**
+ * OCI8 implementation of the Connection interface.
+ *
+ * @since 2.0
+ */
+class OCI8Connection implements \Doctrine\DBAL\Driver\Connection
+{
+ private $_dbh;
+
+ private $_executeMode = OCI_COMMIT_ON_SUCCESS;
+
+ /**
+ * Create a Connection to an Oracle Database using oci8 extension.
+ *
+ * @param string $username
+ * @param string $password
+ * @param string $db
+ */
+ public function __construct($username, $password, $db, $charset = null, $sessionMode = OCI_DEFAULT)
+ {
+ if (!defined('OCI_NO_AUTO_COMMIT')) {
+ define('OCI_NO_AUTO_COMMIT', 0);
+ }
+
+ $this->_dbh = @oci_connect($username, $password, $db, $charset, $sessionMode);
+ if (!$this->_dbh) {
+ throw OCI8Exception::fromErrorInfo(oci_error());
+ }
+ }
+
+ /**
+ * Create a non-executed prepared statement.
+ *
+ * @param string $prepareString
+ * @return OCI8Statement
+ */
+ public function prepare($prepareString)
+ {
+ return new OCI8Statement($this->_dbh, $prepareString, $this->_executeMode);
+ }
+
+ /**
+ * @param string $sql
+ * @return OCI8Statement
+ */
+ public function query()
+ {
+ $args = func_get_args();
+ $sql = $args[0];
+ //$fetchMode = $args[1];
+ $stmt = $this->prepare($sql);
+ $stmt->execute();
+ return $stmt;
+ }
+
+ /**
+ * Quote input value.
+ *
+ * @param mixed $input
+ * @param int $type PDO::PARAM*
+ * @return mixed
+ */
+ public function quote($input, $type=\PDO::PARAM_STR)
+ {
+ return is_numeric($input) ? $input : "'$input'";
+ }
+
+ /**
+ *
+ * @param string $statement
+ * @return int
+ */
+ public function exec($statement)
+ {
+ $stmt = $this->prepare($statement);
+ $stmt->execute();
+ return $stmt->rowCount();
+ }
+
+ public function lastInsertId($name = null)
+ {
+ //TODO: throw exception or support sequences?
+ }
+
+ /**
+ * Start a transactiom
+ *
+ * Oracle has to explicitly set the autocommit mode off. That means
+ * after connection, a commit or rollback there is always automatically
+ * opened a new transaction.
+ *
+ * @return bool
+ */
+ public function beginTransaction()
+ {
+ $this->_executeMode = OCI_NO_AUTO_COMMIT;
+ return true;
+ }
+
+ /**
+ * @throws OCI8Exception
+ * @return bool
+ */
+ public function commit()
+ {
+ if (!oci_commit($this->_dbh)) {
+ throw OCI8Exception::fromErrorInfo($this->errorInfo());
+ }
+ $this->_executeMode = OCI_COMMIT_ON_SUCCESS;
+ return true;
+ }
+
+ /**
+ * @throws OCI8Exception
+ * @return bool
+ */
+ public function rollBack()
+ {
+ if (!oci_rollback($this->_dbh)) {
+ throw OCI8Exception::fromErrorInfo($this->errorInfo());
+ }
+ $this->_executeMode = OCI_COMMIT_ON_SUCCESS;
+ return true;
+ }
+
+ public function errorCode()
+ {
+ $error = oci_error($this->_dbh);
+ if ($error !== false) {
+ $error = $error['code'];
+ }
+ return $error;
+ }
+
+ public function errorInfo()
+ {
+ return oci_error($this->_dbh);
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-dbal/lib/Doctrine/DBAL/Driver/OCI8/OCI8Exception.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-dbal/lib/Doctrine/DBAL/Driver/OCI8/OCI8Exception.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,30 @@
+.
+*/
+
+namespace Doctrine\DBAL\Driver\OCI8;
+
+class OCI8Exception extends \Exception
+{
+ static public function fromErrorInfo($error)
+ {
+ return new self($error['message'], $error['code']);
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-dbal/lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-dbal/lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,220 @@
+.
+ */
+
+namespace Doctrine\DBAL\Driver\OCI8;
+
+use \PDO;
+
+/**
+ * The OCI8 implementation of the Statement interface.
+ *
+ * @since 2.0
+ * @author Roman Borschel
+ */
+class OCI8Statement implements \Doctrine\DBAL\Driver\Statement
+{
+ /** Statement handle. */
+ private $_sth;
+ private $_executeMode;
+ private static $_PARAM = ':param';
+ private static $fetchStyleMap = array(
+ PDO::FETCH_BOTH => OCI_BOTH,
+ PDO::FETCH_ASSOC => OCI_ASSOC,
+ PDO::FETCH_NUM => OCI_NUM
+ );
+ private $_paramMap = array();
+
+ /**
+ * Creates a new OCI8Statement that uses the given connection handle and SQL statement.
+ *
+ * @param resource $dbh The connection handle.
+ * @param string $statement The SQL statement.
+ */
+ public function __construct($dbh, $statement, $executeMode)
+ {
+ list($statement, $paramMap) = self::convertPositionalToNamedPlaceholders($statement);
+ $this->_sth = oci_parse($dbh, $statement);
+ $this->_paramMap = $paramMap;
+ $this->_executeMode = $executeMode;
+ }
+
+ /**
+ * Convert positional (?) into named placeholders (:param)
+ *
+ * Oracle does not support positional parameters, hence this method converts all
+ * positional parameters into artificially named parameters. Note that this conversion
+ * is not perfect. All question marks (?) in the original statement are treated as
+ * placeholders and converted to a named parameter.
+ *
+ * The algorithm uses a state machine with two possible states: InLiteral and NotInLiteral.
+ * Question marks inside literal strings are therefore handled correctly by this method.
+ * This comes at a cost, the whole sql statement has to be looped over.
+ *
+ * @todo extract into utility class in Doctrine\DBAL\Util namespace
+ * @todo review and test for lost spaces. we experienced missing spaces with oci8 in some sql statements.
+ * @param string $statement The SQL statement to convert.
+ * @return string
+ */
+ static public function convertPositionalToNamedPlaceholders($statement)
+ {
+ $count = 1;
+ $inLiteral = false; // a valid query never starts with quotes
+ $stmtLen = strlen($statement);
+ $paramMap = array();
+ for ($i = 0; $i < $stmtLen; $i++) {
+ if ($statement[$i] == '?' && !$inLiteral) {
+ // real positional parameter detected
+ $paramMap[$count] = ":param$count";
+ $len = strlen($paramMap[$count]);
+ $statement = substr_replace($statement, ":param$count", $i, 1);
+ $i += $len-1; // jump ahead
+ $stmtLen = strlen($statement); // adjust statement length
+ ++$count;
+ } else if ($statement[$i] == "'" || $statement[$i] == '"') {
+ $inLiteral = ! $inLiteral; // switch state!
+ }
+ }
+
+ return array($statement, $paramMap);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function bindValue($param, $value, $type = null)
+ {
+ return $this->bindParam($param, $value, $type);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function bindParam($column, &$variable, $type = null)
+ {
+ $column = isset($this->_paramMap[$column]) ? $this->_paramMap[$column] : $column;
+
+ return oci_bind_by_name($this->_sth, $column, $variable);
+ }
+
+ /**
+ * Closes the cursor, enabling the statement to be executed again.
+ *
+ * @return boolean Returns TRUE on success or FALSE on failure.
+ */
+ public function closeCursor()
+ {
+ return oci_free_statement($this->_sth);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function columnCount()
+ {
+ return oci_num_fields($this->_sth);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function errorCode()
+ {
+ $error = oci_error($this->_sth);
+ if ($error !== false) {
+ $error = $error['code'];
+ }
+ return $error;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function errorInfo()
+ {
+ return oci_error($this->_sth);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function execute($params = null)
+ {
+ if ($params) {
+ $hasZeroIndex = isset($params[0]);
+ foreach ($params as $key => $val) {
+ if ($hasZeroIndex && is_numeric($key)) {
+ $this->bindValue($key + 1, $val);
+ } else {
+ $this->bindValue($key, $val);
+ }
+ }
+ }
+
+ $ret = @oci_execute($this->_sth, $this->_executeMode);
+ if ( ! $ret) {
+ throw OCI8Exception::fromErrorInfo($this->errorInfo());
+ }
+ return $ret;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function fetch($fetchStyle = PDO::FETCH_BOTH)
+ {
+ if ( ! isset(self::$fetchStyleMap[$fetchStyle])) {
+ throw new \InvalidArgumentException("Invalid fetch style: " . $fetchStyle);
+ }
+
+ return oci_fetch_array($this->_sth, self::$fetchStyleMap[$fetchStyle] | OCI_RETURN_NULLS | OCI_RETURN_LOBS);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function fetchAll($fetchStyle = PDO::FETCH_BOTH)
+ {
+ if ( ! isset(self::$fetchStyleMap[$fetchStyle])) {
+ throw new \InvalidArgumentException("Invalid fetch style: " . $fetchStyle);
+ }
+
+ $result = array();
+ oci_fetch_all($this->_sth, $result, 0, -1,
+ self::$fetchStyleMap[$fetchStyle] | OCI_RETURN_NULLS | OCI_FETCHSTATEMENT_BY_ROW | OCI_RETURN_LOBS);
+
+ return $result;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function fetchColumn($columnIndex = 0)
+ {
+ $row = oci_fetch_array($this->_sth, OCI_NUM | OCI_RETURN_NULLS | OCI_RETURN_LOBS);
+ return $row[$columnIndex];
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function rowCount()
+ {
+ return oci_num_rows($this->_sth);
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,40 @@
+.
+ */
+
+namespace Doctrine\DBAL\Driver;
+
+use \PDO;
+
+/**
+ * PDO implementation of the Connection interface.
+ * Used by all PDO-based drivers.
+ *
+ * @since 2.0
+ */
+class PDOConnection extends PDO implements Connection
+{
+ public function __construct($dsn, $user = null, $password = null, array $options = null)
+ {
+ parent::__construct($dsn, $user, $password, $options);
+ $this->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('Doctrine\DBAL\Driver\PDOStatement', array()));
+ $this->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+ }
+}
\ No newline at end of file
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-dbal/lib/Doctrine/DBAL/Driver/PDOIbm/Driver.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-dbal/lib/Doctrine/DBAL/Driver/PDOIbm/Driver.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,126 @@
+.
+*/
+
+namespace Doctrine\DBAL\Driver\PDOIbm;
+
+use Doctrine\DBAL\Connection;
+
+/**
+ * Driver for the PDO IBM extension
+ *
+ * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
+ * @link www.doctrine-project.com
+ * @since 1.0
+ * @version $Revision$
+ * @author Benjamin Eberlei
+ * @author Guilherme Blanco
+ * @author Jonathan Wage
+ * @author Roman Borschel
+ */
+class Driver implements \Doctrine\DBAL\Driver
+{
+ /**
+ * Attempts to establish a connection with the underlying driver.
+ *
+ * @param array $params
+ * @param string $username
+ * @param string $password
+ * @param array $driverOptions
+ * @return Doctrine\DBAL\Driver\Connection
+ */
+ public function connect(array $params, $username = null, $password = null, array $driverOptions = array())
+ {
+ $conn = new \Doctrine\DBAL\Driver\PDOConnection(
+ $this->_constructPdoDsn($params),
+ $username,
+ $password,
+ $driverOptions
+ );
+ return $conn;
+ }
+
+ /**
+ * Constructs the MySql PDO DSN.
+ *
+ * @return string The DSN.
+ */
+ private function _constructPdoDsn(array $params)
+ {
+ $dsn = 'ibm:';
+ if (isset($params['host'])) {
+ $dsn .= 'HOSTNAME=' . $params['host'] . ';';
+ }
+ if (isset($params['port'])) {
+ $dsn .= 'PORT=' . $params['port'] . ';';
+ }
+ $dsn .= 'PROTOCOL=TCPIP;';
+ if (isset($params['dbname'])) {
+ $dsn .= 'DATABASE=' . $params['dbname'] . ';';
+ }
+
+ return $dsn;
+ }
+
+ /**
+ * Gets the DatabasePlatform instance that provides all the metadata about
+ * the platform this driver connects to.
+ *
+ * @return Doctrine\DBAL\Platforms\AbstractPlatform The database platform.
+ */
+ public function getDatabasePlatform()
+ {
+ return new \Doctrine\DBAL\Platforms\DB2Platform;
+ }
+
+ /**
+ * Gets the SchemaManager that can be used to inspect and change the underlying
+ * database schema of the platform this driver connects to.
+ *
+ * @param Doctrine\DBAL\Connection $conn
+ * @return Doctrine\DBAL\SchemaManager
+ */
+ public function getSchemaManager(Connection $conn)
+ {
+ return new \Doctrine\DBAL\Schema\DB2SchemaManager($conn);
+ }
+
+ /**
+ * Gets the name of the driver.
+ *
+ * @return string The name of the driver.
+ */
+ public function getName()
+ {
+ return 'pdo_ibm';
+ }
+
+ /**
+ * Get the name of the database connected to for this driver.
+ *
+ * @param Doctrine\DBAL\Connection $conn
+ * @return string $database
+ */
+ public function getDatabase(\Doctrine\DBAL\Connection $conn)
+ {
+ $params = $conn->getParams();
+ return $params['dbname'];
+ }
+}
\ No newline at end of file
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-dbal/lib/Doctrine/DBAL/Driver/PDOMySql/Driver.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-dbal/lib/Doctrine/DBAL/Driver/PDOMySql/Driver.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,98 @@
+.
+ */
+
+namespace Doctrine\DBAL\Driver\PDOMySql;
+
+use Doctrine\DBAL\Connection;
+
+/**
+ * PDO MySql driver.
+ *
+ * @since 2.0
+ */
+class Driver implements \Doctrine\DBAL\Driver
+{
+ /**
+ * Attempts to establish a connection with the underlying driver.
+ *
+ * @param array $params
+ * @param string $username
+ * @param string $password
+ * @param array $driverOptions
+ * @return Doctrine\DBAL\Driver\Connection
+ */
+ public function connect(array $params, $username = null, $password = null, array $driverOptions = array())
+ {
+ $conn = new \Doctrine\DBAL\Driver\PDOConnection(
+ $this->_constructPdoDsn($params),
+ $username,
+ $password,
+ $driverOptions
+ );
+ return $conn;
+ }
+
+ /**
+ * Constructs the MySql PDO DSN.
+ *
+ * @return string The DSN.
+ */
+ private function _constructPdoDsn(array $params)
+ {
+ $dsn = 'mysql:';
+ if (isset($params['host']) && $params['host'] != '') {
+ $dsn .= 'host=' . $params['host'] . ';';
+ }
+ if (isset($params['port'])) {
+ $dsn .= 'port=' . $params['port'] . ';';
+ }
+ if (isset($params['dbname'])) {
+ $dsn .= 'dbname=' . $params['dbname'] . ';';
+ }
+ if (isset($params['unix_socket'])) {
+ $dsn .= 'unix_socket=' . $params['unix_socket'] . ';';
+ }
+ if (isset($params['charset'])) {
+ $dsn .= 'charset=' . $params['charset'] . ';';
+ }
+
+ return $dsn;
+ }
+
+ public function getDatabasePlatform()
+ {
+ return new \Doctrine\DBAL\Platforms\MySqlPlatform();
+ }
+
+ public function getSchemaManager(\Doctrine\DBAL\Connection $conn)
+ {
+ return new \Doctrine\DBAL\Schema\MySqlSchemaManager($conn);
+ }
+
+ public function getName()
+ {
+ return 'pdo_mysql';
+ }
+
+ public function getDatabase(\Doctrine\DBAL\Connection $conn)
+ {
+ $params = $conn->getParams();
+ return $params['dbname'];
+ }
+}
\ No newline at end of file
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-dbal/lib/Doctrine/DBAL/Driver/PDOOracle/Driver.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-dbal/lib/Doctrine/DBAL/Driver/PDOOracle/Driver.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,88 @@
+.
+ */
+
+namespace Doctrine\DBAL\Driver\PDOOracle;
+
+use Doctrine\DBAL\Platforms;
+
+class Driver implements \Doctrine\DBAL\Driver
+{
+ public function connect(array $params, $username = null, $password = null, array $driverOptions = array())
+ {
+ return new \Doctrine\DBAL\Driver\PDOConnection(
+ $this->_constructPdoDsn($params),
+ $username,
+ $password,
+ $driverOptions
+ );
+ }
+
+ /**
+ * Constructs the Oracle PDO DSN.
+ *
+ * @return string The DSN.
+ */
+ private function _constructPdoDsn(array $params)
+ {
+ $dsn = 'oci:';
+ if (isset($params['host'])) {
+ $dsn .= 'dbname=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)' .
+ '(HOST=' . $params['host'] . ')';
+
+ if (isset($params['port'])) {
+ $dsn .= '(PORT=' . $params['port'] . ')';
+ } else {
+ $dsn .= '(PORT=1521)';
+ }
+
+ $dsn .= '))(CONNECT_DATA=(SID=' . $params['dbname'] . ')))';
+ } else {
+ $dsn .= 'dbname=' . $params['dbname'];
+ }
+
+ if (isset($params['charset'])) {
+ $dsn .= ';charset=' . $params['charset'];
+ }
+
+ return $dsn;
+ }
+
+ public function getDatabasePlatform()
+ {
+ return new \Doctrine\DBAL\Platforms\OraclePlatform();
+ }
+
+ public function getSchemaManager(\Doctrine\DBAL\Connection $conn)
+ {
+ return new \Doctrine\DBAL\Schema\OracleSchemaManager($conn);
+ }
+
+ public function getName()
+ {
+ return 'pdo_oracle';
+ }
+
+ public function getDatabase(\Doctrine\DBAL\Connection $conn)
+ {
+ $params = $conn->getParams();
+ return $params['user'];
+ }
+}
\ No newline at end of file
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-dbal/lib/Doctrine/DBAL/Driver/PDOPgSql/Driver.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-dbal/lib/Doctrine/DBAL/Driver/PDOPgSql/Driver.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,70 @@
+_constructPdoDsn($params),
+ $username,
+ $password,
+ $driverOptions
+ );
+ }
+
+ /**
+ * Constructs the Postgres PDO DSN.
+ *
+ * @return string The DSN.
+ */
+ private function _constructPdoDsn(array $params)
+ {
+ $dsn = 'pgsql:';
+ if (isset($params['host']) && $params['host'] != '') {
+ $dsn .= 'host=' . $params['host'] . ' ';
+ }
+ if (isset($params['port']) && $params['port'] != '') {
+ $dsn .= 'port=' . $params['port'] . ' ';
+ }
+ if (isset($params['dbname'])) {
+ $dsn .= 'dbname=' . $params['dbname'] . ' ';
+ }
+
+ return $dsn;
+ }
+
+ public function getDatabasePlatform()
+ {
+ return new \Doctrine\DBAL\Platforms\PostgreSqlPlatform();
+ }
+
+ public function getSchemaManager(\Doctrine\DBAL\Connection $conn)
+ {
+ return new \Doctrine\DBAL\Schema\PostgreSqlSchemaManager($conn);
+ }
+
+ public function getName()
+ {
+ return 'pdo_pgsql';
+ }
+
+ public function getDatabase(\Doctrine\DBAL\Connection $conn)
+ {
+ $params = $conn->getParams();
+ return $params['dbname'];
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-dbal/lib/Doctrine/DBAL/Driver/PDOSqlite/Driver.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-dbal/lib/Doctrine/DBAL/Driver/PDOSqlite/Driver.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,116 @@
+.
+ */
+
+namespace Doctrine\DBAL\Driver\PDOSqlite;
+
+/**
+ * The PDO Sqlite driver.
+ *
+ * @since 2.0
+ */
+class Driver implements \Doctrine\DBAL\Driver
+{
+ /**
+ * @var array
+ */
+ protected $_userDefinedFunctions = array(
+ 'sqrt' => array('callback' => array('Doctrine\DBAL\Platforms\SqlitePlatform', 'udfSqrt'), 'numArgs' => 1),
+ 'mod' => array('callback' => array('Doctrine\DBAL\Platforms\SqlitePlatform', 'udfMod'), 'numArgs' => 2),
+ 'locate' => array('callback' => array('Doctrine\DBAL\Platforms\SqlitePlatform', 'udfLocate'), 'numArgs' => -1),
+ );
+
+ /**
+ * Tries to establish a database connection to SQLite.
+ *
+ * @param array $params
+ * @param string $username
+ * @param string $password
+ * @param array $driverOptions
+ * @return Connection
+ */
+ public function connect(array $params, $username = null, $password = null, array $driverOptions = array())
+ {
+ if (isset($driverOptions['userDefinedFunctions'])) {
+ $this->_userDefinedFunctions = array_merge(
+ $this->_userDefinedFunctions, $driverOptions['userDefinedFunctions']);
+ unset($driverOptions['userDefinedFunctions']);
+ }
+
+ $pdo = new \Doctrine\DBAL\Driver\PDOConnection(
+ $this->_constructPdoDsn($params),
+ $username,
+ $password,
+ $driverOptions
+ );
+
+ foreach ($this->_userDefinedFunctions AS $fn => $data) {
+ $pdo->sqliteCreateFunction($fn, $data['callback'], $data['numArgs']);
+ }
+
+ return $pdo;
+ }
+
+ /**
+ * Constructs the Sqlite PDO DSN.
+ *
+ * @return string The DSN.
+ * @override
+ */
+ protected function _constructPdoDsn(array $params)
+ {
+ $dsn = 'sqlite:';
+ if (isset($params['path'])) {
+ $dsn .= $params['path'];
+ } else if (isset($params['memory'])) {
+ $dsn .= ':memory:';
+ }
+
+ return $dsn;
+ }
+
+ /**
+ * Gets the database platform that is relevant for this driver.
+ */
+ public function getDatabasePlatform()
+ {
+ return new \Doctrine\DBAL\Platforms\SqlitePlatform();
+ }
+
+ /**
+ * Gets the schema manager that is relevant for this driver.
+ *
+ * @param Doctrine\DBAL\Connection $conn
+ * @return Doctrine\DBAL\Schema\SqliteSchemaManager
+ */
+ public function getSchemaManager(\Doctrine\DBAL\Connection $conn)
+ {
+ return new \Doctrine\DBAL\Schema\SqliteSchemaManager($conn);
+ }
+
+ public function getName()
+ {
+ return 'pdo_sqlite';
+ }
+
+ public function getDatabase(\Doctrine\DBAL\Connection $conn)
+ {
+ $params = $conn->getParams();
+ return isset($params['path']) ? $params['path'] : null;
+ }
+}
\ No newline at end of file
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-dbal/lib/Doctrine/DBAL/Driver/PDOSqlsrv/Connection.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-dbal/lib/Doctrine/DBAL/Driver/PDOSqlsrv/Connection.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,45 @@
+.
+ */
+
+namespace Doctrine\DBAL\Driver\PDOSqlsrv;
+
+/**
+ * Sqlsrv Connection implementation.
+ *
+ * @since 2.0
+ */
+class Connection extends \Doctrine\DBAL\Driver\PDOConnection implements \Doctrine\DBAL\Driver\Connection
+{
+ /**
+ * @override
+ */
+ public function quote($value, $type=\PDO::PARAM_STR)
+ {
+ $val = parent::quote($value, $type);
+
+ // Fix for a driver version terminating all values with null byte
+ if (strpos($val, "\0") !== false) {
+ $val = substr($val, 0, -1);
+ }
+
+ return $val;
+ }
+}
\ No newline at end of file
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-dbal/lib/Doctrine/DBAL/Driver/PDOSqlsrv/Driver.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-dbal/lib/Doctrine/DBAL/Driver/PDOSqlsrv/Driver.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,86 @@
+.
+ */
+
+namespace Doctrine\DBAL\Driver\PDOSqlsrv;
+
+/**
+ * The PDO-based Sqlsrv driver.
+ *
+ * @since 2.0
+ */
+class Driver implements \Doctrine\DBAL\Driver
+{
+ public function connect(array $params, $username = null, $password = null, array $driverOptions = array())
+ {
+ return new Connection(
+ $this->_constructPdoDsn($params),
+ $username,
+ $password,
+ $driverOptions
+ );
+ }
+
+ /**
+ * Constructs the Sqlsrv PDO DSN.
+ *
+ * @return string The DSN.
+ */
+ private function _constructPdoDsn(array $params)
+ {
+ $dsn = 'sqlsrv:server=';
+
+ if (isset($params['host'])) {
+ $dsn .= $params['host'];
+ }
+
+ if (isset($params['port']) && !empty($params['port'])) {
+ $dsn .= ',' . $params['port'];
+ }
+
+ if (isset($params['dbname'])) {
+ $dsn .= ';Database=' . $params['dbname'];
+ }
+
+ return $dsn;
+ }
+
+
+ public function getDatabasePlatform()
+ {
+ return new \Doctrine\DBAL\Platforms\MsSqlPlatform();
+ }
+
+ public function getSchemaManager(\Doctrine\DBAL\Connection $conn)
+ {
+ return new \Doctrine\DBAL\Schema\MsSqlSchemaManager($conn);
+ }
+
+ public function getName()
+ {
+ return 'pdo_sqlsrv';
+ }
+
+ public function getDatabase(\Doctrine\DBAL\Connection $conn)
+ {
+ $params = $conn->getParams();
+ return $params['dbname'];
+ }
+}
\ No newline at end of file
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,33 @@
+.
+ */
+
+namespace Doctrine\DBAL\Driver;
+
+/**
+ * The PDO implementation of the Statement interface.
+ * Used by all PDO-based drivers.
+ *
+ * @since 2.0
+ */
+class PDOStatement extends \PDOStatement implements Statement
+{
+ private function __construct() {}
+}
\ No newline at end of file
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-dbal/lib/Doctrine/DBAL/Driver/Statement.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-dbal/lib/Doctrine/DBAL/Driver/Statement.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,200 @@
+.
+ */
+
+namespace Doctrine\DBAL\Driver;
+
+use \PDO;
+
+/**
+ * Statement interface.
+ * Drivers must implement this interface.
+ *
+ * This resembles (a subset of) the PDOStatement interface.
+ *
+ * @author Konsta Vesterinen
+ * @author Roman Borschel
+ * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
+ * @link www.doctrine-project.org
+ * @since 2.0
+ * @version $Revision$
+ */
+interface Statement
+{
+ /**
+ * Binds a value to a corresponding named or positional
+ * placeholder in the SQL statement that was used to prepare the statement.
+ *
+ * @param mixed $param Parameter identifier. For a prepared statement using named placeholders,
+ * this will be a parameter name of the form :name. For a prepared statement
+ * using question mark placeholders, this will be the 1-indexed position of the parameter
+ *
+ * @param mixed $value The value to bind to the parameter.
+ * @param integer $type Explicit data type for the parameter using the PDO::PARAM_* constants.
+ *
+ * @return boolean Returns TRUE on success or FALSE on failure.
+ */
+ function bindValue($param, $value, $type = null);
+
+ /**
+ * Binds a PHP variable to a corresponding named or question mark placeholder in the
+ * SQL statement that was use to prepare the statement. Unlike PDOStatement->bindValue(),
+ * the variable is bound as a reference and will only be evaluated at the time
+ * that PDOStatement->execute() is called.
+ *
+ * Most parameters are input parameters, that is, parameters that are
+ * used in a read-only fashion to build up the query. Some drivers support the invocation
+ * of stored procedures that return data as output parameters, and some also as input/output
+ * parameters that both send in data and are updated to receive it.
+ *
+ * @param mixed $param Parameter identifier. For a prepared statement using named placeholders,
+ * this will be a parameter name of the form :name. For a prepared statement
+ * using question mark placeholders, this will be the 1-indexed position of the parameter
+ *
+ * @param mixed $variable Name of the PHP variable to bind to the SQL statement parameter.
+ *
+ * @param integer $type Explicit data type for the parameter using the PDO::PARAM_* constants. To return
+ * an INOUT parameter from a stored procedure, use the bitwise OR operator to set the
+ * PDO::PARAM_INPUT_OUTPUT bits for the data_type parameter.
+ * @return boolean Returns TRUE on success or FALSE on failure.
+ */
+ function bindParam($column, &$variable, $type = null);
+
+ /**
+ * Closes the cursor, enabling the statement to be executed again.
+ *
+ * @return boolean Returns TRUE on success or FALSE on failure.
+ */
+ function closeCursor();
+
+ /**
+ * columnCount
+ * Returns the number of columns in the result set
+ *
+ * @return integer Returns the number of columns in the result set represented
+ * by the PDOStatement object. If there is no result set,
+ * this method should return 0.
+ */
+ function columnCount();
+
+ /**
+ * errorCode
+ * Fetch the SQLSTATE associated with the last operation on the statement handle
+ *
+ * @see Doctrine_Adapter_Interface::errorCode()
+ * @return string error code string
+ */
+ function errorCode();
+
+ /**
+ * errorInfo
+ * Fetch extended error information associated with the last operation on the statement handle
+ *
+ * @see Doctrine_Adapter_Interface::errorInfo()
+ * @return array error info array
+ */
+ function errorInfo();
+
+ /**
+ * Executes a prepared statement
+ *
+ * If the prepared statement included parameter markers, you must either:
+ * call PDOStatement->bindParam() to bind PHP variables to the parameter markers:
+ * bound variables pass their value as input and receive the output value,
+ * if any, of their associated parameter markers or pass an array of input-only
+ * parameter values
+ *
+ *
+ * @param array $params An array of values with as many elements as there are
+ * bound parameters in the SQL statement being executed.
+ * @return boolean Returns TRUE on success or FALSE on failure.
+ */
+ function execute($params = null);
+
+ /**
+ * fetch
+ *
+ * @see Query::HYDRATE_* constants
+ * @param integer $fetchStyle Controls how the next row will be returned to the caller.
+ * This value must be one of the Query::HYDRATE_* constants,
+ * defaulting to Query::HYDRATE_BOTH
+ *
+ * @param integer $cursorOrientation For a PDOStatement object representing a scrollable cursor,
+ * this value determines which row will be returned to the caller.
+ * This value must be one of the Query::HYDRATE_ORI_* constants, defaulting to
+ * Query::HYDRATE_ORI_NEXT. To request a scrollable cursor for your
+ * PDOStatement object,
+ * you must set the PDO::ATTR_CURSOR attribute to Doctrine::CURSOR_SCROLL when you
+ * prepare the SQL statement with Doctrine_Adapter_Interface->prepare().
+ *
+ * @param integer $cursorOffset For a PDOStatement object representing a scrollable cursor for which the
+ * $cursorOrientation parameter is set to Query::HYDRATE_ORI_ABS, this value specifies
+ * the absolute number of the row in the result set that shall be fetched.
+ *
+ * For a PDOStatement object representing a scrollable cursor for
+ * which the $cursorOrientation parameter is set to Query::HYDRATE_ORI_REL, this value
+ * specifies the row to fetch relative to the cursor position before
+ * PDOStatement->fetch() was called.
+ *
+ * @return mixed
+ */
+ function fetch($fetchStyle = PDO::FETCH_BOTH);
+
+ /**
+ * Returns an array containing all of the result set rows
+ *
+ * @param integer $fetchStyle Controls how the next row will be returned to the caller.
+ * This value must be one of the Query::HYDRATE_* constants,
+ * defaulting to Query::HYDRATE_BOTH
+ *
+ * @param integer $columnIndex Returns the indicated 0-indexed column when the value of $fetchStyle is
+ * Query::HYDRATE_COLUMN. Defaults to 0.
+ *
+ * @return array
+ */
+ function fetchAll($fetchStyle = PDO::FETCH_BOTH);
+
+ /**
+ * fetchColumn
+ * Returns a single column from the next row of a
+ * result set or FALSE if there are no more rows.
+ *
+ * @param integer $columnIndex 0-indexed number of the column you wish to retrieve from the row. If no
+ * value is supplied, PDOStatement->fetchColumn()
+ * fetches the first column.
+ *
+ * @return string returns a single column in the next row of a result set.
+ */
+ function fetchColumn($columnIndex = 0);
+
+ /**
+ * rowCount
+ * rowCount() returns the number of rows affected by the last DELETE, INSERT, or UPDATE statement
+ * executed by the corresponding object.
+ *
+ * If the last SQL statement executed by the associated Statement object was a SELECT statement,
+ * some databases may return the number of rows returned by that statement. However,
+ * this behaviour is not guaranteed for all databases and should not be
+ * relied on for portable applications.
+ *
+ * @return integer Returns the number of rows.
+ */
+ function rowCount();
+}
\ No newline at end of file
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-dbal/lib/Doctrine/DBAL/DriverManager.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-dbal/lib/Doctrine/DBAL/DriverManager.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,161 @@
+.
+ */
+
+namespace Doctrine\DBAL;
+
+use Doctrine\Common\EventManager;
+
+/**
+ * Factory for creating Doctrine\DBAL\Connection instances.
+ *
+ * @author Roman Borschel
+ * @since 2.0
+ */
+final class DriverManager
+{
+ /**
+ * List of supported drivers and their mappings to the driver classes.
+ *
+ * @var array
+ * @todo REMOVE. Users should directly supply class names instead.
+ */
+ private static $_driverMap = array(
+ 'pdo_mysql' => 'Doctrine\DBAL\Driver\PDOMySql\Driver',
+ 'pdo_sqlite' => 'Doctrine\DBAL\Driver\PDOSqlite\Driver',
+ 'pdo_pgsql' => 'Doctrine\DBAL\Driver\PDOPgSql\Driver',
+ 'pdo_oci' => 'Doctrine\DBAL\Driver\PDOOracle\Driver',
+ 'oci8' => 'Doctrine\DBAL\Driver\OCI8\Driver',
+ 'ibm_db2' => 'Doctrine\DBAL\Driver\IBMDB2\DB2Driver',
+ 'pdo_ibm' => 'Doctrine\DBAL\Driver\PDOIbm\Driver',
+ 'pdo_sqlsrv' => 'Doctrine\DBAL\Driver\PDOSqlsrv\Driver',
+ );
+
+ /** Private constructor. This class cannot be instantiated. */
+ private function __construct() { }
+
+ /**
+ * Creates a connection object based on the specified parameters.
+ * This method returns a Doctrine\DBAL\Connection which wraps the underlying
+ * driver connection.
+ *
+ * $params must contain at least one of the following.
+ *
+ * Either 'driver' with one of the following values:
+ * pdo_mysql
+ * pdo_sqlite
+ * pdo_pgsql
+ * pdo_oracle
+ * pdo_sqlsrv
+ *
+ * OR 'driverClass' that contains the full class name (with namespace) of the
+ * driver class to instantiate.
+ *
+ * Other (optional) parameters:
+ *
+ * user (string):
+ * The username to use when connecting.
+ *
+ * password (string):
+ * The password to use when connecting.
+ *
+ * driverOptions (array):
+ * Any additional driver-specific options for the driver. These are just passed
+ * through to the driver.
+ *
+ * pdo:
+ * You can pass an existing PDO instance through this parameter. The PDO
+ * instance will be wrapped in a Doctrine\DBAL\Connection.
+ *
+ * wrapperClass:
+ * You may specify a custom wrapper class through the 'wrapperClass'
+ * parameter but this class MUST inherit from Doctrine\DBAL\Connection.
+ *
+ * @param array $params The parameters.
+ * @param Doctrine\DBAL\Configuration The configuration to use.
+ * @param Doctrine\Common\EventManager The event manager to use.
+ * @return Doctrine\DBAL\Connection
+ */
+ public static function getConnection(
+ array $params,
+ Configuration $config = null,
+ EventManager $eventManager = null)
+ {
+ // create default config and event manager, if not set
+ if ( ! $config) {
+ $config = new Configuration();
+ }
+ if ( ! $eventManager) {
+ $eventManager = new EventManager();
+ }
+
+ // check for existing pdo object
+ if (isset($params['pdo']) && ! $params['pdo'] instanceof \PDO) {
+ throw DBALException::invalidPdoInstance();
+ } else if (isset($params['pdo'])) {
+ $params['pdo']->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
+ $params['driver'] = 'pdo_' . $params['pdo']->getAttribute(\PDO::ATTR_DRIVER_NAME);
+ } else {
+ self::_checkParams($params);
+ }
+ if (isset($params['driverClass'])) {
+ $className = $params['driverClass'];
+ } else {
+ $className = self::$_driverMap[$params['driver']];
+ }
+
+ $driver = new $className();
+
+ $wrapperClass = 'Doctrine\DBAL\Connection';
+ if (isset($params['wrapperClass'])) {
+ if (is_subclass_of($params['wrapperClass'], $wrapperClass)) {
+ $wrapperClass = $params['wrapperClass'];
+ } else {
+ throw DBALException::invalidWrapperClass($params['wrapperClass']);
+ }
+ }
+
+ return new $wrapperClass($params, $driver, $config, $eventManager);
+ }
+
+ /**
+ * Checks the list of parameters.
+ *
+ * @param array $params
+ */
+ private static function _checkParams(array $params)
+ {
+ // check existance of mandatory parameters
+
+ // driver
+ if ( ! isset($params['driver']) && ! isset($params['driverClass'])) {
+ throw DBALException::driverRequired();
+ }
+
+ // check validity of parameters
+
+ // driver
+ if ( isset($params['driver']) && ! isset(self::$_driverMap[$params['driver']])) {
+ throw DBALException::unknownDriver($params['driver'], array_keys(self::$_driverMap));
+ }
+
+ if (isset($params['driverClass']) && ! in_array('Doctrine\DBAL\Driver', class_implements($params['driverClass'], true))) {
+ throw DBALException::invalidDriverClass($params['driverClass']);
+ }
+ }
+}
\ No newline at end of file
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-dbal/lib/Doctrine/DBAL/Event/ConnectionEventArgs.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-dbal/lib/Doctrine/DBAL/Event/ConnectionEventArgs.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,79 @@
+.
+*/
+
+namespace Doctrine\DBAL\Event;
+
+use Doctrine\Common\EventArgs,
+ Doctrine\DBAL\Connection;
+
+/**
+ * Event Arguments used when a Driver connection is established inside Doctrine\DBAL\Connection.
+ *
+ * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
+ * @link www.doctrine-project.com
+ * @since 1.0
+ * @version $Revision$
+ * @author Benjamin Eberlei
+ */
+class ConnectionEventArgs extends EventArgs
+{
+ /**
+ * @var Connection
+ */
+ private $_connection = null;
+
+ public function __construct(Connection $connection)
+ {
+ $this->_connection = $connection;
+ }
+
+ /**
+ * @return Doctrine\DBAL\Connection
+ */
+ public function getConnection()
+ {
+ return $this->_connection;
+ }
+
+ /**
+ * @return Doctrine\DBAL\Driver
+ */
+ public function getDriver()
+ {
+ return $this->_connection->getDriver();
+ }
+
+ /**
+ * @return Doctrine\DBAL\Platforms\AbstractPlatform
+ */
+ public function getDatabasePlatform()
+ {
+ return $this->_connection->getDatabasePlatform();
+ }
+
+ /**
+ * @return Doctrine\DBAL\Schema\AbstractSchemaManager
+ */
+ public function getSchemaManager()
+ {
+ return $this->_connection->getSchemaManager();
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-dbal/lib/Doctrine/DBAL/Event/Listeners/MysqlSessionInit.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-dbal/lib/Doctrine/DBAL/Event/Listeners/MysqlSessionInit.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,74 @@
+.
+*/
+
+namespace Doctrine\DBAL\Event\Listeners;
+
+use Doctrine\DBAL\Event\ConnectionEventArgs;
+use Doctrine\DBAL\Events;
+use Doctrine\Common\EventSubscriber;
+
+/**
+ * MySQL Session Init Event Subscriber which allows to set the Client Encoding of the Connection
+ *
+ * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
+ * @link www.doctrine-project.com
+ * @since 1.0
+ * @version $Revision$
+ * @author Benjamin Eberlei
+ * @deprecated Use "charset" option to PDO MySQL Connection instead.
+ */
+class MysqlSessionInit implements EventSubscriber
+{
+ /**
+ * @var string
+ */
+ private $_charset;
+
+ /**
+ * @var string
+ */
+ private $_collation;
+
+ /**
+ * Configure Charset and Collation options of MySQL Client for each Connection
+ *
+ * @param string $charset
+ * @param string $collation
+ */
+ public function __construct($charset = 'utf8', $collation = false)
+ {
+ $this->_charset = $charset;
+ $this->_collation = $collation;
+ }
+
+ /**
+ * @param ConnectionEventArgs $args
+ * @return void
+ */
+ public function postConnect(ConnectionEventArgs $args)
+ {
+ $collation = ($this->_collation) ? " COLLATE ".$this->_collation : "";
+ $args->getConnection()->executeUpdate("SET NAMES ".$this->_charset . $collation);
+ }
+
+ public function getSubscribedEvents()
+ {
+ return array(Events::postConnect);
+ }
+}
\ No newline at end of file
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-dbal/lib/Doctrine/DBAL/Event/Listeners/OracleSessionInit.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-dbal/lib/Doctrine/DBAL/Event/Listeners/OracleSessionInit.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,82 @@
+.
+*/
+
+namespace Doctrine\DBAL\Event\Listeners;
+
+use Doctrine\DBAL\Event\ConnectionEventArgs;
+use Doctrine\DBAL\Events;
+use Doctrine\Common\EventSubscriber;
+
+/**
+ * Should be used when Oracle Server default enviroment does not match the Doctrine requirements.
+ *
+ * The following enviroment variables are required for the Doctrine default date format:
+ *
+ * NLS_TIME_FORMAT="HH24:MI:SS"
+ * NLS_DATE_FORMAT="YYYY-MM-DD"
+ * NLS_TIMESTAMP_FORMAT="YYYY-MM-DD HH24:MI:SS"
+ * NLS_TIMESTAMP_TZ_FORMAT="YYYY-MM-DD HH24:MI:SS TZH:TZM"
+ *
+ * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
+ * @link www.doctrine-project.com
+ * @since 1.0
+ * @version $Revision$
+ * @author Benjamin Eberlei
+ */
+class OracleSessionInit implements EventSubscriber
+{
+ protected $_defaultSessionVars = array(
+ 'NLS_TIME_FORMAT' => "HH24:MI:SS",
+ 'NLS_DATE_FORMAT' => "YYYY-MM-DD HH24:MI:SS",
+ 'NLS_TIMESTAMP_FORMAT' => "YYYY-MM-DD HH24:MI:SS",
+ 'NLS_TIMESTAMP_TZ_FORMAT' => "YYYY-MM-DD HH24:MI:SS TZH:TZM",
+ );
+
+ /**
+ * @param array $oracleSessionVars
+ */
+ public function __construct(array $oracleSessionVars = array())
+ {
+ $this->_defaultSessionVars = array_merge($this->_defaultSessionVars, $oracleSessionVars);
+ }
+
+ /**
+ * @param ConnectionEventArgs $args
+ * @return void
+ */
+ public function postConnect(ConnectionEventArgs $args)
+ {
+ if (count($this->_defaultSessionVars)) {
+ array_change_key_case($this->_defaultSessionVars, \CASE_UPPER);
+ $vars = array();
+ foreach ($this->_defaultSessionVars AS $option => $value) {
+ $vars[] = $option." = '".$value."'";
+ }
+ $sql = "ALTER SESSION SET ".implode(" ", $vars);
+ $args->getConnection()->executeUpdate($sql);
+ }
+ }
+
+ public function getSubscribedEvents()
+ {
+ return array(Events::postConnect);
+ }
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-dbal/lib/Doctrine/DBAL/Events.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-dbal/lib/Doctrine/DBAL/Events.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,38 @@
+.
+ */
+
+namespace Doctrine\DBAL;
+
+/**
+ * Container for all DBAL events.
+ *
+ * This class cannot be instantiated.
+ *
+ * @author Roman Borschel
+ * @since 2.0
+ */
+final class Events
+{
+ private function __construct() {}
+
+ const postConnect = 'postConnect';
+}
+
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-dbal/lib/Doctrine/DBAL/LockMode.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-dbal/lib/Doctrine/DBAL/LockMode.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,42 @@
+.
+*/
+
+namespace Doctrine\DBAL;
+
+/**
+ * Contains all DBAL LockModes
+ *
+ * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
+ * @link www.doctrine-project.com
+ * @since 1.0
+ * @version $Revision$
+ * @author Benjamin Eberlei
+ * @author Roman Borschel
+ */
+class LockMode
+{
+ const NONE = 0;
+ const OPTIMISTIC = 1;
+ const PESSIMISTIC_READ = 2;
+ const PESSIMISTIC_WRITE = 4;
+
+ final private function __construct() { }
+}
\ No newline at end of file
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-dbal/lib/Doctrine/DBAL/Logging/DebugStack.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-dbal/lib/Doctrine/DBAL/Logging/DebugStack.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,67 @@
+.
+ */
+
+namespace Doctrine\DBAL\Logging;
+
+/**
+ * Includes executed SQLs in a Debug Stack
+ *
+ * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
+ * @link www.doctrine-project.org
+ * @since 2.0
+ * @version $Revision$
+ * @author Benjamin Eberlei
+ * @author Guilherme Blanco
+ * @author Jonathan Wage
+ * @author Roman Borschel
+ */
+class DebugStack implements SQLLogger
+{
+ /** @var array $queries Executed SQL queries. */
+ public $queries = array();
+
+ /** @var boolean $enabled If Debug Stack is enabled (log queries) or not. */
+ public $enabled = true;
+
+ public $start = null;
+
+ public $currentQuery = 0;
+
+ /**
+ * {@inheritdoc}
+ */
+ public function startQuery($sql, array $params = null, array $types = null)
+ {
+ if ($this->enabled) {
+ $this->start = microtime(true);
+ $this->queries[++$this->currentQuery] = array('sql' => $sql, 'params' => $params, 'types' => $types, 'executionMS' => 0);
+ }
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function stopQuery()
+ {
+ $this->queries[$this->currentQuery]['executionMS'] = microtime(true) - $this->start;
+ }
+}
+
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-dbal/lib/Doctrine/DBAL/Logging/EchoSQLLogger.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-dbal/lib/Doctrine/DBAL/Logging/EchoSQLLogger.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,61 @@
+.
+ */
+
+namespace Doctrine\DBAL\Logging;
+
+/**
+ * A SQL logger that logs to the standard output using echo/var_dump.
+ *
+ * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
+ * @link www.doctrine-project.org
+ * @since 2.0
+ * @version $Revision$
+ * @author Benjamin Eberlei
+ * @author Guilherme Blanco
+ * @author Jonathan Wage
+ * @author Roman Borschel
+ */
+class EchoSQLLogger implements SQLLogger
+{
+ /**
+ * {@inheritdoc}
+ */
+ public function startQuery($sql, array $params = null, array $types = null)
+ {
+ echo $sql . PHP_EOL;
+
+ if ($params) {
+ var_dump($params);
+ }
+
+ if ($types) {
+ var_dump($types);
+ }
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function stopQuery()
+ {
+
+ }
+}
\ No newline at end of file
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-dbal/lib/Doctrine/DBAL/Logging/SQLLogger.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-dbal/lib/Doctrine/DBAL/Logging/SQLLogger.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,54 @@
+.
+ */
+
+namespace Doctrine\DBAL\Logging;
+
+/**
+ * Interface for SQL loggers.
+ *
+ * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
+ * @link www.doctrine-project.org
+ * @since 2.0
+ * @version $Revision$
+ * @author Benjamin Eberlei
+ * @author Guilherme Blanco
+ * @author Jonathan Wage
+ * @author Roman Borschel
+ */
+interface SQLLogger
+{
+ /**
+ * Logs a SQL statement somewhere.
+ *
+ * @param string $sql The SQL to be executed.
+ * @param array $params The SQL parameters.
+ * @param array $types The SQL parameter types.
+ * @return void
+ */
+ public function startQuery($sql, array $params = null, array $types = null);
+
+ /**
+ * Mark the last started query as stopped. This can be used for timing of queries.
+ *
+ * @return void
+ */
+ public function stopQuery();
+}
\ No newline at end of file
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-dbal/lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-dbal/lib/Doctrine/DBAL/Platforms/AbstractPlatform.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,2357 @@
+.
+ */
+
+namespace Doctrine\DBAL\Platforms;
+
+use Doctrine\DBAL\DBALException,
+ Doctrine\DBAL\Connection,
+ Doctrine\DBAL\Types,
+ Doctrine\DBAL\Schema\Table,
+ Doctrine\DBAL\Schema\Index,
+ Doctrine\DBAL\Schema\ForeignKeyConstraint,
+ Doctrine\DBAL\Schema\TableDiff,
+ Doctrine\DBAL\Schema\Column,
+ Doctrine\DBAL\Types\Type;
+
+/**
+ * Base class for all DatabasePlatforms. The DatabasePlatforms are the central
+ * point of abstraction of platform-specific behaviors, features and SQL dialects.
+ * They are a passive source of information.
+ *
+ * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
+ * @link www.doctrine-project.org
+ * @since 2.0
+ * @version $Revision: 3938 $
+ * @author Guilherme Blanco
+ * @author Jonathan Wage
+ * @author Roman Borschel
+ * @author Lukas Smith (PEAR MDB2 library)
+ * @author Benjamin Eberlei
+ * @todo Remove any unnecessary methods.
+ */
+abstract class AbstractPlatform
+{
+ /**
+ * @var int
+ */
+ const CREATE_INDEXES = 1;
+
+ /**
+ * @var int
+ */
+ const CREATE_FOREIGNKEYS = 2;
+
+ /**
+ * @var int
+ */
+ const TRIM_UNSPECIFIED = 0;
+
+ /**
+ * @var int
+ */
+ const TRIM_LEADING = 1;
+
+ /**
+ * @var int
+ */
+ const TRIM_TRAILING = 2;
+
+ /**
+ * @var int
+ */
+ const TRIM_BOTH = 3;
+
+ /**
+ * @var array
+ */
+ protected $doctrineTypeMapping = null;
+
+ /**
+ * Contains a list of all columns that should generate parseable column comments for type-detection
+ * in reverse engineering scenarios.
+ *
+ * @var array
+ */
+ protected $doctrineTypeComments = null;
+
+ /**
+ * Constructor.
+ */
+ public function __construct() {}
+
+ /**
+ * Gets the SQL snippet that declares a boolean column.
+ *
+ * @param array $columnDef
+ * @return string
+ */
+ abstract public function getBooleanTypeDeclarationSQL(array $columnDef);
+
+ /**
+ * Gets the SQL snippet that declares a 4 byte integer column.
+ *
+ * @param array $columnDef
+ * @return string
+ */
+ abstract public function getIntegerTypeDeclarationSQL(array $columnDef);
+
+ /**
+ * Gets the SQL snippet that declares an 8 byte integer column.
+ *
+ * @param array $columnDef
+ * @return string
+ */
+ abstract public function getBigIntTypeDeclarationSQL(array $columnDef);
+
+ /**
+ * Gets the SQL snippet that declares a 2 byte integer column.
+ *
+ * @param array $columnDef
+ * @return string
+ */
+ abstract public function getSmallIntTypeDeclarationSQL(array $columnDef);
+
+ /**
+ * Gets the SQL snippet that declares common properties of an integer column.
+ *
+ * @param array $columnDef
+ * @return string
+ */
+ abstract protected function _getCommonIntegerTypeDeclarationSQL(array $columnDef);
+
+ /**
+ * Lazy load Doctrine Type Mappings
+ *
+ * @return void
+ */
+ abstract protected function initializeDoctrineTypeMappings();
+
+ /**
+ * Gets the SQL snippet used to declare a VARCHAR column type.
+ *
+ * @param array $field
+ */
+ public function getVarcharTypeDeclarationSQL(array $field)
+ {
+ if ( !isset($field['length'])) {
+ $field['length'] = $this->getVarcharDefaultLength();
+ }
+
+ $fixed = (isset($field['fixed'])) ? $field['fixed'] : false;
+
+ if ($field['length'] > $this->getVarcharMaxLength()) {
+ return $this->getClobTypeDeclarationSQL($field);
+ } else {
+ return $this->getVarcharTypeDeclarationSQLSnippet($field['length'], $fixed);
+ }
+ }
+
+ protected function getVarcharTypeDeclarationSQLSnippet($length, $fixed)
+ {
+ throw DBALException::notSupported('VARCHARs not supported by Platform.');
+ }
+
+ /**
+ * Gets the SQL snippet used to declare a CLOB column type.
+ *
+ * @param array $field
+ */
+ abstract public function getClobTypeDeclarationSQL(array $field);
+
+ /**
+ * Gets the name of the platform.
+ *
+ * @return string
+ */
+ abstract public function getName();
+
+ /**
+ * Register a doctrine type to be used in conjunction with a column type of this platform.
+ *
+ * @param string $dbType
+ * @param string $doctrineType
+ */
+ public function registerDoctrineTypeMapping($dbType, $doctrineType)
+ {
+ if ($this->doctrineTypeMapping === null) {
+ $this->initializeDoctrineTypeMappings();
+ }
+
+ if (!Types\Type::hasType($doctrineType)) {
+ throw DBALException::typeNotFound($doctrineType);
+ }
+
+ $dbType = strtolower($dbType);
+ $this->doctrineTypeMapping[$dbType] = $doctrineType;
+ }
+
+ /**
+ * Get the Doctrine type that is mapped for the given database column type.
+ *
+ * @param string $dbType
+ * @return string
+ */
+ public function getDoctrineTypeMapping($dbType)
+ {
+ if ($this->doctrineTypeMapping === null) {
+ $this->initializeDoctrineTypeMappings();
+ }
+
+ $dbType = strtolower($dbType);
+ if (isset($this->doctrineTypeMapping[$dbType])) {
+ return $this->doctrineTypeMapping[$dbType];
+ } else {
+ throw new \Doctrine\DBAL\DBALException("Unknown database type ".$dbType." requested, " . get_class($this) . " may not support it.");
+ }
+ }
+
+ /**
+ * Check if a database type is currently supported by this platform.
+ *
+ * @param string $dbType
+ * @return bool
+ */
+ public function hasDoctrineTypeMappingFor($dbType)
+ {
+ if ($this->doctrineTypeMapping === null) {
+ $this->initializeDoctrineTypeMappings();
+ }
+
+ $dbType = strtolower($dbType);
+ return isset($this->doctrineTypeMapping[$dbType]);
+ }
+
+ /**
+ * Initialize the Doctrine Type comments instance variable for in_array() checks.
+ *
+ * @return void
+ */
+ protected function initializeCommentedDoctrineTypes()
+ {
+ $this->doctrineTypeComments = array(Type::TARRAY, Type::OBJECT);
+ }
+
+ /**
+ * Is it necessary for the platform to add a parsable type comment to allow reverse engineering the given type?
+ *
+ * @param Type $doctrineType
+ * @return bool
+ */
+ public function isCommentedDoctrineType(Type $doctrineType)
+ {
+ if ($this->doctrineTypeComments === null) {
+ $this->initializeCommentedDoctrineTypes();
+ }
+
+ return in_array($doctrineType->getName(), $this->doctrineTypeComments);
+ }
+
+ /**
+ * Mark this type as to be commented in ALTER TABLE and CREATE TABLE statements.
+ *
+ * @param Type $doctrineType
+ * @return void
+ */
+ public function markDoctrineTypeCommented(Type $doctrineType)
+ {
+ if ($this->doctrineTypeComments === null) {
+ $this->initializeCommentedDoctrineTypes();
+ }
+ $this->doctrineTypeComments[] = $doctrineType->getName();
+ }
+
+ /**
+ * Get the comment to append to a column comment that helps parsing this type in reverse engineering.
+ *
+ * @param Type $doctrineType
+ * @return string
+ */
+ public function getDoctrineTypeComment(Type $doctrineType)
+ {
+ return '(DC2Type:' . $doctrineType->getName() . ')';
+ }
+
+ /**
+ * Return the comment of a passed column modified by potential doctrine type comment hints.
+ *
+ * @param Column $column
+ * @return string
+ */
+ protected function getColumnComment(Column $column)
+ {
+ $comment = $column->getComment();
+ if ($this->isCommentedDoctrineType($column->getType())) {
+ $comment .= $this->getDoctrineTypeComment($column->getType());
+ }
+ return $comment;
+ }
+
+ /**
+ * Gets the character used for identifier quoting.
+ *
+ * @return string
+ */
+ public function getIdentifierQuoteCharacter()
+ {
+ return '"';
+ }
+
+ /**
+ * Gets the string portion that starts an SQL comment.
+ *
+ * @return string
+ */
+ public function getSqlCommentStartString()
+ {
+ return "--";
+ }
+
+ /**
+ * Gets the string portion that ends an SQL comment.
+ *
+ * @return string
+ */
+ public function getSqlCommentEndString()
+ {
+ return "\n";
+ }
+
+ /**
+ * Gets the maximum length of a varchar field.
+ *
+ * @return integer
+ */
+ public function getVarcharMaxLength()
+ {
+ return 4000;
+ }
+
+ /**
+ * Gets the default length of a varchar field.
+ *
+ * @return integer
+ */
+ public function getVarcharDefaultLength()
+ {
+ return 255;
+ }
+
+ /**
+ * Gets all SQL wildcard characters of the platform.
+ *
+ * @return array
+ */
+ public function getWildcards()
+ {
+ return array('%', '_');
+ }
+
+ /**
+ * Returns the regular expression operator.
+ *
+ * @return string
+ */
+ public function getRegexpExpression()
+ {
+ throw DBALException::notSupported(__METHOD__);
+ }
+
+ /**
+ * Returns the average value of a column
+ *
+ * @param string $column the column to use
+ * @return string generated sql including an AVG aggregate function
+ */
+ public function getAvgExpression($column)
+ {
+ return 'AVG(' . $column . ')';
+ }
+
+ /**
+ * Returns the number of rows (without a NULL value) of a column
+ *
+ * If a '*' is used instead of a column the number of selected rows
+ * is returned.
+ *
+ * @param string|integer $column the column to use
+ * @return string generated sql including a COUNT aggregate function
+ */
+ public function getCountExpression($column)
+ {
+ return 'COUNT(' . $column . ')';
+ }
+
+ /**
+ * Returns the highest value of a column
+ *
+ * @param string $column the column to use
+ * @return string generated sql including a MAX aggregate function
+ */
+ public function getMaxExpression($column)
+ {
+ return 'MAX(' . $column . ')';
+ }
+
+ /**
+ * Returns the lowest value of a column
+ *
+ * @param string $column the column to use
+ * @return string
+ */
+ public function getMinExpression($column)
+ {
+ return 'MIN(' . $column . ')';
+ }
+
+ /**
+ * Returns the total sum of a column
+ *
+ * @param string $column the column to use
+ * @return string
+ */
+ public function getSumExpression($column)
+ {
+ return 'SUM(' . $column . ')';
+ }
+
+ // scalar functions
+
+ /**
+ * Returns the md5 sum of a field.
+ *
+ * Note: Not SQL92, but common functionality
+ *
+ * @return string
+ */
+ public function getMd5Expression($column)
+ {
+ return 'MD5(' . $column . ')';
+ }
+
+ /**
+ * Returns the length of a text field.
+ *
+ * @param string $expression1
+ * @param string $expression2
+ * @return string
+ */
+ public function getLengthExpression($column)
+ {
+ return 'LENGTH(' . $column . ')';
+ }
+
+ /**
+ * Rounds a numeric field to the number of decimals specified.
+ *
+ * @param string $expression1
+ * @param string $expression2
+ * @return string
+ */
+ public function getRoundExpression($column, $decimals = 0)
+ {
+ return 'ROUND(' . $column . ', ' . $decimals . ')';
+ }
+
+ /**
+ * Returns the remainder of the division operation
+ * $expression1 / $expression2.
+ *
+ * @param string $expression1
+ * @param string $expression2
+ * @return string
+ */
+ public function getModExpression($expression1, $expression2)
+ {
+ return 'MOD(' . $expression1 . ', ' . $expression2 . ')';
+ }
+
+ /**
+ * Trim a string, leading/trailing/both and with a given char which defaults to space.
+ *
+ * @param string $str
+ * @param int $pos
+ * @param string $char has to be quoted already
+ * @return string
+ */
+ public function getTrimExpression($str, $pos = self::TRIM_UNSPECIFIED, $char = false)
+ {
+ $posStr = '';
+ $trimChar = ($char != false) ? $char . ' FROM ' : '';
+
+ if ($pos == self::TRIM_LEADING) {
+ $posStr = 'LEADING '.$trimChar;
+ } else if($pos == self::TRIM_TRAILING) {
+ $posStr = 'TRAILING '.$trimChar;
+ } else if($pos == self::TRIM_BOTH) {
+ $posStr = 'BOTH '.$trimChar;
+ }
+
+ return 'TRIM(' . $posStr . $str . ')';
+ }
+
+ /**
+ * rtrim
+ * returns the string $str with proceeding space characters removed
+ *
+ * @param string $str literal string or column name
+ * @return string
+ */
+ public function getRtrimExpression($str)
+ {
+ return 'RTRIM(' . $str . ')';
+ }
+
+ /**
+ * ltrim
+ * returns the string $str with leading space characters removed
+ *
+ * @param string $str literal string or column name
+ * @return string
+ */
+ public function getLtrimExpression($str)
+ {
+ return 'LTRIM(' . $str . ')';
+ }
+
+ /**
+ * upper
+ * Returns the string $str with all characters changed to
+ * uppercase according to the current character set mapping.
+ *
+ * @param string $str literal string or column name
+ * @return string
+ */
+ public function getUpperExpression($str)
+ {
+ return 'UPPER(' . $str . ')';
+ }
+
+ /**
+ * lower
+ * Returns the string $str with all characters changed to
+ * lowercase according to the current character set mapping.
+ *
+ * @param string $str literal string or column name
+ * @return string
+ */
+ public function getLowerExpression($str)
+ {
+ return 'LOWER(' . $str . ')';
+ }
+
+ /**
+ * returns the position of the first occurrence of substring $substr in string $str
+ *
+ * @param string $substr literal string to find
+ * @param string $str literal string
+ * @param int $pos position to start at, beginning of string by default
+ * @return integer
+ */
+ public function getLocateExpression($str, $substr, $startPos = false)
+ {
+ throw DBALException::notSupported(__METHOD__);
+ }
+
+ /**
+ * Returns the current system date.
+ *
+ * @return string
+ */
+ public function getNowExpression()
+ {
+ return 'NOW()';
+ }
+
+ /**
+ * return string to call a function to get a substring inside an SQL statement
+ *
+ * Note: Not SQL92, but common functionality.
+ *
+ * SQLite only supports the 2 parameter variant of this function
+ *
+ * @param string $value an sql string literal or column name/alias
+ * @param integer $from where to start the substring portion
+ * @param integer $len the substring portion length
+ * @return string
+ */
+ public function getSubstringExpression($value, $from, $len = null)
+ {
+ if ($len === null)
+ return 'SUBSTRING(' . $value . ' FROM ' . $from . ')';
+ else {
+ return 'SUBSTRING(' . $value . ' FROM ' . $from . ' FOR ' . $len . ')';
+ }
+ }
+
+ /**
+ * Returns a series of strings concatinated
+ *
+ * concat() accepts an arbitrary number of parameters. Each parameter
+ * must contain an expression
+ *
+ * @param string $arg1, $arg2 ... $argN strings that will be concatinated.
+ * @return string
+ */
+ public function getConcatExpression()
+ {
+ return join(' || ' , func_get_args());
+ }
+
+ /**
+ * Returns the SQL for a logical not.
+ *
+ * Example:
+ *
+ * $q = new Doctrine_Query();
+ * $e = $q->expr;
+ * $q->select('*')->from('table')
+ * ->where($e->eq('id', $e->not('null'));
+ *
+ *
+ * @return string a logical expression
+ */
+ public function getNotExpression($expression)
+ {
+ return 'NOT(' . $expression . ')';
+ }
+
+ /**
+ * Returns the SQL to check if a value is one in a set of
+ * given values.
+ *
+ * in() accepts an arbitrary number of parameters. The first parameter
+ * must always specify the value that should be matched against. Successive
+ * must contain a logical expression or an array with logical expressions.
+ * These expressions will be matched against the first parameter.
+ *
+ * @param string $column the value that should be matched against
+ * @param string|array(string) values that will be matched against $column
+ * @return string logical expression
+ */
+ public function getInExpression($column, $values)
+ {
+ if ( ! is_array($values)) {
+ $values = array($values);
+ }
+ $values = $this->getIdentifiers($values);
+
+ if (count($values) == 0) {
+ throw \InvalidArgumentException('Values must not be empty.');
+ }
+ return $column . ' IN (' . implode(', ', $values) . ')';
+ }
+
+ /**
+ * Returns SQL that checks if a expression is null.
+ *
+ * @param string $expression the expression that should be compared to null
+ * @return string logical expression
+ */
+ public function getIsNullExpression($expression)
+ {
+ return $expression . ' IS NULL';
+ }
+
+ /**
+ * Returns SQL that checks if a expression is not null.
+ *
+ * @param string $expression the expression that should be compared to null
+ * @return string logical expression
+ */
+ public function getIsNotNullExpression($expression)
+ {
+ return $expression . ' IS NOT NULL';
+ }
+
+ /**
+ * Returns SQL that checks if an expression evaluates to a value between
+ * two values.
+ *
+ * The parameter $expression is checked if it is between $value1 and $value2.
+ *
+ * Note: There is a slight difference in the way BETWEEN works on some databases.
+ * http://www.w3schools.com/sql/sql_between.asp. If you want complete database
+ * independence you should avoid using between().
+ *
+ * @param string $expression the value to compare to
+ * @param string $value1 the lower value to compare with
+ * @param string $value2 the higher value to compare with
+ * @return string logical expression
+ */
+ public function getBetweenExpression($expression, $value1, $value2)
+ {
+ return $expression . ' BETWEEN ' .$value1 . ' AND ' . $value2;
+ }
+
+ public function getAcosExpression($value)
+ {
+ return 'ACOS(' . $value . ')';
+ }
+
+ public function getSinExpression($value)
+ {
+ return 'SIN(' . $value . ')';
+ }
+
+ public function getPiExpression()
+ {
+ return 'PI()';
+ }
+
+ public function getCosExpression($value)
+ {
+ return 'COS(' . $value . ')';
+ }
+
+ /**
+ * Calculate the difference in days between the two passed dates.
+ *
+ * Computes diff = date1 - date2
+ *
+ * @param string $date1
+ * @param string $date2
+ * @return string
+ */
+ public function getDateDiffExpression($date1, $date2)
+ {
+ throw DBALException::notSupported(__METHOD__);
+ }
+
+ /**
+ * Add the number of given days to a date.
+ *
+ * @param string $date
+ * @param int $days
+ * @return string
+ */
+ public function getDateAddDaysExpression($date, $days)
+ {
+ throw DBALException::notSupported(__METHOD__);
+ }
+
+ /**
+ * Substract the number of given days to a date.
+ *
+ * @param string $date
+ * @param int $days
+ * @return string
+ */
+ public function getDateSubDaysExpression($date, $days)
+ {
+ throw DBALException::notSupported(__METHOD__);
+ }
+
+ /**
+ * Add the number of given months to a date.
+ *
+ * @param string $date
+ * @param int $months
+ * @return string
+ */
+ public function getDateAddMonthExpression($date, $months)
+ {
+ throw DBALException::notSupported(__METHOD__);
+ }
+
+ /**
+ * Substract the number of given months to a date.
+ *
+ * @param string $date
+ * @param int $months
+ * @return string
+ */
+ public function getDateSubMonthExpression($date, $months)
+ {
+ throw DBALException::notSupported(__METHOD__);
+ }
+
+ public function getForUpdateSQL()
+ {
+ return 'FOR UPDATE';
+ }
+
+ /**
+ * Honors that some SQL vendors such as MsSql use table hints for locking instead of the ANSI SQL FOR UPDATE specification.
+ *
+ * @param string $fromClause
+ * @param int $lockMode
+ * @return string
+ */
+ public function appendLockHint($fromClause, $lockMode)
+ {
+ return $fromClause;
+ }
+
+ /**
+ * Get the sql snippet to append to any SELECT statement which locks rows in shared read lock.
+ *
+ * This defaults to the ASNI SQL "FOR UPDATE", which is an exclusive lock (Write). Some database
+ * vendors allow to lighten this constraint up to be a real read lock.
+ *
+ * @return string
+ */
+ public function getReadLockSQL()
+ {
+ return $this->getForUpdateSQL();
+ }
+
+ /**
+ * Get the SQL snippet to append to any SELECT statement which obtains an exclusive lock on the rows.
+ *
+ * The semantics of this lock mode should equal the SELECT .. FOR UPDATE of the ASNI SQL standard.
+ *
+ * @return string
+ */
+ public function getWriteLockSQL()
+ {
+ return $this->getForUpdateSQL();
+ }
+
+ public function getDropDatabaseSQL($database)
+ {
+ return 'DROP DATABASE ' . $database;
+ }
+
+ /**
+ * Drop a Table
+ *
+ * @param Table|string $table
+ * @return string
+ */
+ public function getDropTableSQL($table)
+ {
+ if ($table instanceof \Doctrine\DBAL\Schema\Table) {
+ $table = $table->getQuotedName($this);
+ }
+
+ return 'DROP TABLE ' . $table;
+ }
+
+ /**
+ * Drop index from a table
+ *
+ * @param Index|string $name
+ * @param string|Table $table
+ * @return string
+ */
+ public function getDropIndexSQL($index, $table=null)
+ {
+ if($index instanceof \Doctrine\DBAL\Schema\Index) {
+ $index = $index->getQuotedName($this);
+ } else if(!is_string($index)) {
+ throw new \InvalidArgumentException('AbstractPlatform::getDropIndexSQL() expects $index parameter to be string or \Doctrine\DBAL\Schema\Index.');
+ }
+
+ return 'DROP INDEX ' . $index;
+ }
+
+ /**
+ * Get drop constraint sql
+ *
+ * @param \Doctrine\DBAL\Schema\Constraint $constraint
+ * @param string|Table $table
+ * @return string
+ */
+ public function getDropConstraintSQL($constraint, $table)
+ {
+ if ($constraint instanceof \Doctrine\DBAL\Schema\Constraint) {
+ $constraint = $constraint->getQuotedName($this);
+ }
+
+ if ($table instanceof \Doctrine\DBAL\Schema\Table) {
+ $table = $table->getQuotedName($this);
+ }
+
+ return 'ALTER TABLE ' . $table . ' DROP CONSTRAINT ' . $constraint;
+ }
+
+ /**
+ * @param ForeignKeyConstraint|string $foreignKey
+ * @param Table|string $table
+ * @return string
+ */
+ public function getDropForeignKeySQL($foreignKey, $table)
+ {
+ if ($foreignKey instanceof \Doctrine\DBAL\Schema\ForeignKeyConstraint) {
+ $foreignKey = $foreignKey->getQuotedName($this);
+ }
+
+ if ($table instanceof \Doctrine\DBAL\Schema\Table) {
+ $table = $table->getQuotedName($this);
+ }
+
+ return 'ALTER TABLE ' . $table . ' DROP FOREIGN KEY ' . $foreignKey;
+ }
+
+ /**
+ * Gets the SQL statement(s) to create a table with the specified name, columns and constraints
+ * on this platform.
+ *
+ * @param string $table The name of the table.
+ * @param int $createFlags
+ * @return array The sequence of SQL statements.
+ */
+ public function getCreateTableSQL(Table $table, $createFlags=self::CREATE_INDEXES)
+ {
+ if ( ! is_int($createFlags)) {
+ throw new \InvalidArgumentException("Second argument of AbstractPlatform::getCreateTableSQL() has to be integer.");
+ }
+
+ if (count($table->getColumns()) == 0) {
+ throw DBALException::noColumnsSpecifiedForTable($table->getName());
+ }
+
+ $tableName = $table->getQuotedName($this);
+ $options = $table->getOptions();
+ $options['uniqueConstraints'] = array();
+ $options['indexes'] = array();
+ $options['primary'] = array();
+
+ if (($createFlags&self::CREATE_INDEXES) > 0) {
+ foreach ($table->getIndexes() AS $index) {
+ /* @var $index Index */
+ if ($index->isPrimary()) {
+ $options['primary'] = $index->getColumns();
+ } else {
+ $options['indexes'][$index->getName()] = $index;
+ }
+ }
+ }
+
+ $columns = array();
+ foreach ($table->getColumns() AS $column) {
+ /* @var \Doctrine\DBAL\Schema\Column $column */
+ $columnData = array();
+ $columnData['name'] = $column->getQuotedName($this);
+ $columnData['type'] = $column->getType();
+ $columnData['length'] = $column->getLength();
+ $columnData['notnull'] = $column->getNotNull();
+ $columnData['fixed'] = $column->getFixed();
+ $columnData['unique'] = false; // TODO: what do we do about this?
+ $columnData['version'] = ($column->hasPlatformOption("version"))?$column->getPlatformOption('version'):false;
+ if(strtolower($columnData['type']) == "string" && $columnData['length'] === null) {
+ $columnData['length'] = 255;
+ }
+ $columnData['unsigned'] = $column->getUnsigned();
+ $columnData['precision'] = $column->getPrecision();
+ $columnData['scale'] = $column->getScale();
+ $columnData['default'] = $column->getDefault();
+ $columnData['columnDefinition'] = $column->getColumnDefinition();
+ $columnData['autoincrement'] = $column->getAutoincrement();
+ $columnData['comment'] = $this->getColumnComment($column);
+
+ if(in_array($column->getName(), $options['primary'])) {
+ $columnData['primary'] = true;
+ }
+
+ $columns[$columnData['name']] = $columnData;
+ }
+
+ if (($createFlags&self::CREATE_FOREIGNKEYS) > 0) {
+ $options['foreignKeys'] = array();
+ foreach ($table->getForeignKeys() AS $fkConstraint) {
+ $options['foreignKeys'][] = $fkConstraint;
+ }
+ }
+
+ $sql = $this->_getCreateTableSQL($tableName, $columns, $options);
+ if ($this->supportsCommentOnStatement()) {
+ foreach ($table->getColumns() AS $column) {
+ if ($column->getComment()) {
+ $sql[] = $this->getCommentOnColumnSQL($tableName, $column->getName(), $this->getColumnComment($column));
+ }
+ }
+ }
+ return $sql;
+ }
+
+ public function getCommentOnColumnSQL($tableName, $columnName, $comment)
+ {
+ return "COMMENT ON COLUMN " . $tableName . "." . $columnName . " IS '" . $comment . "'";
+ }
+
+ /**
+ * @param string $tableName
+ * @param array $columns
+ * @param array $options
+ * @return array
+ */
+ protected function _getCreateTableSQL($tableName, array $columns, array $options = array())
+ {
+ $columnListSql = $this->getColumnDeclarationListSQL($columns);
+
+ if (isset($options['uniqueConstraints']) && ! empty($options['uniqueConstraints'])) {
+ foreach ($options['uniqueConstraints'] as $name => $definition) {
+ $columnListSql .= ', ' . $this->getUniqueConstraintDeclarationSQL($name, $definition);
+ }
+ }
+
+ if (isset($options['primary']) && ! empty($options['primary'])) {
+ $columnListSql .= ', PRIMARY KEY(' . implode(', ', array_unique(array_values($options['primary']))) . ')';
+ }
+
+ if (isset($options['indexes']) && ! empty($options['indexes'])) {
+ foreach($options['indexes'] as $index => $definition) {
+ $columnListSql .= ', ' . $this->getIndexDeclarationSQL($index, $definition);
+ }
+ }
+
+ $query = 'CREATE TABLE ' . $tableName . ' (' . $columnListSql;
+
+ $check = $this->getCheckDeclarationSQL($columns);
+ if ( ! empty($check)) {
+ $query .= ', ' . $check;
+ }
+ $query .= ')';
+
+ $sql[] = $query;
+
+ if (isset($options['foreignKeys'])) {
+ foreach ((array) $options['foreignKeys'] AS $definition) {
+ $sql[] = $this->getCreateForeignKeySQL($definition, $tableName);
+ }
+ }
+
+ return $sql;
+ }
+
+ public function getCreateTemporaryTableSnippetSQL()
+ {
+ return "CREATE TEMPORARY TABLE";
+ }
+
+ /**
+ * Gets the SQL to create a sequence on this platform.
+ *
+ * @param \Doctrine\DBAL\Schema\Sequence $sequence
+ * @throws DBALException
+ */
+ public function getCreateSequenceSQL(\Doctrine\DBAL\Schema\Sequence $sequence)
+ {
+ throw DBALException::notSupported(__METHOD__);
+ }
+
+ /**
+ * Gets the SQL statement to change a sequence on this platform.
+ *
+ * @param \Doctrine\DBAL\Schema\Sequence $sequence
+ * @return string
+ */
+ public function getAlterSequenceSQL(\Doctrine\DBAL\Schema\Sequence $sequence)
+ {
+ throw DBALException::notSupported(__METHOD__);
+ }
+
+ /**
+ * Gets the SQL to create a constraint on a table on this platform.
+ *
+ * @param Constraint $constraint
+ * @param string|Table $table
+ * @return string
+ */
+ public function getCreateConstraintSQL(\Doctrine\DBAL\Schema\Constraint $constraint, $table)
+ {
+ if ($table instanceof \Doctrine\DBAL\Schema\Table) {
+ $table = $table->getQuotedName($this);
+ }
+
+ $query = 'ALTER TABLE ' . $table . ' ADD CONSTRAINT ' . $constraint->getQuotedName($this);
+
+ $columns = array();
+ foreach ($constraint->getColumns() as $column) {
+ $columns[] = $column;
+ }
+ $columnList = '('. implode(', ', $columns) . ')';
+
+ $referencesClause = '';
+ if ($constraint instanceof \Doctrine\DBAL\Schema\Index) {
+ if($constraint->isPrimary()) {
+ $query .= ' PRIMARY KEY';
+ } elseif ($constraint->isUnique()) {
+ $query .= ' UNIQUE';
+ } else {
+ throw new \InvalidArgumentException(
+ 'Can only create primary or unique constraints, no common indexes with getCreateConstraintSQL().'
+ );
+ }
+ } else if ($constraint instanceof \Doctrine\DBAL\Schema\ForeignKeyConstraint) {
+ $query .= ' FOREIGN KEY';
+
+ $foreignColumns = array();
+ foreach ($constraint->getForeignColumns() AS $column) {
+ $foreignColumns[] = $column;
+ }
+
+ $referencesClause = ' REFERENCES '.$constraint->getForeignTableName(). ' ('.implode(', ', $foreignColumns).')';
+ }
+ $query .= ' '.$columnList.$referencesClause;
+
+ return $query;
+ }
+
+ /**
+ * Gets the SQL to create an index on a table on this platform.
+ *
+ * @param Index $index
+ * @param string|Table $table name of the table on which the index is to be created
+ * @return string
+ */
+ public function getCreateIndexSQL(Index $index, $table)
+ {
+ if ($table instanceof Table) {
+ $table = $table->getQuotedName($this);
+ }
+ $name = $index->getQuotedName($this);
+ $columns = $index->getColumns();
+
+ if (count($columns) == 0) {
+ throw new \InvalidArgumentException("Incomplete definition. 'columns' required.");
+ }
+
+ if ($index->isPrimary()) {
+ return $this->getCreatePrimaryKeySQL($index, $table);
+ } else {
+ $type = '';
+ if ($index->isUnique()) {
+ $type = 'UNIQUE ';
+ }
+
+ $query = 'CREATE ' . $type . 'INDEX ' . $name . ' ON ' . $table;
+ $query .= ' (' . $this->getIndexFieldDeclarationListSQL($columns) . ')';
+ }
+
+ return $query;
+ }
+
+ /**
+ * Get SQL to create an unnamed primary key constraint.
+ *
+ * @param Index $index
+ * @param string|Table $table
+ * @return string
+ */
+ public function getCreatePrimaryKeySQL(Index $index, $table)
+ {
+ return 'ALTER TABLE ' . $table . ' ADD PRIMARY KEY (' . $this->getIndexFieldDeclarationListSQL($index->getColumns()) . ')';
+ }
+
+ /**
+ * Quotes a string so that it can be safely used as a table or column name,
+ * even if it is a reserved word of the platform.
+ *
+ * NOTE: Just because you CAN use quoted identifiers doesn't mean
+ * you SHOULD use them. In general, they end up causing way more
+ * problems than they solve.
+ *
+ * @param string $str identifier name to be quoted
+ * @return string quoted identifier string
+ */
+ public function quoteIdentifier($str)
+ {
+ $c = $this->getIdentifierQuoteCharacter();
+
+ return $c . $str . $c;
+ }
+
+ /**
+ * Create a new foreign key
+ *
+ * @param ForeignKeyConstraint $foreignKey ForeignKey instance
+ * @param string|Table $table name of the table on which the foreign key is to be created
+ * @return string
+ */
+ public function getCreateForeignKeySQL(ForeignKeyConstraint $foreignKey, $table)
+ {
+ if ($table instanceof \Doctrine\DBAL\Schema\Table) {
+ $table = $table->getQuotedName($this);
+ }
+
+ $query = 'ALTER TABLE ' . $table . ' ADD ' . $this->getForeignKeyDeclarationSQL($foreignKey);
+
+ return $query;
+ }
+
+ /**
+ * Gets the sql statements for altering an existing table.
+ *
+ * The method returns an array of sql statements, since some platforms need several statements.
+ *
+ * @param TableDiff $diff
+ * @return array
+ */
+ public function getAlterTableSQL(TableDiff $diff)
+ {
+ throw DBALException::notSupported(__METHOD__);
+ }
+
+ protected function getPreAlterTableIndexForeignKeySQL(TableDiff $diff)
+ {
+ $tableName = $diff->name;
+
+ $sql = array();
+ if ($this->supportsForeignKeyConstraints()) {
+ foreach ($diff->removedForeignKeys AS $foreignKey) {
+ $sql[] = $this->getDropForeignKeySQL($foreignKey, $tableName);
+ }
+ foreach ($diff->changedForeignKeys AS $foreignKey) {
+ $sql[] = $this->getDropForeignKeySQL($foreignKey, $tableName);
+ }
+ }
+
+ foreach ($diff->removedIndexes AS $index) {
+ $sql[] = $this->getDropIndexSQL($index, $tableName);
+ }
+ foreach ($diff->changedIndexes AS $index) {
+ $sql[] = $this->getDropIndexSQL($index, $tableName);
+ }
+
+ return $sql;
+ }
+
+ protected function getPostAlterTableIndexForeignKeySQL(TableDiff $diff)
+ {
+ if ($diff->newName !== false) {
+ $tableName = $diff->newName;
+ } else {
+ $tableName = $diff->name;
+ }
+
+ $sql = array();
+ if ($this->supportsForeignKeyConstraints()) {
+ foreach ($diff->addedForeignKeys AS $foreignKey) {
+ $sql[] = $this->getCreateForeignKeySQL($foreignKey, $tableName);
+ }
+ foreach ($diff->changedForeignKeys AS $foreignKey) {
+ $sql[] = $this->getCreateForeignKeySQL($foreignKey, $tableName);
+ }
+ }
+
+ foreach ($diff->addedIndexes AS $index) {
+ $sql[] = $this->getCreateIndexSQL($index, $tableName);
+ }
+ foreach ($diff->changedIndexes AS $index) {
+ $sql[] = $this->getCreateIndexSQL($index, $tableName);
+ }
+
+ return $sql;
+ }
+
+ /**
+ * Common code for alter table statement generation that updates the changed Index and Foreign Key definitions.
+ *
+ * @param TableDiff $diff
+ * @return array
+ */
+ protected function _getAlterTableIndexForeignKeySQL(TableDiff $diff)
+ {
+ return array_merge($this->getPreAlterTableIndexForeignKeySQL($diff), $this->getPostAlterTableIndexForeignKeySQL($diff));
+ }
+
+ /**
+ * Get declaration of a number of fields in bulk
+ *
+ * @param array $fields a multidimensional associative array.
+ * The first dimension determines the field name, while the second
+ * dimension is keyed with the name of the properties
+ * of the field being declared as array indexes. Currently, the types
+ * of supported field properties are as follows:
+ *
+ * length
+ * Integer value that determines the maximum length of the text
+ * field. If this argument is missing the field should be
+ * declared to have the longest length allowed by the DBMS.
+ *
+ * default
+ * Text value to be used as default for this field.
+ *
+ * notnull
+ * Boolean flag that indicates whether this field is constrained
+ * to not be set to null.
+ * charset
+ * Text value with the default CHARACTER SET for this field.
+ * collation
+ * Text value with the default COLLATION for this field.
+ * unique
+ * unique constraint
+ *
+ * @return string
+ */
+ public function getColumnDeclarationListSQL(array $fields)
+ {
+ $queryFields = array();
+ foreach ($fields as $fieldName => $field) {
+ $query = $this->getColumnDeclarationSQL($fieldName, $field);
+ $queryFields[] = $query;
+ }
+ return implode(', ', $queryFields);
+ }
+
+ /**
+ * Obtain DBMS specific SQL code portion needed to declare a generic type
+ * field to be used in statements like CREATE TABLE.
+ *
+ * @param string $name name the field to be declared.
+ * @param array $field associative array with the name of the properties
+ * of the field being declared as array indexes. Currently, the types
+ * of supported field properties are as follows:
+ *
+ * length
+ * Integer value that determines the maximum length of the text
+ * field. If this argument is missing the field should be
+ * declared to have the longest length allowed by the DBMS.
+ *
+ * default
+ * Text value to be used as default for this field.
+ *
+ * notnull
+ * Boolean flag that indicates whether this field is constrained
+ * to not be set to null.
+ * charset
+ * Text value with the default CHARACTER SET for this field.
+ * collation
+ * Text value with the default COLLATION for this field.
+ * unique
+ * unique constraint
+ * check
+ * column check constraint
+ * columnDefinition
+ * a string that defines the complete column
+ *
+ * @return string DBMS specific SQL code portion that should be used to declare the column.
+ */
+ public function getColumnDeclarationSQL($name, array $field)
+ {
+ if (isset($field['columnDefinition'])) {
+ $columnDef = $this->getCustomTypeDeclarationSQL($field);
+ } else {
+ $default = $this->getDefaultValueDeclarationSQL($field);
+
+ $charset = (isset($field['charset']) && $field['charset']) ?
+ ' ' . $this->getColumnCharsetDeclarationSQL($field['charset']) : '';
+
+ $collation = (isset($field['collation']) && $field['collation']) ?
+ ' ' . $this->getColumnCollationDeclarationSQL($field['collation']) : '';
+
+ $notnull = (isset($field['notnull']) && $field['notnull']) ? ' NOT NULL' : '';
+
+ $unique = (isset($field['unique']) && $field['unique']) ?
+ ' ' . $this->getUniqueFieldDeclarationSQL() : '';
+
+ $check = (isset($field['check']) && $field['check']) ?
+ ' ' . $field['check'] : '';
+
+ $typeDecl = $field['type']->getSqlDeclaration($field, $this);
+ $columnDef = $typeDecl . $charset . $default . $notnull . $unique . $check . $collation;
+ }
+
+ if ($this->supportsInlineColumnComments() && isset($field['comment']) && $field['comment']) {
+ $columnDef .= " COMMENT '" . $field['comment'] . "'";
+ }
+
+ return $name . ' ' . $columnDef;
+ }
+
+ /**
+ * Gets the SQL snippet that declares a floating point column of arbitrary precision.
+ *
+ * @param array $columnDef
+ * @return string
+ */
+ public function getDecimalTypeDeclarationSQL(array $columnDef)
+ {
+ $columnDef['precision'] = ( ! isset($columnDef['precision']) || empty($columnDef['precision']))
+ ? 10 : $columnDef['precision'];
+ $columnDef['scale'] = ( ! isset($columnDef['scale']) || empty($columnDef['scale']))
+ ? 0 : $columnDef['scale'];
+
+ return 'NUMERIC(' . $columnDef['precision'] . ', ' . $columnDef['scale'] . ')';
+ }
+
+ /**
+ * Obtain DBMS specific SQL code portion needed to set a default value
+ * declaration to be used in statements like CREATE TABLE.
+ *
+ * @param array $field field definition array
+ * @return string DBMS specific SQL code portion needed to set a default value
+ */
+ public function getDefaultValueDeclarationSQL($field)
+ {
+ $default = empty($field['notnull']) ? ' DEFAULT NULL' : '';
+
+ if (isset($field['default'])) {
+ $default = " DEFAULT '".$field['default']."'";
+ if (isset($field['type'])) {
+ if (in_array((string)$field['type'], array("Integer", "BigInteger", "SmallInteger"))) {
+ $default = " DEFAULT ".$field['default'];
+ } else if ((string)$field['type'] == 'DateTime' && $field['default'] == $this->getCurrentTimestampSQL()) {
+ $default = " DEFAULT ".$this->getCurrentTimestampSQL();
+ }
+ }
+ }
+ return $default;
+ }
+
+ /**
+ * Obtain DBMS specific SQL code portion needed to set a CHECK constraint
+ * declaration to be used in statements like CREATE TABLE.
+ *
+ * @param array $definition check definition
+ * @return string DBMS specific SQL code portion needed to set a CHECK constraint
+ */
+ public function getCheckDeclarationSQL(array $definition)
+ {
+ $constraints = array();
+ foreach ($definition as $field => $def) {
+ if (is_string($def)) {
+ $constraints[] = 'CHECK (' . $def . ')';
+ } else {
+ if (isset($def['min'])) {
+ $constraints[] = 'CHECK (' . $field . ' >= ' . $def['min'] . ')';
+ }
+
+ if (isset($def['max'])) {
+ $constraints[] = 'CHECK (' . $field . ' <= ' . $def['max'] . ')';
+ }
+ }
+ }
+
+ return implode(', ', $constraints);
+ }
+
+ /**
+ * Obtain DBMS specific SQL code portion needed to set a unique
+ * constraint declaration to be used in statements like CREATE TABLE.
+ *
+ * @param string $name name of the unique constraint
+ * @param Index $index index definition
+ * @return string DBMS specific SQL code portion needed
+ * to set a constraint
+ */
+ public function getUniqueConstraintDeclarationSQL($name, Index $index)
+ {
+ if (count($index->getColumns()) == 0) {
+ throw \InvalidArgumentException("Incomplete definition. 'columns' required.");
+ }
+
+ return 'CONSTRAINT ' . $name . ' UNIQUE ('
+ . $this->getIndexFieldDeclarationListSQL($index->getColumns())
+ . ')';
+ }
+
+ /**
+ * Obtain DBMS specific SQL code portion needed to set an index
+ * declaration to be used in statements like CREATE TABLE.
+ *
+ * @param string $name name of the index
+ * @param Index $index index definition
+ * @return string DBMS specific SQL code portion needed to set an index
+ */
+ public function getIndexDeclarationSQL($name, Index $index)
+ {
+ $type = '';
+
+ if($index->isUnique()) {
+ $type = 'UNIQUE ';
+ }
+
+ if (count($index->getColumns()) == 0) {
+ throw \InvalidArgumentException("Incomplete definition. 'columns' required.");
+ }
+
+ return $type . 'INDEX ' . $name . ' ('
+ . $this->getIndexFieldDeclarationListSQL($index->getColumns())
+ . ')';
+ }
+
+ /**
+ * getCustomTypeDeclarationSql
+ * Obtail SQL code portion needed to create a custom column,
+ * e.g. when a field has the "columnDefinition" keyword.
+ * Only "AUTOINCREMENT" and "PRIMARY KEY" are added if appropriate.
+ *
+ * @return string
+ */
+ public function getCustomTypeDeclarationSQL(array $columnDef)
+ {
+ return $columnDef['columnDefinition'];
+ }
+
+ /**
+ * getIndexFieldDeclarationList
+ * Obtain DBMS specific SQL code portion needed to set an index
+ * declaration to be used in statements like CREATE TABLE.
+ *
+ * @return string
+ */
+ public function getIndexFieldDeclarationListSQL(array $fields)
+ {
+ $ret = array();
+ foreach ($fields as $field => $definition) {
+ if (is_array($definition)) {
+ $ret[] = $field;
+ } else {
+ $ret[] = $definition;
+ }
+ }
+ return implode(', ', $ret);
+ }
+
+ /**
+ * A method to return the required SQL string that fits between CREATE ... TABLE
+ * to create the table as a temporary table.
+ *
+ * Should be overridden in driver classes to return the correct string for the
+ * specific database type.
+ *
+ * The default is to return the string "TEMPORARY" - this will result in a
+ * SQL error for any database that does not support temporary tables, or that
+ * requires a different SQL command from "CREATE TEMPORARY TABLE".
+ *
+ * @return string The string required to be placed between "CREATE" and "TABLE"
+ * to generate a temporary table, if possible.
+ */
+ public function getTemporaryTableSQL()
+ {
+ return 'TEMPORARY';
+ }
+
+ /**
+ * Some vendors require temporary table names to be qualified specially.
+ *
+ * @param string $tableName
+ * @return string
+ */
+ public function getTemporaryTableName($tableName)
+ {
+ return $tableName;
+ }
+
+ /**
+ * Get sql query to show a list of database.
+ *
+ * @return string
+ */
+ public function getShowDatabasesSQL()
+ {
+ throw DBALException::notSupported(__METHOD__);
+ }
+
+ /**
+ * Obtain DBMS specific SQL code portion needed to set the FOREIGN KEY constraint
+ * of a field declaration to be used in statements like CREATE TABLE.
+ *
+ * @param array $definition an associative array with the following structure:
+ * name optional constraint name
+ *
+ * local the local field(s)
+ *
+ * foreign the foreign reference field(s)
+ *
+ * foreignTable the name of the foreign table
+ *
+ * onDelete referential delete action
+ *
+ * onUpdate referential update action
+ *
+ * deferred deferred constraint checking
+ *
+ * The onDelete and onUpdate keys accept the following values:
+ *
+ * CASCADE: Delete or update the row from the parent table and automatically delete or
+ * update the matching rows in the child table. Both ON DELETE CASCADE and ON UPDATE CASCADE are supported.
+ * Between two tables, you should not define several ON UPDATE CASCADE clauses that act on the same column
+ * in the parent table or in the child table.
+ *
+ * SET NULL: Delete or update the row from the parent table and set the foreign key column or columns in the
+ * child table to NULL. This is valid only if the foreign key columns do not have the NOT NULL qualifier
+ * specified. Both ON DELETE SET NULL and ON UPDATE SET NULL clauses are supported.
+ *
+ * NO ACTION: In standard SQL, NO ACTION means no action in the sense that an attempt to delete or update a primary
+ * key value is not allowed to proceed if there is a related foreign key value in the referenced table.
+ *
+ * RESTRICT: Rejects the delete or update operation for the parent table. NO ACTION and RESTRICT are the same as
+ * omitting the ON DELETE or ON UPDATE clause.
+ *
+ * SET DEFAULT
+ *
+ * @return string DBMS specific SQL code portion needed to set the FOREIGN KEY constraint
+ * of a field declaration.
+ */
+ public function getForeignKeyDeclarationSQL(ForeignKeyConstraint $foreignKey)
+ {
+ $sql = $this->getForeignKeyBaseDeclarationSQL($foreignKey);
+ $sql .= $this->getAdvancedForeignKeyOptionsSQL($foreignKey);
+
+ return $sql;
+ }
+
+ /**
+ * Return the FOREIGN KEY query section dealing with non-standard options
+ * as MATCH, INITIALLY DEFERRED, ON UPDATE, ...
+ *
+ * @param ForeignKeyConstraint $foreignKey foreign key definition
+ * @return string
+ */
+ public function getAdvancedForeignKeyOptionsSQL(ForeignKeyConstraint $foreignKey)
+ {
+ $query = '';
+ if ($this->supportsForeignKeyOnUpdate() && $foreignKey->hasOption('onUpdate')) {
+ $query .= ' ON UPDATE ' . $this->getForeignKeyReferentialActionSQL($foreignKey->getOption('onUpdate'));
+ }
+ if ($foreignKey->hasOption('onDelete')) {
+ $query .= ' ON DELETE ' . $this->getForeignKeyReferentialActionSQL($foreignKey->getOption('onDelete'));
+ }
+ return $query;
+ }
+
+ /**
+ * returns given referential action in uppercase if valid, otherwise throws
+ * an exception
+ *
+ * @throws Doctrine_Exception_Exception if unknown referential action given
+ * @param string $action foreign key referential action
+ * @param string foreign key referential action in uppercase
+ */
+ public function getForeignKeyReferentialActionSQL($action)
+ {
+ $upper = strtoupper($action);
+ switch ($upper) {
+ case 'CASCADE':
+ case 'SET NULL':
+ case 'NO ACTION':
+ case 'RESTRICT':
+ case 'SET DEFAULT':
+ return $upper;
+ break;
+ default:
+ throw new \InvalidArgumentException('Invalid foreign key action: ' . $upper);
+ }
+ }
+
+ /**
+ * Obtain DBMS specific SQL code portion needed to set the FOREIGN KEY constraint
+ * of a field declaration to be used in statements like CREATE TABLE.
+ *
+ * @param ForeignKeyConstraint $foreignKey
+ * @return string
+ */
+ public function getForeignKeyBaseDeclarationSQL(ForeignKeyConstraint $foreignKey)
+ {
+ $sql = '';
+ if (strlen($foreignKey->getName())) {
+ $sql .= 'CONSTRAINT ' . $foreignKey->getQuotedName($this) . ' ';
+ }
+ $sql .= 'FOREIGN KEY (';
+
+ if (count($foreignKey->getLocalColumns()) == 0) {
+ throw new \InvalidArgumentException("Incomplete definition. 'local' required.");
+ }
+ if (count($foreignKey->getForeignColumns()) == 0) {
+ throw new \InvalidArgumentException("Incomplete definition. 'foreign' required.");
+ }
+ if (strlen($foreignKey->getForeignTableName()) == 0) {
+ throw new \InvalidArgumentException("Incomplete definition. 'foreignTable' required.");
+ }
+
+ $sql .= implode(', ', $foreignKey->getLocalColumns())
+ . ') REFERENCES '
+ . $foreignKey->getForeignTableName() . '('
+ . implode(', ', $foreignKey->getForeignColumns()) . ')';
+
+ return $sql;
+ }
+
+ /**
+ * Obtain DBMS specific SQL code portion needed to set the UNIQUE constraint
+ * of a field declaration to be used in statements like CREATE TABLE.
+ *
+ * @return string DBMS specific SQL code portion needed to set the UNIQUE constraint
+ * of a field declaration.
+ */
+ public function getUniqueFieldDeclarationSQL()
+ {
+ return 'UNIQUE';
+ }
+
+ /**
+ * Obtain DBMS specific SQL code portion needed to set the CHARACTER SET
+ * of a field declaration to be used in statements like CREATE TABLE.
+ *
+ * @param string $charset name of the charset
+ * @return string DBMS specific SQL code portion needed to set the CHARACTER SET
+ * of a field declaration.
+ */
+ public function getColumnCharsetDeclarationSQL($charset)
+ {
+ return '';
+ }
+
+ /**
+ * Obtain DBMS specific SQL code portion needed to set the COLLATION
+ * of a field declaration to be used in statements like CREATE TABLE.
+ *
+ * @param string $collation name of the collation
+ * @return string DBMS specific SQL code portion needed to set the COLLATION
+ * of a field declaration.
+ */
+ public function getColumnCollationDeclarationSQL($collation)
+ {
+ return '';
+ }
+
+ /**
+ * Whether the platform prefers sequences for ID generation.
+ * Subclasses should override this method to return TRUE if they prefer sequences.
+ *
+ * @return boolean
+ */
+ public function prefersSequences()
+ {
+ return false;
+ }
+
+ /**
+ * Whether the platform prefers identity columns (eg. autoincrement) for ID generation.
+ * Subclasses should override this method to return TRUE if they prefer identity columns.
+ *
+ * @return boolean
+ */
+ public function prefersIdentityColumns()
+ {
+ return false;
+ }
+
+ /**
+ * Some platforms need the boolean values to be converted.
+ *
+ * The default conversion in this implementation converts to integers (false => 0, true => 1).
+ *
+ * @param mixed $item
+ */
+ public function convertBooleans($item)
+ {
+ if (is_array($item)) {
+ foreach ($item as $k => $value) {
+ if (is_bool($value)) {
+ $item[$k] = (int) $value;
+ }
+ }
+ } else if (is_bool($item)) {
+ $item = (int) $item;
+ }
+ return $item;
+ }
+
+ /**
+ * Gets the SQL statement specific for the platform to set the charset.
+ *
+ * This function is MySQL specific and required by
+ * {@see \Doctrine\DBAL\Connection::setCharset($charset)}
+ *
+ * @param string $charset
+ * @return string
+ */
+ public function getSetCharsetSQL($charset)
+ {
+ return "SET NAMES '".$charset."'";
+ }
+
+ /**
+ * Gets the SQL specific for the platform to get the current date.
+ *
+ * @return string
+ */
+ public function getCurrentDateSQL()
+ {
+ return 'CURRENT_DATE';
+ }
+
+ /**
+ * Gets the SQL specific for the platform to get the current time.
+ *
+ * @return string
+ */
+ public function getCurrentTimeSQL()
+ {
+ return 'CURRENT_TIME';
+ }
+
+ /**
+ * Gets the SQL specific for the platform to get the current timestamp
+ *
+ * @return string
+ */
+ public function getCurrentTimestampSQL()
+ {
+ return 'CURRENT_TIMESTAMP';
+ }
+
+ /**
+ * Get sql for transaction isolation level Connection constant
+ *
+ * @param integer $level
+ */
+ protected function _getTransactionIsolationLevelSQL($level)
+ {
+ switch ($level) {
+ case Connection::TRANSACTION_READ_UNCOMMITTED:
+ return 'READ UNCOMMITTED';
+ case Connection::TRANSACTION_READ_COMMITTED:
+ return 'READ COMMITTED';
+ case Connection::TRANSACTION_REPEATABLE_READ:
+ return 'REPEATABLE READ';
+ case Connection::TRANSACTION_SERIALIZABLE:
+ return 'SERIALIZABLE';
+ default:
+ throw new \InvalidArgumentException('Invalid isolation level:' . $level);
+ }
+ }
+
+ public function getListDatabasesSQL()
+ {
+ throw DBALException::notSupported(__METHOD__);
+ }
+
+ public function getListSequencesSQL($database)
+ {
+ throw DBALException::notSupported(__METHOD__);
+ }
+
+ public function getListTableConstraintsSQL($table)
+ {
+ throw DBALException::notSupported(__METHOD__);
+ }
+
+ public function getListTableColumnsSQL($table, $database = null)
+ {
+ throw DBALException::notSupported(__METHOD__);
+ }
+
+ public function getListTablesSQL()
+ {
+ throw DBALException::notSupported(__METHOD__);
+ }
+
+ public function getListUsersSQL()
+ {
+ throw DBALException::notSupported(__METHOD__);
+ }
+
+ /**
+ * Get the SQL to list all views of a database or user.
+ *
+ * @param string $database
+ * @return string
+ */
+ public function getListViewsSQL($database)
+ {
+ throw DBALException::notSupported(__METHOD__);
+ }
+
+ /**
+ * Get the list of indexes for the current database.
+ *
+ * The current database parameter is optional but will always be passed
+ * when using the SchemaManager API and is the database the given table is in.
+ *
+ * Attention: Some platforms only support currentDatabase when they
+ * are connected with that database. Cross-database information schema
+ * requests may be impossible.
+ *
+ * @param string $table
+ * @param string $currentDatabase
+ */
+ public function getListTableIndexesSQL($table, $currentDatabase = null)
+ {
+ throw DBALException::notSupported(__METHOD__);
+ }
+
+ public function getListTableForeignKeysSQL($table)
+ {
+ throw DBALException::notSupported(__METHOD__);
+ }
+
+ public function getCreateViewSQL($name, $sql)
+ {
+ throw DBALException::notSupported(__METHOD__);
+ }
+
+ public function getDropViewSQL($name)
+ {
+ throw DBALException::notSupported(__METHOD__);
+ }
+
+ public function getDropSequenceSQL($sequence)
+ {
+ throw DBALException::notSupported(__METHOD__);
+ }
+
+ public function getSequenceNextValSQL($sequenceName)
+ {
+ throw DBALException::notSupported(__METHOD__);
+ }
+
+ public function getCreateDatabaseSQL($database)
+ {
+ throw DBALException::notSupported(__METHOD__);
+ }
+
+ /**
+ * Get sql to set the transaction isolation level
+ *
+ * @param integer $level
+ */
+ public function getSetTransactionIsolationSQL($level)
+ {
+ throw DBALException::notSupported(__METHOD__);
+ }
+
+ /**
+ * Obtain DBMS specific SQL to be used to create datetime fields in
+ * statements like CREATE TABLE
+ *
+ * @param array $fieldDeclaration
+ * @return string
+ */
+ public function getDateTimeTypeDeclarationSQL(array $fieldDeclaration)
+ {
+ throw DBALException::notSupported(__METHOD__);
+ }
+
+ /**
+ * Obtain DBMS specific SQL to be used to create datetime with timezone offset fields.
+ *
+ * @param array $fieldDeclaration
+ */
+ public function getDateTimeTzTypeDeclarationSQL(array $fieldDeclaration)
+ {
+ return $this->getDateTimeTypeDeclarationSQL($fieldDeclaration);
+ }
+
+
+ /**
+ * Obtain DBMS specific SQL to be used to create date fields in statements
+ * like CREATE TABLE.
+ *
+ * @param array $fieldDeclaration
+ * @return string
+ */
+ public function getDateTypeDeclarationSQL(array $fieldDeclaration)
+ {
+ throw DBALException::notSupported(__METHOD__);
+ }
+
+ /**
+ * Obtain DBMS specific SQL to be used to create time fields in statements
+ * like CREATE TABLE.
+ *
+ * @param array $fieldDeclaration
+ * @return string
+ */
+ public function getTimeTypeDeclarationSQL(array $fieldDeclaration)
+ {
+ throw DBALException::notSupported(__METHOD__);
+ }
+
+ public function getFloatDeclarationSQL(array $fieldDeclaration)
+ {
+ return 'DOUBLE PRECISION';
+ }
+
+ /**
+ * Gets the default transaction isolation level of the platform.
+ *
+ * @return integer The default isolation level.
+ * @see Doctrine\DBAL\Connection\TRANSACTION_* constants.
+ */
+ public function getDefaultTransactionIsolationLevel()
+ {
+ return Connection::TRANSACTION_READ_COMMITTED;
+ }
+
+ /* supports*() metods */
+
+ /**
+ * Whether the platform supports sequences.
+ *
+ * @return boolean
+ */
+ public function supportsSequences()
+ {
+ return false;
+ }
+
+ /**
+ * Whether the platform supports identity columns.
+ * Identity columns are columns that recieve an auto-generated value from the
+ * database on insert of a row.
+ *
+ * @return boolean
+ */
+ public function supportsIdentityColumns()
+ {
+ return false;
+ }
+
+ /**
+ * Whether the platform supports indexes.
+ *
+ * @return boolean
+ */
+ public function supportsIndexes()
+ {
+ return true;
+ }
+
+ public function supportsAlterTable()
+ {
+ return true;
+ }
+
+ /**
+ * Whether the platform supports transactions.
+ *
+ * @return boolean
+ */
+ public function supportsTransactions()
+ {
+ return true;
+ }
+
+ /**
+ * Whether the platform supports savepoints.
+ *
+ * @return boolean
+ */
+ public function supportsSavepoints()
+ {
+ return true;
+ }
+
+ /**
+ * Whether the platform supports releasing savepoints.
+ *
+ * @return boolean
+ */
+ public function supportsReleaseSavepoints()
+ {
+ return $this->supportsSavepoints();
+ }
+
+ /**
+ * Whether the platform supports primary key constraints.
+ *
+ * @return boolean
+ */
+ public function supportsPrimaryConstraints()
+ {
+ return true;
+ }
+
+ /**
+ * Does the platform supports foreign key constraints?
+ *
+ * @return boolean
+ */
+ public function supportsForeignKeyConstraints()
+ {
+ return true;
+ }
+
+ /**
+ * Does this platform supports onUpdate in foreign key constraints?
+ *
+ * @return bool
+ */
+ public function supportsForeignKeyOnUpdate()
+ {
+ return ($this->supportsForeignKeyConstraints() && true);
+ }
+
+ /**
+ * Whether the platform supports database schemas.
+ *
+ * @return boolean
+ */
+ public function supportsSchemas()
+ {
+ return false;
+ }
+
+ /**
+ * Some databases don't allow to create and drop databases at all or only with certain tools.
+ *
+ * @return bool
+ */
+ public function supportsCreateDropDatabase()
+ {
+ return true;
+ }
+
+ /**
+ * Whether the platform supports getting the affected rows of a recent
+ * update/delete type query.
+ *
+ * @return boolean
+ */
+ public function supportsGettingAffectedRows()
+ {
+ return true;
+ }
+
+ /**
+ * Does this plaform support to add inline column comments as postfix.
+ *
+ * @return bool
+ */
+ public function supportsInlineColumnComments()
+ {
+ return false;
+ }
+
+ /**
+ * Does this platform support the propriortary synatx "COMMENT ON asset"
+ *
+ * @return bool
+ */
+ public function supportsCommentOnStatement()
+ {
+ return false;
+ }
+
+ public function getIdentityColumnNullInsertSQL()
+ {
+ return "";
+ }
+
+ /**
+ * Gets the format string, as accepted by the date() function, that describes
+ * the format of a stored datetime value of this platform.
+ *
+ * @return string The format string.
+ */
+ public function getDateTimeFormatString()
+ {
+ return 'Y-m-d H:i:s';
+ }
+
+ /**
+ * Gets the format string, as accepted by the date() function, that describes
+ * the format of a stored datetime with timezone value of this platform.
+ *
+ * @return string The format string.
+ */
+ public function getDateTimeTzFormatString()
+ {
+ return 'Y-m-d H:i:s';
+ }
+
+ /**
+ * Gets the format string, as accepted by the date() function, that describes
+ * the format of a stored date value of this platform.
+ *
+ * @return string The format string.
+ */
+ public function getDateFormatString()
+ {
+ return 'Y-m-d';
+ }
+
+ /**
+ * Gets the format string, as accepted by the date() function, that describes
+ * the format of a stored time value of this platform.
+ *
+ * @return string The format string.
+ */
+ public function getTimeFormatString()
+ {
+ return 'H:i:s';
+ }
+
+ /**
+ * Modify limit query
+ *
+ * @param string $query
+ * @param int $limit
+ * @param int $offset
+ * @return string
+ */
+ final public function modifyLimitQuery($query, $limit, $offset = null)
+ {
+ if ( $limit !== null) {
+ $limit = (int)$limit;
+ }
+
+ if ( $offset !== null) {
+ $offset = (int)$offset;
+ }
+
+ return $this->doModifyLimitQuery($query, $limit, $offset);
+ }
+
+ /**
+ * @param string $query
+ * @param int $limit
+ * @param int $offset
+ * @return string
+ */
+ protected function doModifyLimitQuery($query, $limit, $offset)
+ {
+ if ( $limit !== null) {
+ $query .= ' LIMIT ' . $limit;
+ }
+
+ if ( $offset !== null) {
+ $query .= ' OFFSET ' . $offset;
+ }
+
+ return $query;
+ }
+
+ /**
+ * Gets the character casing of a column in an SQL result set of this platform.
+ *
+ * @param string $column The column name for which to get the correct character casing.
+ * @return string The column name in the character casing used in SQL result sets.
+ */
+ public function getSQLResultCasing($column)
+ {
+ return $column;
+ }
+
+ /**
+ * Makes any fixes to a name of a schema element (table, sequence, ...) that are required
+ * by restrictions of the platform, like a maximum length.
+ *
+ * @param string $schemaName
+ * @return string
+ */
+ public function fixSchemaElementName($schemaElementName)
+ {
+ return $schemaElementName;
+ }
+
+ /**
+ * Maximum length of any given databse identifier, like tables or column names.
+ *
+ * @return int
+ */
+ public function getMaxIdentifierLength()
+ {
+ return 63;
+ }
+
+ /**
+ * Get the insert sql for an empty insert statement
+ *
+ * @param string $tableName
+ * @param string $identifierColumnName
+ * @return string $sql
+ */
+ public function getEmptyIdentityInsertSQL($tableName, $identifierColumnName)
+ {
+ return 'INSERT INTO ' . $tableName . ' (' . $identifierColumnName . ') VALUES (null)';
+ }
+
+ /**
+ * Generate a Truncate Table SQL statement for a given table.
+ *
+ * Cascade is not supported on many platforms but would optionally cascade the truncate by
+ * following the foreign keys.
+ *
+ * @param string $tableName
+ * @param bool $cascade
+ * @return string
+ */
+ public function getTruncateTableSQL($tableName, $cascade = false)
+ {
+ return 'TRUNCATE '.$tableName;
+ }
+
+ /**
+ * This is for test reasons, many vendors have special requirements for dummy statements.
+ *
+ * @return string
+ */
+ public function getDummySelectSQL()
+ {
+ return 'SELECT 1';
+ }
+
+ /**
+ * Generate SQL to create a new savepoint
+ *
+ * @param string $savepoint
+ * @return string
+ */
+ public function createSavePoint($savepoint)
+ {
+ return 'SAVEPOINT ' . $savepoint;
+ }
+
+ /**
+ * Generate SQL to release a savepoint
+ *
+ * @param string $savepoint
+ * @return string
+ */
+ public function releaseSavePoint($savepoint)
+ {
+ return 'RELEASE SAVEPOINT ' . $savepoint;
+ }
+
+ /**
+ * Generate SQL to rollback a savepoint
+ *
+ * @param string $savepoint
+ * @return string
+ */
+ public function rollbackSavePoint($savepoint)
+ {
+ return 'ROLLBACK TO SAVEPOINT ' . $savepoint;
+ }
+
+ /**
+ * Return the keyword list instance of this platform.
+ *
+ * Throws exception if no keyword list is specified.
+ *
+ * @throws DBALException
+ * @return KeywordList
+ */
+ final public function getReservedKeywordsList()
+ {
+ $class = $this->getReservedKeywordsClass();
+ $keywords = new $class;
+ if (!$keywords instanceof \Doctrine\DBAL\Platforms\Keywords\KeywordList) {
+ throw DBALException::notSupported(__METHOD__);
+ }
+ return $keywords;
+ }
+
+ /**
+ * The class name of the reserved keywords list.
+ *
+ * @return string
+ */
+ protected function getReservedKeywordsClass()
+ {
+ throw DBALException::notSupported(__METHOD__);
+ }
+}
\ No newline at end of file
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-dbal/lib/Doctrine/DBAL/Platforms/DB2Platform.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-dbal/lib/Doctrine/DBAL/Platforms/DB2Platform.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,558 @@
+.
+*/
+
+namespace Doctrine\DBAL\Platforms;
+
+use Doctrine\DBAL\DBALException;
+use Doctrine\DBAL\Schema\Index;
+use Doctrine\DBAL\Schema\TableDiff;
+
+class DB2Platform extends AbstractPlatform
+{
+ public function initializeDoctrineTypeMappings()
+ {
+ $this->doctrineTypeMapping = array(
+ 'smallint' => 'smallint',
+ 'bigint' => 'bigint',
+ 'integer' => 'integer',
+ 'time' => 'time',
+ 'date' => 'date',
+ 'varchar' => 'string',
+ 'character' => 'string',
+ 'clob' => 'text',
+ 'decimal' => 'decimal',
+ 'double' => 'float',
+ 'real' => 'float',
+ 'timestamp' => 'datetime',
+ );
+ }
+
+ /**
+ * Gets the SQL snippet used to declare a VARCHAR column type.
+ *
+ * @param array $field
+ */
+ protected function getVarcharTypeDeclarationSQLSnippet($length, $fixed)
+ {
+ return $fixed ? ($length ? 'CHAR(' . $length . ')' : 'CHAR(255)')
+ : ($length ? 'VARCHAR(' . $length . ')' : 'VARCHAR(255)');
+ }
+
+ /**
+ * Gets the SQL snippet used to declare a CLOB column type.
+ *
+ * @param array $field
+ */
+ public function getClobTypeDeclarationSQL(array $field)
+ {
+ // todo clob(n) with $field['length'];
+ return 'CLOB(1M)';
+ }
+
+ /**
+ * Gets the name of the platform.
+ *
+ * @return string
+ */
+ public function getName()
+ {
+ return 'db2';
+ }
+
+
+ /**
+ * Gets the SQL snippet that declares a boolean column.
+ *
+ * @param array $columnDef
+ * @return string
+ */
+ public function getBooleanTypeDeclarationSQL(array $columnDef)
+ {
+ return 'SMALLINT';
+ }
+
+ /**
+ * Gets the SQL snippet that declares a 4 byte integer column.
+ *
+ * @param array $columnDef
+ * @return string
+ */
+ public function getIntegerTypeDeclarationSQL(array $columnDef)
+ {
+ return 'INTEGER' . $this->_getCommonIntegerTypeDeclarationSQL($columnDef);
+ }
+
+ /**
+ * Gets the SQL snippet that declares an 8 byte integer column.
+ *
+ * @param array $columnDef
+ * @return string
+ */
+ public function getBigIntTypeDeclarationSQL(array $columnDef)
+ {
+ return 'BIGINT' . $this->_getCommonIntegerTypeDeclarationSQL($columnDef);
+ }
+
+ /**
+ * Gets the SQL snippet that declares a 2 byte integer column.
+ *
+ * @param array $columnDef
+ * @return string
+ */
+ public function getSmallIntTypeDeclarationSQL(array $columnDef)
+ {
+ return 'SMALLINT' . $this->_getCommonIntegerTypeDeclarationSQL($columnDef);
+ }
+
+ /**
+ * Gets the SQL snippet that declares common properties of an integer column.
+ *
+ * @param array $columnDef
+ * @return string
+ */
+ protected function _getCommonIntegerTypeDeclarationSQL(array $columnDef)
+ {
+ $autoinc = '';
+ if ( ! empty($columnDef['autoincrement'])) {
+ $autoinc = ' GENERATED BY DEFAULT AS IDENTITY';
+ }
+ return $autoinc;
+ }
+
+ /**
+ * Obtain DBMS specific SQL to be used to create datetime fields in
+ * statements like CREATE TABLE
+ *
+ * @param array $fieldDeclaration
+ * @return string
+ */
+ public function getDateTimeTypeDeclarationSQL(array $fieldDeclaration)
+ {
+ if (isset($fieldDeclaration['version']) && $fieldDeclaration['version'] == true) {
+ return "TIMESTAMP(0) WITH DEFAULT";
+ }
+
+ return 'TIMESTAMP(0)';
+ }
+
+ /**
+ * Obtain DBMS specific SQL to be used to create date fields in statements
+ * like CREATE TABLE.
+ *
+ * @param array $fieldDeclaration
+ * @return string
+ */
+ public function getDateTypeDeclarationSQL(array $fieldDeclaration)
+ {
+ return 'DATE';
+ }
+
+ /**
+ * Obtain DBMS specific SQL to be used to create time fields in statements
+ * like CREATE TABLE.
+ *
+ * @param array $fieldDeclaration
+ * @return string
+ */
+ public function getTimeTypeDeclarationSQL(array $fieldDeclaration)
+ {
+ return 'TIME';
+ }
+
+ public function getListDatabasesSQL()
+ {
+ throw DBALException::notSupported(__METHOD__);
+ }
+
+ public function getListSequencesSQL($database)
+ {
+ throw DBALException::notSupported(__METHOD__);
+ }
+
+ public function getListTableConstraintsSQL($table)
+ {
+ throw DBALException::notSupported(__METHOD__);
+ }
+
+ /**
+ * This code fragment is originally from the Zend_Db_Adapter_Db2 class.
+ *
+ * @license New BSD License
+ * @param string $table
+ * @return string
+ */
+ public function getListTableColumnsSQL($table, $database = null)
+ {
+ return "SELECT DISTINCT c.tabschema, c.tabname, c.colname, c.colno,
+ c.typename, c.default, c.nulls, c.length, c.scale,
+ c.identity, tc.type AS tabconsttype, k.colseq
+ FROM syscat.columns c
+ LEFT JOIN (syscat.keycoluse k JOIN syscat.tabconst tc
+ ON (k.tabschema = tc.tabschema
+ AND k.tabname = tc.tabname
+ AND tc.type = 'P'))
+ ON (c.tabschema = k.tabschema
+ AND c.tabname = k.tabname
+ AND c.colname = k.colname)
+ WHERE UPPER(c.tabname) = UPPER('" . $table . "') ORDER BY c.colno";
+ }
+
+ public function getListTablesSQL()
+ {
+ return "SELECT NAME FROM SYSIBM.SYSTABLES WHERE TYPE = 'T'";
+ }
+
+ public function getListUsersSQL()
+ {
+ throw DBALException::notSupported(__METHOD__);
+ }
+
+ /**
+ * Get the SQL to list all views of a database or user.
+ *
+ * @param string $database
+ * @return string
+ */
+ public function getListViewsSQL($database)
+ {
+ return "SELECT NAME, TEXT FROM SYSIBM.SYSVIEWS";
+ }
+
+ public function getListTableIndexesSQL($table, $currentDatabase = null)
+ {
+ return "SELECT NAME, COLNAMES, UNIQUERULE FROM SYSIBM.SYSINDEXES WHERE TBNAME = UPPER('" . $table . "')";
+ }
+
+ public function getListTableForeignKeysSQL($table)
+ {
+ return "SELECT TBNAME, RELNAME, REFTBNAME, DELETERULE, UPDATERULE, FKCOLNAMES, PKCOLNAMES ".
+ "FROM SYSIBM.SYSRELS WHERE TBNAME = UPPER('".$table."')";
+ }
+
+ public function getCreateViewSQL($name, $sql)
+ {
+ return "CREATE VIEW ".$name." AS ".$sql;
+ }
+
+ public function getDropViewSQL($name)
+ {
+ return "DROP VIEW ".$name;
+ }
+
+ public function getDropSequenceSQL($sequence)
+ {
+ throw DBALException::notSupported(__METHOD__);
+ }
+
+ public function getSequenceNextValSQL($sequenceName)
+ {
+ throw DBALException::notSupported(__METHOD__);
+ }
+
+ public function getCreateDatabaseSQL($database)
+ {
+ return "CREATE DATABASE ".$database;
+ }
+
+ public function getDropDatabaseSQL($database)
+ {
+ return "DROP DATABASE ".$database.";";
+ }
+
+ public function supportsCreateDropDatabase()
+ {
+ return false;
+ }
+
+ /**
+ * Whether the platform supports releasing savepoints.
+ *
+ * @return boolean
+ */
+ public function supportsReleaseSavepoints()
+ {
+ return false;
+ }
+
+ /**
+ * Gets the SQL specific for the platform to get the current date.
+ *
+ * @return string
+ */
+ public function getCurrentDateSQL()
+ {
+ return 'VALUES CURRENT DATE';
+ }
+
+ /**
+ * Gets the SQL specific for the platform to get the current time.
+ *
+ * @return string
+ */
+ public function getCurrentTimeSQL()
+ {
+ return 'VALUES CURRENT TIME';
+ }
+
+ /**
+ * Gets the SQL specific for the platform to get the current timestamp
+ *
+ * @return string
+ */
+
+ public function getCurrentTimestampSQL()
+ {
+ return "VALUES CURRENT TIMESTAMP";
+ }
+
+ /**
+ * Obtain DBMS specific SQL code portion needed to set an index
+ * declaration to be used in statements like CREATE TABLE.
+ *
+ * @param string $name name of the index
+ * @param Index $index index definition
+ * @return string DBMS specific SQL code portion needed to set an index
+ */
+ public function getIndexDeclarationSQL($name, Index $index)
+ {
+ return $this->getUniqueConstraintDeclarationSQL($name, $index);
+ }
+
+ /**
+ * @param string $tableName
+ * @param array $columns
+ * @param array $options
+ * @return array
+ */
+ protected function _getCreateTableSQL($tableName, array $columns, array $options = array())
+ {
+ $indexes = array();
+ if (isset($options['indexes'])) {
+ $indexes = $options['indexes'];
+ }
+ $options['indexes'] = array();
+
+ $sqls = parent::_getCreateTableSQL($tableName, $columns, $options);
+
+ foreach ($indexes as $index => $definition) {
+ $sqls[] = $this->getCreateIndexSQL($definition, $tableName);
+ }
+ return $sqls;
+ }
+
+ /**
+ * Gets the SQL to alter an existing table.
+ *
+ * @param TableDiff $diff
+ * @return array
+ */
+ public function getAlterTableSQL(TableDiff $diff)
+ {
+ $sql = array();
+
+ $queryParts = array();
+ foreach ($diff->addedColumns AS $fieldName => $column) {
+ $queryParts[] = 'ADD COLUMN ' . $this->getColumnDeclarationSQL($column->getQuotedName($this), $column->toArray());
+ }
+
+ foreach ($diff->removedColumns AS $column) {
+ $queryParts[] = 'DROP COLUMN ' . $column->getQuotedName($this);
+ }
+
+ foreach ($diff->changedColumns AS $columnDiff) {
+ /* @var $columnDiff Doctrine\DBAL\Schema\ColumnDiff */
+ $column = $columnDiff->column;
+ $queryParts[] = 'ALTER ' . ($columnDiff->oldColumnName) . ' '
+ . $this->getColumnDeclarationSQL($column->getQuotedName($this), $column->toArray());
+ }
+
+ foreach ($diff->renamedColumns AS $oldColumnName => $column) {
+ $queryParts[] = 'RENAME ' . $oldColumnName . ' TO ' . $column->getQuotedName($this);
+ }
+
+ if (count($queryParts) > 0) {
+ $sql[] = 'ALTER TABLE ' . $diff->name . ' ' . implode(" ", $queryParts);
+ }
+
+ $sql = array_merge($sql, $this->_getAlterTableIndexForeignKeySQL($diff));
+
+ if ($diff->newName !== false) {
+ $sql[] = 'RENAME TABLE TO ' . $diff->newName;
+ }
+
+ return $sql;
+ }
+
+ public function getDefaultValueDeclarationSQL($field)
+ {
+ if (isset($field['notnull']) && $field['notnull'] && !isset($field['default'])) {
+ if (in_array((string)$field['type'], array("Integer", "BigInteger", "SmallInteger"))) {
+ $field['default'] = 0;
+ } else if((string)$field['type'] == "DateTime") {
+ $field['default'] = "00-00-00 00:00:00";
+ } else if ((string)$field['type'] == "Date") {
+ $field['default'] = "00-00-00";
+ } else if((string)$field['type'] == "Time") {
+ $field['default'] = "00:00:00";
+ } else {
+ $field['default'] = '';
+ }
+ }
+
+ unset($field['default']); // @todo this needs fixing
+ if (isset($field['version']) && $field['version']) {
+ if ((string)$field['type'] != "DateTime") {
+ $field['default'] = "1";
+ }
+ }
+
+ return parent::getDefaultValueDeclarationSQL($field);
+ }
+
+ /**
+ * Get the insert sql for an empty insert statement
+ *
+ * @param string $tableName
+ * @param string $identifierColumnName
+ * @return string $sql
+ */
+ public function getEmptyIdentityInsertSQL($tableName, $identifierColumnName)
+ {
+ return 'INSERT INTO ' . $tableName . ' (' . $identifierColumnName . ') VALUES (DEFAULT)';
+ }
+
+ public function getCreateTemporaryTableSnippetSQL()
+ {
+ return "DECLARE GLOBAL TEMPORARY TABLE";
+ }
+
+ /**
+ * DB2 automatically moves temporary tables into the SESSION. schema.
+ *
+ * @param string $tableName
+ * @return string
+ */
+ public function getTemporaryTableName($tableName)
+ {
+ return "SESSION." . $tableName;
+ }
+
+ protected function doModifyLimitQuery($query, $limit, $offset = null)
+ {
+ if ($limit === null && $offset === null) {
+ return $query;
+ }
+
+ $limit = (int)$limit;
+ $offset = (int)(($offset)?:0);
+
+ // Todo OVER() needs ORDER BY data!
+ $sql = 'SELECT db22.* FROM (SELECT ROW_NUMBER() OVER() AS DC_ROWNUM, db21.* '.
+ 'FROM (' . $query . ') db21) db22 WHERE db22.DC_ROWNUM BETWEEN ' . ($offset+1) .' AND ' . ($offset+$limit);
+ return $sql;
+ }
+
+ /**
+ * returns the position of the first occurrence of substring $substr in string $str
+ *
+ * @param string $substr literal string to find
+ * @param string $str literal string
+ * @param int $pos position to start at, beginning of string by default
+ * @return integer
+ */
+ public function getLocateExpression($str, $substr, $startPos = false)
+ {
+ if ($startPos == false) {
+ return 'LOCATE(' . $substr . ', ' . $str . ')';
+ } else {
+ return 'LOCATE(' . $substr . ', ' . $str . ', '.$startPos.')';
+ }
+ }
+
+ /**
+ * return string to call a function to get a substring inside an SQL statement
+ *
+ * Note: Not SQL92, but common functionality.
+ *
+ * SQLite only supports the 2 parameter variant of this function
+ *
+ * @param string $value an sql string literal or column name/alias
+ * @param integer $from where to start the substring portion
+ * @param integer $len the substring portion length
+ * @return string
+ */
+ public function getSubstringExpression($value, $from, $len = null)
+ {
+ if ($len === null)
+ return 'SUBSTR(' . $value . ', ' . $from . ')';
+ else {
+ return 'SUBSTR(' . $value . ', ' . $from . ', ' . $len . ')';
+ }
+ }
+
+ public function supportsIdentityColumns()
+ {
+ return true;
+ }
+
+ public function prefersIdentityColumns()
+ {
+ return true;
+ }
+
+ /**
+ * Gets the character casing of a column in an SQL result set of this platform.
+ *
+ * DB2 returns all column names in SQL result sets in uppercase.
+ *
+ * @param string $column The column name for which to get the correct character casing.
+ * @return string The column name in the character casing used in SQL result sets.
+ */
+ public function getSQLResultCasing($column)
+ {
+ return strtoupper($column);
+ }
+
+ public function getForUpdateSQL()
+ {
+ return ' WITH RR USE AND KEEP UPDATE LOCKS';
+ }
+
+ public function getDummySelectSQL()
+ {
+ return 'SELECT 1 FROM sysibm.sysdummy1';
+ }
+
+ /**
+ * DB2 supports savepoints, but they work semantically different than on other vendor platforms.
+ *
+ * TODO: We have to investigate how to get DB2 up and running with savepoints.
+ *
+ * @return bool
+ */
+ public function supportsSavepoints()
+ {
+ return false;
+ }
+
+ protected function getReservedKeywordsClass()
+ {
+ return 'Doctrine\DBAL\Platforms\Keywords\DB2Keywords';
+ }
+}
\ No newline at end of file
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-dbal/lib/Doctrine/DBAL/Platforms/Keywords/DB2Keywords.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-dbal/lib/Doctrine/DBAL/Platforms/Keywords/DB2Keywords.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,439 @@
+.
+ */
+
+
+namespace Doctrine\DBAL\Platforms\Keywords;
+
+/**
+ * DB2 Keywords
+ *
+ * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
+ * @link www.doctrine-project.com
+ * @since 2.0
+ * @author Benjamin Eberlei
+ */
+class DB2Keywords extends KeywordList
+{
+ public function getName()
+ {
+ return 'DB2';
+ }
+
+ protected function getKeywords()
+ {
+ return array(
+ 'ACTIVATE',
+ 'ADD',
+ 'AFTER',
+ 'ALIAS',
+ 'ALL',
+ 'ALLOCATE',
+ 'DOCUMENT',
+ 'DOUBLE',
+ 'DROP',
+ 'DSSIZE',
+ 'DYNAMIC',
+ 'EACH',
+ 'LOCK',
+ 'LOCKMAX',
+ 'LOCKSIZE',
+ 'LONG',
+ 'LOOP',
+ 'MAINTAINED',
+ 'ROUND_CEILING',
+ 'ROUND_DOWN',
+ 'ROUND_FLOOR',
+ 'ROUND_HALF_DOWN',
+ 'ROUND_HALF_EVEN',
+ 'ROUND_HALF_UP',
+ 'ALLOW',
+ 'ALTER',
+ 'AND',
+ 'ANY',
+ 'AS',
+ 'ASENSITIVE',
+ 'ASSOCIATE',
+ 'ASUTIME',
+ 'AT',
+ 'ATTRIBUTES',
+ 'AUDIT',
+ 'AUTHORIZATION',
+ 'AUX',
+ 'AUXILIARY',
+ 'BEFORE',
+ 'BEGIN',
+ 'BETWEEN',
+ 'BINARY',
+ 'BUFFERPOOL',
+ 'BY',
+ 'CACHE',
+ 'CALL',
+ 'CALLED',
+ 'CAPTURE',
+ 'CARDINALITY',
+ 'CASCADED',
+ 'CASE',
+ 'CAST',
+ 'CCSID',
+ 'CHAR',
+ 'CHARACTER',
+ 'CHECK',
+ 'CLONE',
+ 'CLOSE',
+ 'CLUSTER',
+ 'COLLECTION',
+ 'COLLID',
+ 'COLUMN',
+ 'COMMENT',
+ 'COMMIT',
+ 'CONCAT',
+ 'CONDITION',
+ 'CONNECT',
+ 'CONNECTION',
+ 'CONSTRAINT',
+ 'CONTAINS',
+ 'CONTINUE',
+ 'COUNT',
+ 'COUNT_BIG',
+ 'CREATE',
+ 'CROSS',
+ 'CURRENT',
+ 'CURRENT_DATE',
+ 'CURRENT_LC_CTYPE',
+ 'CURRENT_PATH',
+ 'CURRENT_SCHEMA',
+ 'CURRENT_SERVER',
+ 'CURRENT_TIME',
+ 'CURRENT_TIMESTAMP',
+ 'CURRENT_TIMEZONE',
+ 'CURRENT_USER',
+ 'CURSOR',
+ 'CYCLE',
+ 'DATA',
+ 'DATABASE',
+ 'DATAPARTITIONNAME',
+ 'DATAPARTITIONNUM',
+ 'EDITPROC',
+ 'ELSE',
+ 'ELSEIF',
+ 'ENABLE',
+ 'ENCODING',
+ 'ENCRYPTION',
+ 'END',
+ 'END-EXEC',
+ 'ENDING',
+ 'ERASE',
+ 'ESCAPE',
+ 'EVERY',
+ 'EXCEPT',
+ 'EXCEPTION',
+ 'EXCLUDING',
+ 'EXCLUSIVE',
+ 'EXECUTE',
+ 'EXISTS',
+ 'EXIT',
+ 'EXPLAIN',
+ 'EXTERNAL',
+ 'EXTRACT',
+ 'FENCED',
+ 'FETCH',
+ 'FIELDPROC',
+ 'FILE',
+ 'FINAL',
+ 'FOR',
+ 'FOREIGN',
+ 'FREE',
+ 'FROM',
+ 'FULL',
+ 'FUNCTION',
+ 'GENERAL',
+ 'GENERATED',
+ 'GET',
+ 'GLOBAL',
+ 'GO',
+ 'GOTO',
+ 'GRANT',
+ 'GRAPHIC',
+ 'GROUP',
+ 'HANDLER',
+ 'HASH',
+ 'HASHED_VALUE',
+ 'HAVING',
+ 'HINT',
+ 'HOLD',
+ 'HOUR',
+ 'HOURS',
+ 'IDENTITY',
+ 'IF',
+ 'IMMEDIATE',
+ 'IN',
+ 'INCLUDING',
+ 'INCLUSIVE',
+ 'INCREMENT',
+ 'INDEX',
+ 'INDICATOR',
+ 'INF',
+ 'INFINITY',
+ 'INHERIT',
+ 'INNER',
+ 'INOUT',
+ 'INSENSITIVE',
+ 'INSERT',
+ 'INTEGRITY',
+ 'MATERIALIZED',
+ 'MAXVALUE',
+ 'MICROSECOND',
+ 'MICROSECONDS',
+ 'MINUTE',
+ 'MINUTES',
+ 'MINVALUE',
+ 'MODE',
+ 'MODIFIES',
+ 'MONTH',
+ 'MONTHS',
+ 'NAN',
+ 'NEW',
+ 'NEW_TABLE',
+ 'NEXTVAL',
+ 'NO',
+ 'NOCACHE',
+ 'NOCYCLE',
+ 'NODENAME',
+ 'NODENUMBER',
+ 'NOMAXVALUE',
+ 'NOMINVALUE',
+ 'NONE',
+ 'NOORDER',
+ 'NORMALIZED',
+ 'NOT',
+ 'NULL',
+ 'NULLS',
+ 'NUMPARTS',
+ 'OBID',
+ 'OF',
+ 'OLD',
+ 'OLD_TABLE',
+ 'ON',
+ 'OPEN',
+ 'OPTIMIZATION',
+ 'OPTIMIZE',
+ 'OPTION',
+ 'OR',
+ 'ORDER',
+ 'OUT',
+ 'OUTER',
+ 'OVER',
+ 'OVERRIDING',
+ 'PACKAGE',
+ 'PADDED',
+ 'PAGESIZE',
+ 'PARAMETER',
+ 'PART',
+ 'PARTITION',
+ 'PARTITIONED',
+ 'PARTITIONING',
+ 'PARTITIONS',
+ 'PASSWORD',
+ 'PATH',
+ 'PIECESIZE',
+ 'PLAN',
+ 'POSITION',
+ 'PRECISION',
+ 'PREPARE',
+ 'PREVVAL',
+ 'PRIMARY',
+ 'PRIQTY',
+ 'PRIVILEGES',
+ 'PROCEDURE',
+ 'PROGRAM',
+ 'PSID',
+ 'ROUND_UP',
+ 'ROUTINE',
+ 'ROW',
+ 'ROW_NUMBER',
+ 'ROWNUMBER',
+ 'ROWS',
+ 'ROWSET',
+ 'RRN',
+ 'RUN',
+ 'SAVEPOINT',
+ 'SCHEMA',
+ 'SCRATCHPAD',
+ 'SCROLL',
+ 'SEARCH',
+ 'SECOND',
+ 'SECONDS',
+ 'SECQTY',
+ 'SECURITY',
+ 'SELECT',
+ 'SENSITIVE',
+ 'SEQUENCE',
+ 'SESSION',
+ 'SESSION_USER',
+ 'SET',
+ 'SIGNAL',
+ 'SIMPLE',
+ 'SNAN',
+ 'SOME',
+ 'SOURCE',
+ 'SPECIFIC',
+ 'SQL',
+ 'SQLID',
+ 'STACKED',
+ 'STANDARD',
+ 'START',
+ 'STARTING',
+ 'STATEMENT',
+ 'STATIC',
+ 'STATMENT',
+ 'STAY',
+ 'STOGROUP',
+ 'STORES',
+ 'STYLE',
+ 'SUBSTRING',
+ 'SUMMARY',
+ 'SYNONYM',
+ 'SYSFUN',
+ 'SYSIBM',
+ 'SYSPROC',
+ 'SYSTEM',
+ 'SYSTEM_USER',
+ 'TABLE',
+ 'TABLESPACE',
+ 'THEN',
+ 'TIME',
+ 'TIMESTAMP',
+ 'TO',
+ 'TRANSACTION',
+ 'TRIGGER',
+ 'TRIM',
+ 'TRUNCATE',
+ 'TYPE',
+ 'UNDO',
+ 'UNION',
+ 'UNIQUE',
+ 'UNTIL',
+ 'UPDATE',
+ 'DATE',
+ 'DAY',
+ 'DAYS',
+ 'DB2GENERAL',
+ 'DB2GENRL',
+ 'DB2SQL',
+ 'DBINFO',
+ 'DBPARTITIONNAME',
+ 'DBPARTITIONNUM',
+ 'DEALLOCATE',
+ 'DECLARE',
+ 'DEFAULT',
+ 'DEFAULTS',
+ 'DEFINITION',
+ 'DELETE',
+ 'DENSE_RANK',
+ 'DENSERANK',
+ 'DESCRIBE',
+ 'DESCRIPTOR',
+ 'DETERMINISTIC',
+ 'DIAGNOSTICS',
+ 'DISABLE',
+ 'DISALLOW',
+ 'DISCONNECT',
+ 'DISTINCT',
+ 'DO',
+ 'INTERSECT',
+ 'PUBLIC',
+ 'USAGE',
+ 'INTO',
+ 'QUERY',
+ 'USER',
+ 'IS',
+ 'QUERYNO',
+ 'USING',
+ 'ISOBID',
+ 'RANGE',
+ 'VALIDPROC',
+ 'ISOLATION',
+ 'RANK',
+ 'VALUE',
+ 'ITERATE',
+ 'READ',
+ 'VALUES',
+ 'JAR',
+ 'READS',
+ 'VARIABLE',
+ 'JAVA',
+ 'RECOVERY',
+ 'VARIANT',
+ 'JOIN',
+ 'REFERENCES',
+ 'VCAT',
+ 'KEEP',
+ 'REFERENCING',
+ 'VERSION',
+ 'KEY',
+ 'REFRESH',
+ 'VIEW',
+ 'LABEL',
+ 'RELEASE',
+ 'VOLATILE',
+ 'LANGUAGE',
+ 'RENAME',
+ 'VOLUMES',
+ 'LATERAL',
+ 'REPEAT',
+ 'WHEN',
+ 'LC_CTYPE',
+ 'RESET',
+ 'WHENEVER',
+ 'LEAVE',
+ 'RESIGNAL',
+ 'WHERE',
+ 'LEFT',
+ 'RESTART',
+ 'WHILE',
+ 'LIKE',
+ 'RESTRICT',
+ 'WITH',
+ 'LINKTYPE',
+ 'RESULT',
+ 'WITHOUT',
+ 'LOCAL',
+ 'RESULT_SET_LOCATOR WLM',
+ 'LOCALDATE',
+ 'RETURN',
+ 'WRITE',
+ 'LOCALE',
+ 'RETURNS',
+ 'XMLELEMENT',
+ 'LOCALTIME',
+ 'REVOKE',
+ 'XMLEXISTS',
+ 'LOCALTIMESTAMP RIGHT',
+ 'XMLNAMESPACES',
+ 'LOCATOR',
+ 'ROLE',
+ 'YEAR',
+ 'LOCATORS',
+ 'ROLLBACK',
+ 'YEARS',
+ );
+ }
+}
+
+
\ No newline at end of file
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-dbal/lib/Doctrine/DBAL/Platforms/Keywords/KeywordList.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-dbal/lib/Doctrine/DBAL/Platforms/Keywords/KeywordList.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,63 @@
+.
+ */
+
+
+namespace Doctrine\DBAL\Platforms\Keywords;
+
+/**
+ * Abstract interface for a SQL reserved keyword dictionary.
+ *
+ * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
+ * @link www.doctrine-project.com
+ * @since 2.0
+ * @author Benjamin Eberlei
+ */
+abstract class KeywordList
+{
+ private $keywords = null;
+
+ /**
+ * Check if the given word is a keyword of this dialect/vendor platform.
+ *
+ * @param string $word
+ * @return bool
+ */
+ public function isKeyword($word)
+ {
+ if ($this->keywords === null) {
+ $this->initializeKeywords();
+ }
+
+ return isset($this->keywords[strtoupper($word)]);
+ }
+
+ protected function initializeKeywords()
+ {
+ $this->keywords = array_flip(array_map('strtoupper', $this->getKeywords()));
+ }
+
+ abstract protected function getKeywords();
+
+ /**
+ * Name of this keyword list.
+ *
+ * @return string
+ */
+ abstract public function getName();
+}
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-dbal/lib/Doctrine/DBAL/Platforms/Keywords/MsSQLKeywords.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-dbal/lib/Doctrine/DBAL/Platforms/Keywords/MsSQLKeywords.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,243 @@
+.
+ */
+
+
+namespace Doctrine\DBAL\Platforms\Keywords;
+
+/**
+ * MsSQL Keywordlist
+ *
+ * @license BSD http://www.opensource.org/licenses/bsd-license.php
+ * @link www.doctrine-project.com
+ * @since 2.0
+ * @author Benjamin Eberlei
+ * @author David Coallier
+ */
+class MsSQLKeywords extends KeywordList
+{
+ public function getName()
+ {
+ return 'MsSQL';
+ }
+
+ protected function getKeywords()
+ {
+ return array(
+ 'ADD',
+ 'CURRENT_TIMESTAMP',
+ 'GROUP',
+ 'OPENQUERY',
+ 'SERIALIZABLE',
+ 'ALL',
+ 'CURRENT_USER',
+ 'HAVING',
+ 'OPENROWSET',
+ 'SESSION_USER',
+ 'ALTER',
+ 'CURSOR',
+ 'HOLDLOCK',
+ 'OPTION',
+ 'SET',
+ 'AND',
+ 'DATABASE',
+ 'IDENTITY',
+ 'OR',
+ 'SETUSER',
+ 'ANY',
+ 'DBCC',
+ 'IDENTITYCOL',
+ 'ORDER',
+ 'SHUTDOWN',
+ 'AS',
+ 'DEALLOCATE',
+ 'IDENTITY_INSERT',
+ 'OUTER',
+ 'SOME',
+ 'ASC',
+ 'DECLARE',
+ 'IF',
+ 'OVER',
+ 'STATISTICS',
+ 'AUTHORIZATION',
+ 'DEFAULT',
+ 'IN',
+ 'PERCENT',
+ 'SUM',
+ 'AVG',
+ 'DELETE',
+ 'INDEX',
+ 'PERM',
+ 'SYSTEM_USER',
+ 'BACKUP',
+ 'DENY',
+ 'INNER',
+ 'PERMANENT',
+ 'TABLE',
+ 'BEGIN',
+ 'DESC',
+ 'INSERT',
+ 'PIPE',
+ 'TAPE',
+ 'BETWEEN',
+ 'DISK',
+ 'INTERSECT',
+ 'PLAN',
+ 'TEMP',
+ 'BREAK',
+ 'DISTINCT',
+ 'INTO',
+ 'PRECISION',
+ 'TEMPORARY',
+ 'BROWSE',
+ 'DISTRIBUTED',
+ 'IS',
+ 'PREPARE',
+ 'TEXTSIZE',
+ 'BULK',
+ 'DOUBLE',
+ 'ISOLATION',
+ 'PRIMARY',
+ 'THEN',
+ 'BY',
+ 'DROP',
+ 'JOIN',
+ 'PRINT',
+ 'TO',
+ 'CASCADE',
+ 'DUMMY',
+ 'KEY',
+ 'PRIVILEGES',
+ 'TOP',
+ 'CASE',
+ 'DUMP',
+ 'KILL',
+ 'PROC',
+ 'TRAN',
+ 'CHECK',
+ 'ELSE',
+ 'LEFT',
+ 'PROCEDURE',
+ 'TRANSACTION',
+ 'CHECKPOINT',
+ 'END',
+ 'LEVEL',
+ 'PROCESSEXIT',
+ 'TRIGGER',
+ 'CLOSE',
+ 'ERRLVL',
+ 'LIKE',
+ 'PUBLIC',
+ 'TRUNCATE',
+ 'CLUSTERED',
+ 'ERROREXIT',
+ 'LINENO',
+ 'RAISERROR',
+ 'TSEQUAL',
+ 'COALESCE',
+ 'ESCAPE',
+ 'LOAD',
+ 'READ',
+ 'UNCOMMITTED',
+ 'COLUMN',
+ 'EXCEPT',
+ 'MAX',
+ 'READTEXT',
+ 'UNION',
+ 'COMMIT',
+ 'EXEC',
+ 'MIN',
+ 'RECONFIGURE',
+ 'UNIQUE',
+ 'COMMITTED',
+ 'EXECUTE',
+ 'MIRROREXIT',
+ 'REFERENCES',
+ 'UPDATE',
+ 'COMPUTE',
+ 'EXISTS',
+ 'NATIONAL',
+ 'REPEATABLE',
+ 'UPDATETEXT',
+ 'CONFIRM',
+ 'EXIT',
+ 'NOCHECK',
+ 'REPLICATION',
+ 'USE',
+ 'CONSTRAINT',
+ 'FETCH',
+ 'NONCLUSTERED',
+ 'RESTORE',
+ 'USER',
+ 'CONTAINS',
+ 'FILE',
+ 'NOT',
+ 'RESTRICT',
+ 'VALUES',
+ 'CONTAINSTABLE',
+ 'FILLFACTOR',
+ 'NULL',
+ 'RETURN',
+ 'VARYING',
+ 'CONTINUE',
+ 'FLOPPY',
+ 'NULLIF',
+ 'REVOKE',
+ 'VIEW',
+ 'CONTROLROW',
+ 'FOR',
+ 'OF',
+ 'RIGHT',
+ 'WAITFOR',
+ 'CONVERT',
+ 'FOREIGN',
+ 'OFF',
+ 'ROLLBACK',
+ 'WHEN',
+ 'COUNT',
+ 'FREETEXT',
+ 'OFFSETS',
+ 'ROWCOUNT',
+ 'WHERE',
+ 'CREATE',
+ 'FREETEXTTABLE',
+ 'ON',
+ 'ROWGUIDCOL',
+ 'WHILE',
+ 'CROSS',
+ 'FROM',
+ 'ONCE',
+ 'RULE',
+ 'WITH',
+ 'CURRENT',
+ 'FULL',
+ 'ONLY',
+ 'SAVE',
+ 'WORK',
+ 'CURRENT_DATE',
+ 'GOTO',
+ 'OPEN',
+ 'SCHEMA',
+ 'WRITETEXT',
+ 'CURRENT_TIME',
+ 'GRANT',
+ 'OPENDATASOURCE',
+ 'SELECT',
+ );
+ }
+}
\ No newline at end of file
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-dbal/lib/Doctrine/DBAL/Platforms/Keywords/MySQLKeywords.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-dbal/lib/Doctrine/DBAL/Platforms/Keywords/MySQLKeywords.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,268 @@
+.
+ */
+
+
+namespace Doctrine\DBAL\Platforms\Keywords;
+
+/**
+ * MySQL Keywordlist
+ *
+ * @license BSD http://www.opensource.org/licenses/bsd-license.php
+ * @link www.doctrine-project.com
+ * @since 2.0
+ * @author Benjamin Eberlei
+ * @author David Coallier
+ */
+class MySQLKeywords extends KeywordList
+{
+ public function getName()
+ {
+ return 'MySQL';
+ }
+
+ protected function getKeywords()
+ {
+ return array(
+ 'ADD',
+ 'ALL',
+ 'ALTER',
+ 'ANALYZE',
+ 'AND',
+ 'AS',
+ 'ASC',
+ 'ASENSITIVE',
+ 'BEFORE',
+ 'BETWEEN',
+ 'BIGINT',
+ 'BINARY',
+ 'BLOB',
+ 'BOTH',
+ 'BY',
+ 'CALL',
+ 'CASCADE',
+ 'CASE',
+ 'CHANGE',
+ 'CHAR',
+ 'CHARACTER',
+ 'CHECK',
+ 'COLLATE',
+ 'COLUMN',
+ 'CONDITION',
+ 'CONNECTION',
+ 'CONSTRAINT',
+ 'CONTINUE',
+ 'CONVERT',
+ 'CREATE',
+ 'CROSS',
+ 'CURRENT_DATE',
+ 'CURRENT_TIME',
+ 'CURRENT_TIMESTAMP',
+ 'CURRENT_USER',
+ 'CURSOR',
+ 'DATABASE',
+ 'DATABASES',
+ 'DAY_HOUR',
+ 'DAY_MICROSECOND',
+ 'DAY_MINUTE',
+ 'DAY_SECOND',
+ 'DEC',
+ 'DECIMAL',
+ 'DECLARE',
+ 'DEFAULT',
+ 'DELAYED',
+ 'DELETE',
+ 'DESC',
+ 'DESCRIBE',
+ 'DETERMINISTIC',
+ 'DISTINCT',
+ 'DISTINCTROW',
+ 'DIV',
+ 'DOUBLE',
+ 'DROP',
+ 'DUAL',
+ 'EACH',
+ 'ELSE',
+ 'ELSEIF',
+ 'ENCLOSED',
+ 'ESCAPED',
+ 'EXISTS',
+ 'EXIT',
+ 'EXPLAIN',
+ 'FALSE',
+ 'FETCH',
+ 'FLOAT',
+ 'FLOAT4',
+ 'FLOAT8',
+ 'FOR',
+ 'FORCE',
+ 'FOREIGN',
+ 'FROM',
+ 'FULLTEXT',
+ 'GOTO',
+ 'GRANT',
+ 'GROUP',
+ 'HAVING',
+ 'HIGH_PRIORITY',
+ 'HOUR_MICROSECOND',
+ 'HOUR_MINUTE',
+ 'HOUR_SECOND',
+ 'IF',
+ 'IGNORE',
+ 'IN',
+ 'INDEX',
+ 'INFILE',
+ 'INNER',
+ 'INOUT',
+ 'INSENSITIVE',
+ 'INSERT',
+ 'INT',
+ 'INT1',
+ 'INT2',
+ 'INT3',
+ 'INT4',
+ 'INT8',
+ 'INTEGER',
+ 'INTERVAL',
+ 'INTO',
+ 'IS',
+ 'ITERATE',
+ 'JOIN',
+ 'KEY',
+ 'KEYS',
+ 'KILL',
+ 'LABEL',
+ 'LEADING',
+ 'LEAVE',
+ 'LEFT',
+ 'LIKE',
+ 'LIMIT',
+ 'LINES',
+ 'LOAD',
+ 'LOCALTIME',
+ 'LOCALTIMESTAMP',
+ 'LOCK',
+ 'LONG',
+ 'LONGBLOB',
+ 'LONGTEXT',
+ 'LOOP',
+ 'LOW_PRIORITY',
+ 'MATCH',
+ 'MEDIUMBLOB',
+ 'MEDIUMINT',
+ 'MEDIUMTEXT',
+ 'MIDDLEINT',
+ 'MINUTE_MICROSECOND',
+ 'MINUTE_SECOND',
+ 'MOD',
+ 'MODIFIES',
+ 'NATURAL',
+ 'NOT',
+ 'NO_WRITE_TO_BINLOG',
+ 'NULL',
+ 'NUMERIC',
+ 'ON',
+ 'OPTIMIZE',
+ 'OPTION',
+ 'OPTIONALLY',
+ 'OR',
+ 'ORDER',
+ 'OUT',
+ 'OUTER',
+ 'OUTFILE',
+ 'PRECISION',
+ 'PRIMARY',
+ 'PROCEDURE',
+ 'PURGE',
+ 'RAID0',
+ 'READ',
+ 'READS',
+ 'REAL',
+ 'REFERENCES',
+ 'REGEXP',
+ 'RELEASE',
+ 'RENAME',
+ 'REPEAT',
+ 'REPLACE',
+ 'REQUIRE',
+ 'RESTRICT',
+ 'RETURN',
+ 'REVOKE',
+ 'RIGHT',
+ 'RLIKE',
+ 'SCHEMA',
+ 'SCHEMAS',
+ 'SECOND_MICROSECOND',
+ 'SELECT',
+ 'SENSITIVE',
+ 'SEPARATOR',
+ 'SET',
+ 'SHOW',
+ 'SMALLINT',
+ 'SONAME',
+ 'SPATIAL',
+ 'SPECIFIC',
+ 'SQL',
+ 'SQLEXCEPTION',
+ 'SQLSTATE',
+ 'SQLWARNING',
+ 'SQL_BIG_RESULT',
+ 'SQL_CALC_FOUND_ROWS',
+ 'SQL_SMALL_RESULT',
+ 'SSL',
+ 'STARTING',
+ 'STRAIGHT_JOIN',
+ 'TABLE',
+ 'TERMINATED',
+ 'THEN',
+ 'TINYBLOB',
+ 'TINYINT',
+ 'TINYTEXT',
+ 'TO',
+ 'TRAILING',
+ 'TRIGGER',
+ 'TRUE',
+ 'UNDO',
+ 'UNION',
+ 'UNIQUE',
+ 'UNLOCK',
+ 'UNSIGNED',
+ 'UPDATE',
+ 'USAGE',
+ 'USE',
+ 'USING',
+ 'UTC_DATE',
+ 'UTC_TIME',
+ 'UTC_TIMESTAMP',
+ 'VALUES',
+ 'VARBINARY',
+ 'VARCHAR',
+ 'VARCHARACTER',
+ 'VARYING',
+ 'WHEN',
+ 'WHERE',
+ 'WHILE',
+ 'WITH',
+ 'WRITE',
+ 'X509',
+ 'XOR',
+ 'YEAR_MONTH',
+ 'ZEROFILL',
+ );
+ }
+}
\ No newline at end of file
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-dbal/lib/Doctrine/DBAL/Platforms/Keywords/OracleKeywords.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-dbal/lib/Doctrine/DBAL/Platforms/Keywords/OracleKeywords.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,156 @@
+.
+ */
+
+
+namespace Doctrine\DBAL\Platforms\Keywords;
+
+/**
+ * Oracle Keywordlist
+ *
+ * @license BSD http://www.opensource.org/licenses/bsd-license.php
+ * @link www.doctrine-project.com
+ * @since 2.0
+ * @author Benjamin Eberlei
+ * @author David Coallier
+ */
+class OracleKeywords extends KeywordList
+{
+ public function getName()
+ {
+ return 'Oracle';
+ }
+
+ protected function getKeywords()
+ {
+ return array(
+ 'ACCESS',
+ 'ELSE',
+ 'MODIFY',
+ 'START',
+ 'ADD',
+ 'EXCLUSIVE',
+ 'NOAUDIT',
+ 'SELECT',
+ 'ALL',
+ 'EXISTS',
+ 'NOCOMPRESS',
+ 'SESSION',
+ 'ALTER',
+ 'FILE',
+ 'NOT',
+ 'SET',
+ 'AND',
+ 'FLOAT',
+ 'NOTFOUND ',
+ 'SHARE',
+ 'ANY',
+ 'FOR',
+ 'NOWAIT',
+ 'SIZE',
+ 'ARRAYLEN',
+ 'FROM',
+ 'NULL',
+ 'SMALLINT',
+ 'AS',
+ 'GRANT',
+ 'NUMBER',
+ 'SQLBUF',
+ 'ASC',
+ 'GROUP',
+ 'OF',
+ 'SUCCESSFUL',
+ 'AUDIT',
+ 'HAVING',
+ 'OFFLINE ',
+ 'SYNONYM',
+ 'BETWEEN',
+ 'IDENTIFIED',
+ 'ON',
+ 'SYSDATE',
+ 'BY',
+ 'IMMEDIATE',
+ 'ONLINE',
+ 'TABLE',
+ 'CHAR',
+ 'IN',
+ 'OPTION',
+ 'THEN',
+ 'CHECK',
+ 'INCREMENT',
+ 'OR',
+ 'TO',
+ 'CLUSTER',
+ 'INDEX',
+ 'ORDER',
+ 'TRIGGER',
+ 'COLUMN',
+ 'INITIAL',
+ 'PCTFREE',
+ 'UID',
+ 'COMMENT',
+ 'INSERT',
+ 'PRIOR',
+ 'UNION',
+ 'COMPRESS',
+ 'INTEGER',
+ 'PRIVILEGES',
+ 'UNIQUE',
+ 'CONNECT',
+ 'INTERSECT',
+ 'PUBLIC',
+ 'UPDATE',
+ 'CREATE',
+ 'INTO',
+ 'RAW',
+ 'USER',
+ 'CURRENT',
+ 'IS',
+ 'RENAME',
+ 'VALIDATE',
+ 'DATE',
+ 'LEVEL',
+ 'RESOURCE',
+ 'VALUES',
+ 'DECIMAL',
+ 'LIKE',
+ 'REVOKE',
+ 'VARCHAR',
+ 'DEFAULT',
+ 'LOCK',
+ 'ROW',
+ 'VARCHAR2',
+ 'DELETE',
+ 'LONG',
+ 'ROWID',
+ 'VIEW',
+ 'DESC',
+ 'MAXEXTENTS',
+ 'ROWLABEL',
+ 'WHENEVER',
+ 'DISTINCT',
+ 'MINUS',
+ 'ROWNUM',
+ 'WHERE',
+ 'DROP',
+ 'MODE',
+ 'ROWS',
+ 'WITH',
+ );
+ }
+}
\ No newline at end of file
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-dbal/lib/Doctrine/DBAL/Platforms/Keywords/PostgreSQLKeywords.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-dbal/lib/Doctrine/DBAL/Platforms/Keywords/PostgreSQLKeywords.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,131 @@
+.
+ */
+
+
+namespace Doctrine\DBAL\Platforms\Keywords;
+
+/**
+ * PostgreSQL Keywordlist
+ *
+ * @license BSD http://www.opensource.org/licenses/bsd-license.php
+ * @link www.doctrine-project.com
+ * @since 2.0
+ * @author Benjamin Eberlei
+ * @author Marcelo Santos Araujo
+ */
+class PostgreSQLKeywords extends KeywordList
+{
+ public function getName()
+ {
+ return 'PostgreSQL';
+ }
+
+ protected function getKeywords()
+ {
+ return array(
+ 'ALL',
+ 'ANALYSE',
+ 'ANALYZE',
+ 'AND',
+ 'ANY',
+ 'AS',
+ 'ASC',
+ 'AUTHORIZATION',
+ 'BETWEEN',
+ 'BINARY',
+ 'BOTH',
+ 'CASE',
+ 'CAST',
+ 'CHECK',
+ 'COLLATE',
+ 'COLUMN',
+ 'CONSTRAINT',
+ 'CREATE',
+ 'CURRENT_DATE',
+ 'CURRENT_TIME',
+ 'CURRENT_TIMESTAMP',
+ 'CURRENT_USER',
+ 'DEFAULT',
+ 'DEFERRABLE',
+ 'DESC',
+ 'DISTINCT',
+ 'DO',
+ 'ELSE',
+ 'END',
+ 'EXCEPT',
+ 'FALSE',
+ 'FOR',
+ 'FOREIGN',
+ 'FREEZE',
+ 'FROM',
+ 'FULL',
+ 'GRANT',
+ 'GROUP',
+ 'HAVING',
+ 'ILIKE',
+ 'IN',
+ 'INITIALLY',
+ 'INNER',
+ 'INTERSECT',
+ 'INTO',
+ 'IS',
+ 'ISNULL',
+ 'JOIN',
+ 'LEADING',
+ 'LEFT',
+ 'LIKE',
+ 'LIMIT',
+ 'LOCALTIME',
+ 'LOCALTIMESTAMP',
+ 'NATURAL',
+ 'NEW',
+ 'NOT',
+ 'NOTNULL',
+ 'NULL',
+ 'OFF',
+ 'OFFSET',
+ 'OLD',
+ 'ON',
+ 'ONLY',
+ 'OR',
+ 'ORDER',
+ 'OUTER',
+ 'OVERLAPS',
+ 'PLACING',
+ 'PRIMARY',
+ 'REFERENCES',
+ 'SELECT',
+ 'SESSION_USER',
+ 'SIMILAR',
+ 'SOME',
+ 'TABLE',
+ 'THEN',
+ 'TO',
+ 'TRAILING',
+ 'TRUE',
+ 'UNION',
+ 'UNIQUE',
+ 'USER',
+ 'USING',
+ 'VERBOSE',
+ 'WHEN',
+ 'WHERE'
+ );
+ }
+}
\ No newline at end of file
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-dbal/lib/Doctrine/DBAL/Platforms/Keywords/ReservedKeywordsValidator.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-dbal/lib/Doctrine/DBAL/Platforms/Keywords/ReservedKeywordsValidator.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,116 @@
+.
+ */
+
+
+namespace Doctrine\DBAL\Platforms\Keywords;
+
+use Doctrine\DBAL\Schema\Visitor\Visitor;
+use Doctrine\DBAL\Schema\Table;
+use Doctrine\DBAL\Schema\Column;
+use Doctrine\DBAL\Schema\ForeignKeyConstraint;
+use Doctrine\DBAL\Schema\Schema;
+use Doctrine\DBAL\Schema\Sequence;
+use Doctrine\DBAL\Schema\Index;
+
+class ReservedKeywordsValidator implements Visitor
+{
+ /**
+ * @var KeywordList[]
+ */
+ private $keywordLists = array();
+
+ /**
+ * @var array
+ */
+ private $violations = array();
+
+ public function __construct(array $keywordLists)
+ {
+ $this->keywordLists = $keywordLists;
+ }
+
+ public function getViolations()
+ {
+ return $this->violations;
+ }
+
+ /**
+ * @param string $word
+ * @return array
+ */
+ private function isReservedWord($word)
+ {
+ if ($word[0] == "`") {
+ $word = str_replace('`', '', $word);
+ }
+
+ $keywordLists = array();
+ foreach ($this->keywordLists AS $keywordList) {
+ if ($keywordList->isKeyword($word)) {
+ $keywordLists[] = $keywordList->getName();
+ }
+ }
+ return $keywordLists;
+ }
+
+ private function addViolation($asset, $violatedPlatforms)
+ {
+ if (!$violatedPlatforms) {
+ return;
+ }
+
+ $this->violations[] = $asset . ' keyword violations: ' . implode(', ', $violatedPlatforms);
+ }
+
+ public function acceptColumn(Table $table, Column $column)
+ {
+ $this->addViolation(
+ 'Table ' . $table->getName() . ' column ' . $column->getName(),
+ $this->isReservedWord($column->getName())
+ );
+ }
+
+ public function acceptForeignKey(Table $localTable, ForeignKeyConstraint $fkConstraint)
+ {
+
+ }
+
+ public function acceptIndex(Table $table, Index $index)
+ {
+
+ }
+
+ public function acceptSchema(Schema $schema)
+ {
+
+ }
+
+ public function acceptSequence(Sequence $sequence)
+ {
+
+ }
+
+ public function acceptTable(Table $table)
+ {
+ $this->addViolation(
+ 'Table ' . $table->getName(),
+ $this->isReservedWord($table->getName())
+ );
+ }
+}
\ No newline at end of file
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-dbal/lib/Doctrine/DBAL/Platforms/Keywords/SQLiteKeywords.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-dbal/lib/Doctrine/DBAL/Platforms/Keywords/SQLiteKeywords.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,164 @@
+.
+ */
+
+
+namespace Doctrine\DBAL\Platforms\Keywords;
+
+/**
+ * SQLite Keywords
+ *
+ * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
+ * @link www.doctrine-project.com
+ * @since 2.0
+ * @author Benjamin Eberlei
+ */
+class SQLiteKeywords extends KeywordList
+{
+ public function getName()
+ {
+ return 'SQLite';
+ }
+
+ protected function getKeywords()
+ {
+ return array(
+ 'ABORT',
+ 'ACTION',
+ 'ADD',
+ 'AFTER',
+ 'ALL',
+ 'ALTER',
+ 'ANALYZE',
+ 'AND',
+ 'AS',
+ 'ASC',
+ 'ATTACH',
+ 'AUTOINCREMENT',
+ 'BEFORE',
+ 'BEGIN',
+ 'BETWEEN',
+ 'BY',
+ 'CASCADE',
+ 'CASE',
+ 'CAST',
+ 'CHECK',
+ 'COLLATE',
+ 'COLUMN',
+ 'COMMIT',
+ 'CONFLICT',
+ 'CONSTRAINT',
+ 'CREATE',
+ 'CROSS',
+ 'CURRENT_DATE',
+ 'CURRENT_TIME',
+ 'CURRENT_TIMESTAMP',
+ 'DATABASE',
+ 'DEFAULT',
+ 'DEFERRABLE',
+ 'DEFERRED',
+ 'DELETE',
+ 'DESC',
+ 'DETACH',
+ 'DISTINCT',
+ 'DROP',
+ 'EACH',
+ 'ELSE',
+ 'END',
+ 'ESCAPE',
+ 'EXCEPT',
+ 'EXCLUSIVE',
+ 'EXISTS',
+ 'EXPLAIN',
+ 'FAIL',
+ 'FOR',
+ 'FOREIGN',
+ 'FROM',
+ 'FULL',
+ 'GLOB',
+ 'GROUP',
+ 'HAVING',
+ 'IF',
+ 'IGNORE',
+ 'IMMEDIATE',
+ 'IN',
+ 'INDEX',
+ 'INDEXED',
+ 'INITIALLY',
+ 'INNER',
+ 'INSERT',
+ 'INSTEAD',
+ 'INTERSECT',
+ 'INTO',
+ 'IS',
+ 'ISNULL',
+ 'JOIN',
+ 'KEY',
+ 'LEFT',
+ 'LIKE',
+ 'LIMIT',
+ 'MATCH',
+ 'NATURAL',
+ 'NO',
+ 'NOT',
+ 'NOTNULL',
+ 'NULL',
+ 'OF',
+ 'OFFSET',
+ 'ON',
+ 'OR',
+ 'ORDER',
+ 'OUTER',
+ 'PLAN',
+ 'PRAGMA',
+ 'PRIMARY',
+ 'QUERY',
+ 'RAISE',
+ 'REFERENCES',
+ 'REGEXP',
+ 'REINDEX',
+ 'RELEASE',
+ 'RENAME',
+ 'REPLACE',
+ 'RESTRICT',
+ 'RIGHT',
+ 'ROLLBACK',
+ 'ROW',
+ 'SAVEPOINT',
+ 'SELECT',
+ 'SET',
+ 'TABLE',
+ 'TEMP',
+ 'TEMPORARY',
+ 'THEN',
+ 'TO',
+ 'TRANSACTION',
+ 'TRIGGER',
+ 'UNION',
+ 'UNIQUE',
+ 'UPDATE',
+ 'USING',
+ 'VACUUM',
+ 'VALUES',
+ 'VIEW',
+ 'VIRTUAL',
+ 'WHEN',
+ 'WHERE'
+ );
+ }
+}
\ No newline at end of file
diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-dbal/lib/Doctrine/DBAL/Platforms/MsSqlPlatform.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/doctrine-dbal/lib/Doctrine/DBAL/Platforms/MsSqlPlatform.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,796 @@
+.
+ */
+
+namespace Doctrine\DBAL\Platforms;
+
+use Doctrine\DBAL\Schema\TableDiff;
+use Doctrine\DBAL\DBALException;
+use Doctrine\DBAL\Schema\Index,
+ Doctrine\DBAL\Schema\Table;
+
+/**
+ * The MsSqlPlatform provides the behavior, features and SQL dialect of the
+ * MySQL database platform.
+ *
+ * @since 2.0
+ * @author Roman Borschel
+ * @author Jonathan H. Wage