Upgraded to Symfony 2.1-beta2

This commit is contained in:
Polonkai Gergely
2012-07-15 14:56:31 +02:00
parent c1232c9792
commit bb7aee6fee
455 changed files with 21001 additions and 18480 deletions

View File

@@ -27,6 +27,9 @@ use Doctrine\DBAL\DriverManager;
*/
class CreateDatabaseDoctrineCommand extends DoctrineCommand
{
/**
* {@inheritDoc}
*/
protected function configure()
{
$this
@@ -47,6 +50,9 @@ EOT
);
}
/**
* {@inheritDoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$connection = $this->getDoctrineConnection($input->getOption('connection'));

View File

@@ -24,6 +24,11 @@ use Doctrine\ORM\Tools\EntityGenerator;
*/
abstract class DoctrineCommand extends ContainerAwareCommand
{
/**
* get a doctrine entity generator
*
* @return EntityGenerator
*/
protected function getEntityGenerator()
{
$entityGenerator = new EntityGenerator();
@@ -37,6 +42,12 @@ abstract class DoctrineCommand extends ContainerAwareCommand
return $entityGenerator;
}
/**
* Get a doctrine entity manager by symfony name.
*
* @param string $name
* @return \Doctrine\ORM\EntityManager
*/
protected function getEntityManager($name)
{
return $this->getContainer()->get('doctrine')->getManager($name);
@@ -46,7 +57,7 @@ abstract class DoctrineCommand extends ContainerAwareCommand
* Get a doctrine dbal connection by symfony name.
*
* @param string $name
* @return Doctrine\DBAL\Connection
* @return \Doctrine\DBAL\Connection
*/
protected function getDoctrineConnection($name)
{

View File

@@ -26,6 +26,9 @@ use Symfony\Component\Console\Output\OutputInterface;
*/
class DropDatabaseDoctrineCommand extends DoctrineCommand
{
/**
* {@inheritDoc}
*/
protected function configure()
{
$this
@@ -52,6 +55,9 @@ EOT
);
}
/**
* {@inheritDoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$connection = $this->getDoctrineConnection($input->getOption('connection'));

View File

@@ -29,6 +29,9 @@ use Doctrine\Bundle\DoctrineBundle\Mapping\DisconnectedMetadataFactory;
*/
class GenerateEntitiesDoctrineCommand extends DoctrineCommand
{
/**
* {@inheritDoc}
*/
protected function configure()
{
$this
@@ -79,6 +82,9 @@ EOT
);
}
/**
* {@inheritDoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$manager = new DisconnectedMetadataFactory($this->getContainer()->get('doctrine'));

View File

@@ -31,6 +31,9 @@ use Doctrine\ORM\Tools\Console\MetadataFilter;
*/
class ImportMappingDoctrineCommand extends DoctrineCommand
{
/**
* {@inheritDoc}
*/
protected function configure()
{
$this
@@ -65,6 +68,9 @@ EOT
);
}
/**
* {@inheritDoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$bundle = $this->getApplication()->getKernel()->getBundle($input->getArgument('bundle'));

View File

@@ -27,6 +27,9 @@ use Doctrine\ORM\Tools\Console\Command\ClearCache\MetadataCommand;
*/
class ClearMetadataCacheDoctrineCommand extends MetadataCommand
{
/**
* {@inheritDoc}
*/
protected function configure()
{
parent::configure();
@@ -49,6 +52,9 @@ EOT
);
}
/**
* {@inheritDoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));

View File

@@ -27,6 +27,9 @@ use Doctrine\ORM\Tools\Console\Command\ClearCache\QueryCommand;
*/
class ClearQueryCacheDoctrineCommand extends QueryCommand
{
/**
* {@inheritDoc}
*/
protected function configure()
{
parent::configure();
@@ -49,6 +52,9 @@ EOT
);
}
/**
* {@inheritDoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));

View File

@@ -27,6 +27,9 @@ use Doctrine\ORM\Tools\Console\Command\ClearCache\ResultCommand;
*/
class ClearResultCacheDoctrineCommand extends ResultCommand
{
/**
* {@inheritDoc}
*/
protected function configure()
{
parent::configure();
@@ -45,25 +48,13 @@ You can also optionally specify the <comment>--em</comment> option to specify
which entity manager to clear the cache for:
<info>php app/console doctrine:cache:clear-result --em=default</info>
If you don't want to clear all result cache you can specify some additional
options to control what cache is deleted:
<info>php app/console doctrine:cache:clear-result --id=cache_key</info>
Or you can specify a <comment>--regex</comment> to delete cache entries that
match it:
<info>php app/console doctrine:cache:clear-result --regex="user_(.*)"</info>
You can also specify a <comment>--prefix</comment> or
<comment>--suffix</comment> to delete cache entries for:
<info>php app/console doctrine:cache:clear-result --prefix="user_" --suffix="_frontend"</info>
EOT
);
}
/**
* {@inheritDoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));

View File

@@ -31,6 +31,9 @@ use Doctrine\ORM\Tools\Export\Driver\YamlExporter;
*/
class ConvertMappingDoctrineCommand extends ConvertMappingCommand
{
/**
* {@inheritDoc}
*/
protected function configure()
{
parent::configure();
@@ -46,6 +49,9 @@ EOT
);
}
/**
* {@inheritDoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));
@@ -53,9 +59,15 @@ EOT
return parent::execute($input, $output);
}
/**
* @param string $toType
* @param string $destPath
*
* @return \Doctrine\ORM\Tools\Export\Driver\AbstractExporter
*/
protected function getExporter($toType, $destPath)
{
/** @var $exporter \Doctrine\ORM\Tools\Export\Driver\AbstractExporter */
$exporter = parent::getExporter($toType, $destPath);
if ($exporter instanceof XmlExporter) {
$exporter->setExtension('.orm.xml');

View File

@@ -29,6 +29,9 @@ use Doctrine\ORM\Tools\Console\Command\SchemaTool\CreateCommand;
*/
class CreateSchemaDoctrineCommand extends CreateCommand
{
/**
* {@inheritDoc}
*/
protected function configure()
{
parent::configure();
@@ -54,6 +57,9 @@ EOT
);
}
/**
* {@inheritDoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));

View File

@@ -13,7 +13,7 @@
*/
namespace Doctrine\Bundle\DoctrineBundle\Command\Proxy;
use Symfony\Component\Console\Application;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper;
use Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper;
@@ -33,12 +33,19 @@ abstract class DoctrineCommandHelper
*/
static public function setApplicationEntityManager(Application $application, $emName)
{
/** @var $em \Doctrine\ORM\EntityManager */
$em = $application->getKernel()->getContainer()->get('doctrine')->getManager($emName);
$helperSet = $application->getHelperSet();
$helperSet->set(new ConnectionHelper($em->getConnection()), 'db');
$helperSet->set(new EntityManagerHelper($em), 'em');
}
/**
* Convenience method to push the helper sets of a given connection into the application.
*
* @param Application $application
* @param string $connName
*/
static public function setApplicationConnection(Application $application, $connName)
{
$connection = $application->getKernel()->getContainer()->get('doctrine')->getConnection($connName);

View File

@@ -28,6 +28,9 @@ use Doctrine\ORM\Tools\Console\Command\SchemaTool\DropCommand;
*/
class DropSchemaDoctrineCommand extends DropCommand
{
/**
* {@inheritDoc}
*/
protected function configure()
{
parent::configure();
@@ -54,6 +57,9 @@ EOT
);
}
/**
* {@inheritDoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));

View File

@@ -28,6 +28,9 @@ use Doctrine\ORM\Tools\Console\Command\EnsureProductionSettingsCommand;
*/
class EnsureProductionSettingsDoctrineCommand extends EnsureProductionSettingsCommand
{
/**
* {@inheritDoc}
*/
protected function configure()
{
parent::configure();
@@ -49,6 +52,9 @@ EOT
);
}
/**
* {@inheritDoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));

View File

@@ -27,6 +27,9 @@ use Symfony\Component\Console\Output\OutputInterface;
*/
class InfoDoctrineCommand extends InfoCommand
{
/**
* {@inheritDoc}
*/
protected function configure()
{
$this
@@ -48,6 +51,9 @@ EOT
);
}
/**
* {@inheritDoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));

View File

@@ -28,6 +28,9 @@ use Doctrine\ORM\Tools\Console\Command\RunDqlCommand;
*/
class RunDqlDoctrineCommand extends RunDqlCommand
{
/**
* {@inheritDoc}
*/
protected function configure()
{
parent::configure();
@@ -54,6 +57,9 @@ EOT
);
}
/**
* {@inheritDoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));

View File

@@ -28,6 +28,9 @@ use Doctrine\DBAL\Tools\Console\Command\RunSqlCommand;
*/
class RunSqlDoctrineCommand extends RunSqlCommand
{
/**
* {@inheritDoc}
*/
protected function configure()
{
parent::configure();
@@ -44,6 +47,9 @@ EOT
);
}
/**
* {@inheritDoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
DoctrineCommandHelper::setApplicationConnection($this->getApplication(), $input->getOption('connection'));

View File

@@ -29,6 +29,9 @@ use Doctrine\ORM\Tools\Console\Command\SchemaTool\UpdateCommand;
*/
class UpdateSchemaDoctrineCommand extends UpdateCommand
{
/**
* {@inheritDoc}
*/
protected function configure()
{
parent::configure();
@@ -58,6 +61,9 @@ EOT
);
}
/**
* {@inheritDoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));

View File

@@ -28,6 +28,9 @@ use Doctrine\ORM\Tools\Console\Command\ValidateSchemaCommand as DoctrineValidate
*/
class ValidateSchemaCommand extends DoctrineValidateSchemaCommand
{
/**
* {@inheritDoc}
*/
protected function configure()
{
parent::configure();
@@ -50,6 +53,9 @@ EOT
);
}
/**
* {@inheritDoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));