Permalink
Browse files

[DoctrineBundle] removed the bundle (migrated to the Doctrine organiz…

…ation)
  • Loading branch information...
fabpot committed Jan 2, 2012
1 parent d3ab39d commit dcf209a4aaf27147848437bc5a505b5506116d44
Showing with 0 additions and 5,086 deletions.
  1. +0 −68 src/Symfony/Bundle/DoctrineBundle/Command/CreateDatabaseDoctrineCommand.php
  2. +0 −52 src/Symfony/Bundle/DoctrineBundle/Command/DoctrineCommand.php
  3. +0 −80 src/Symfony/Bundle/DoctrineBundle/Command/DropDatabaseDoctrineCommand.php
  4. +0 −131 src/Symfony/Bundle/DoctrineBundle/Command/GenerateEntitiesDoctrineCommand.php
  5. +0 −123 src/Symfony/Bundle/DoctrineBundle/Command/ImportMappingDoctrineCommand.php
  6. +0 −86 src/Symfony/Bundle/DoctrineBundle/Command/InfoDoctrineCommand.php
  7. +0 −55 src/Symfony/Bundle/DoctrineBundle/Command/Proxy/ClearMetadataCacheDoctrineCommand.php
  8. +0 −55 src/Symfony/Bundle/DoctrineBundle/Command/Proxy/ClearQueryCacheDoctrineCommand.php
  9. +0 −70 src/Symfony/Bundle/DoctrineBundle/Command/Proxy/ClearResultCacheDoctrineCommand.php
  10. +0 −65 src/Symfony/Bundle/DoctrineBundle/Command/Proxy/ConvertMappingDoctrineCommand.php
  11. +0 −60 src/Symfony/Bundle/DoctrineBundle/Command/Proxy/CreateSchemaDoctrineCommand.php
  12. +0 −46 src/Symfony/Bundle/DoctrineBundle/Command/Proxy/DoctrineCommandHelper.php
  13. +0 −60 src/Symfony/Bundle/DoctrineBundle/Command/Proxy/DropSchemaDoctrineCommand.php
  14. +0 −55 src/Symfony/Bundle/DoctrineBundle/Command/Proxy/EnsureProductionSettingsDoctrineCommand.php
  15. +0 −60 src/Symfony/Bundle/DoctrineBundle/Command/Proxy/RunDqlDoctrineCommand.php
  16. +0 −50 src/Symfony/Bundle/DoctrineBundle/Command/Proxy/RunSqlDoctrineCommand.php
  17. +0 −64 src/Symfony/Bundle/DoctrineBundle/Command/Proxy/UpdateSchemaDoctrineCommand.php
  18. +0 −56 src/Symfony/Bundle/DoctrineBundle/Command/Proxy/ValidateSchemaCommand.php
  19. +0 −75 src/Symfony/Bundle/DoctrineBundle/ConnectionFactory.php
  20. +0 −105 ...y/Bundle/DoctrineBundle/DependencyInjection/Compiler/RegisterEventListenersAndSubscribersPass.php
  21. +0 −289 src/Symfony/Bundle/DoctrineBundle/DependencyInjection/Configuration.php
  22. +0 −430 src/Symfony/Bundle/DoctrineBundle/DependencyInjection/DoctrineExtension.php
  23. +0 −92 src/Symfony/Bundle/DoctrineBundle/DoctrineBundle.php
  24. +0 −52 src/Symfony/Bundle/DoctrineBundle/Mapping/ClassMetadataCollection.php
  25. +0 −23 src/Symfony/Bundle/DoctrineBundle/Mapping/DisconnectedMetadataFactory.php
  26. +0 −174 src/Symfony/Bundle/DoctrineBundle/Mapping/MetadataFactory.php
  27. +0 −152 src/Symfony/Bundle/DoctrineBundle/Registry.php
  28. +0 −64 src/Symfony/Bundle/DoctrineBundle/Resources/config/dbal.xml
  29. +0 −81 src/Symfony/Bundle/DoctrineBundle/Resources/config/orm.xml
  30. +0 −149 src/Symfony/Bundle/DoctrineBundle/Resources/config/schema/doctrine-1.0.xsd
  31. +0 −88 src/Symfony/Bundle/DoctrineBundle/Resources/views/Collector/db.html.twig
  32. +0 −45 src/Symfony/Bundle/DoctrineBundle/Tests/Command/InfoDoctrineCommandTest.php
  33. +0 −48 src/Symfony/Bundle/DoctrineBundle/Tests/ContainerTest.php
  34. +0 −788 src/Symfony/Bundle/DoctrineBundle/Tests/DependencyInjection/AbstractDoctrineExtensionTest.php
  35. +0 −18 ...DoctrineBundle/Tests/DependencyInjection/Fixtures/Bundles/AnnotationsBundle/AnnotationsBundle.php
  36. +0 −16 ...undle/DoctrineBundle/Tests/DependencyInjection/Fixtures/Bundles/AnnotationsBundle/Entity/Test.php
  37. +0 −18 ...eBundle/Tests/DependencyInjection/Fixtures/Bundles/Vendor/AnnotationsBundle/AnnotationsBundle.php
  38. +0 −16 ...octrineBundle/Tests/DependencyInjection/Fixtures/Bundles/Vendor/AnnotationsBundle/Entity/Test.php
  39. +0 −16 ...ymfony/Bundle/DoctrineBundle/Tests/DependencyInjection/Fixtures/Bundles/XmlBundle/Entity/Test.php
  40. 0 ...undle/Tests/DependencyInjection/Fixtures/Bundles/XmlBundle/Resources/config/doctrine/Test.orm.xml
  41. +0 −18 src/Symfony/Bundle/DoctrineBundle/Tests/DependencyInjection/Fixtures/Bundles/XmlBundle/XmlBundle.php
  42. +0 −17 ...mfony/Bundle/DoctrineBundle/Tests/DependencyInjection/Fixtures/Bundles/YamlBundle/Entity/Test.php
  43. +0 −5 ...ndle/Tests/DependencyInjection/Fixtures/Bundles/YamlBundle/Resources/config/doctrine/Test.orm.yml
  44. +0 −18 ...ymfony/Bundle/DoctrineBundle/Tests/DependencyInjection/Fixtures/Bundles/YamlBundle/YamlBundle.php
  45. +0 −29 src/Symfony/Bundle/DoctrineBundle/Tests/DependencyInjection/Fixtures/config/xml/dbal_logging.xml
  46. +0 −33 ...octrineBundle/Tests/DependencyInjection/Fixtures/config/xml/dbal_service_multiple_connections.xml
  47. +0 −12 ...e/DoctrineBundle/Tests/DependencyInjection/Fixtures/config/xml/dbal_service_single_connection.xml
  48. +0 −15 src/Symfony/Bundle/DoctrineBundle/Tests/DependencyInjection/Fixtures/config/xml/dbal_types.xml
  49. +0 −25 src/Symfony/Bundle/DoctrineBundle/Tests/DependencyInjection/Fixtures/config/xml/orm_functions.xml
  50. +0 −21 ...ymfony/Bundle/DoctrineBundle/Tests/DependencyInjection/Fixtures/config/xml/orm_hydration_mode.xml
  51. +0 −16 src/Symfony/Bundle/DoctrineBundle/Tests/DependencyInjection/Fixtures/config/xml/orm_imports.xml
  52. +0 −23 ...ymfony/Bundle/DoctrineBundle/Tests/DependencyInjection/Fixtures/config/xml/orm_imports_import.xml
  53. +0 −27 .../DoctrineBundle/Tests/DependencyInjection/Fixtures/config/xml/orm_multiple_em_bundle_mappings.xml
  54. +0 −40 ...rineBundle/Tests/DependencyInjection/Fixtures/config/xml/orm_service_multiple_entity_managers.xml
  55. +0 −26 ...Bundle/Tests/DependencyInjection/Fixtures/config/xml/orm_service_simple_single_entity_manager.xml
  56. +0 −39 ...octrineBundle/Tests/DependencyInjection/Fixtures/config/xml/orm_service_single_entity_manager.xml
  57. +0 −23 ...le/DoctrineBundle/Tests/DependencyInjection/Fixtures/config/xml/orm_single_em_bundle_mappings.xml
  58. +0 −20 ...ndle/DoctrineBundle/Tests/DependencyInjection/Fixtures/config/xml/orm_single_em_dql_functions.xml
  59. +0 −13 src/Symfony/Bundle/DoctrineBundle/Tests/DependencyInjection/Fixtures/config/yml/dbal_logging.yml
  60. +0 −18 ...octrineBundle/Tests/DependencyInjection/Fixtures/config/yml/dbal_service_multiple_connections.yml
  61. +0 −6 ...e/DoctrineBundle/Tests/DependencyInjection/Fixtures/config/yml/dbal_service_single_connection.yml
  62. +0 −7 src/Symfony/Bundle/DoctrineBundle/Tests/DependencyInjection/Fixtures/config/yml/dbal_types.yml
  63. +0 −19 src/Symfony/Bundle/DoctrineBundle/Tests/DependencyInjection/Fixtures/config/yml/orm_functions.yml
  64. +0 −14 ...ymfony/Bundle/DoctrineBundle/Tests/DependencyInjection/Fixtures/config/yml/orm_hydration_mode.yml
  65. +0 −6 src/Symfony/Bundle/DoctrineBundle/Tests/DependencyInjection/Fixtures/config/yml/orm_imports.yml
  66. +0 −15 ...ymfony/Bundle/DoctrineBundle/Tests/DependencyInjection/Fixtures/config/yml/orm_imports_import.yml
  67. +0 −23 .../DoctrineBundle/Tests/DependencyInjection/Fixtures/config/yml/orm_multiple_em_bundle_mappings.yml
  68. +0 −34 ...rineBundle/Tests/DependencyInjection/Fixtures/config/yml/orm_service_multiple_entity_managers.yml
  69. +0 −19 ...Bundle/Tests/DependencyInjection/Fixtures/config/yml/orm_service_simple_single_entity_manager.yml
  70. +0 −26 ...octrineBundle/Tests/DependencyInjection/Fixtures/config/yml/orm_service_single_entity_manager.yml
  71. +0 −18 ...le/DoctrineBundle/Tests/DependencyInjection/Fixtures/config/yml/orm_single_em_bundle_mappings.yml
  72. +0 −11 ...ndle/DoctrineBundle/Tests/DependencyInjection/Fixtures/config/yml/orm_single_em_dql_functions.yml
  73. +0 −29 src/Symfony/Bundle/DoctrineBundle/Tests/DependencyInjection/TestDatetimeFunction.php
  74. +0 −29 src/Symfony/Bundle/DoctrineBundle/Tests/DependencyInjection/TestNumericFunction.php
  75. +0 −29 src/Symfony/Bundle/DoctrineBundle/Tests/DependencyInjection/TestStringFunction.php
  76. +0 −27 src/Symfony/Bundle/DoctrineBundle/Tests/DependencyInjection/TestType.php
  77. +0 −63 src/Symfony/Bundle/DoctrineBundle/Tests/DependencyInjection/XMLSchemaTest.php
  78. +0 −25 src/Symfony/Bundle/DoctrineBundle/Tests/DependencyInjection/XmlDoctrineExtensionTest.php
  79. +0 −25 src/Symfony/Bundle/DoctrineBundle/Tests/DependencyInjection/YamlDoctrineExtensionTest.php
  80. +0 −146 src/Symfony/Bundle/DoctrineBundle/Tests/RegistryTest.php
  81. +0 −75 src/Symfony/Bundle/DoctrineBundle/Tests/TestCase.php
  82. +0 −27 src/Symfony/Bundle/DoctrineBundle/composer.json
@@ -1,68 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Bundle\DoctrineBundle\Command;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Doctrine\DBAL\DriverManager;
/**
* Database tool allows you to easily drop and create your configured databases.
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Jonathan H. Wage <jonwage@gmail.com>
*/
class CreateDatabaseDoctrineCommand extends DoctrineCommand
{
protected function configure()
{
$this
->setName('doctrine:database:create')
->setDescription('Create the configured databases')
->addOption('connection', null, InputOption::VALUE_OPTIONAL, 'The connection to use for this command')
->setHelp(<<<EOT
The <info>doctrine:database:create</info> command creates the default
connections database:
<info>php app/console doctrine:database:create</info>
You can also optionally specify the name of a connection to create the
database for:
<info>php app/console doctrine:database:create --connection=default</info>
EOT
);
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$connection = $this->getDoctrineConnection($input->getOption('connection'));
$params = $connection->getParams();
$name = isset($params['path']) ? $params['path'] : $params['dbname'];
unset($params['dbname']);
$tmpConnection = DriverManager::getConnection($params);
try {
$tmpConnection->getSchemaManager()->createDatabase($name);
$output->writeln(sprintf('<info>Created database for connection named <comment>%s</comment></info>', $name));
} catch (\Exception $e) {
$output->writeln(sprintf('<error>Could not create database for connection named <comment>%s</comment></error>', $name));
$output->writeln(sprintf('<error>%s</error>', $e->getMessage()));
}
$tmpConnection->close();
}
}
@@ -1,52 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Bundle\DoctrineBundle\Command;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Doctrine\ORM\Tools\EntityGenerator;
/**
* Base class for Doctrine console commands to extend from.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
abstract class DoctrineCommand extends ContainerAwareCommand
{
protected function getEntityGenerator()
{
$entityGenerator = new EntityGenerator();
$entityGenerator->setGenerateAnnotations(false);
$entityGenerator->setGenerateStubMethods(true);
$entityGenerator->setRegenerateEntityIfExists(false);
$entityGenerator->setUpdateEntityIfExists(true);
$entityGenerator->setNumSpaces(4);
$entityGenerator->setAnnotationPrefix('ORM\\');
return $entityGenerator;
}
protected function getEntityManager($name)
{
return $this->getContainer()->get('doctrine')->getManager($name);
}
/**
* Get a doctrine dbal connection by symfony name.
*
* @param string $name
* @return Doctrine\DBAL\Connection
*/
protected function getDoctrineConnection($name)
{
return $this->getContainer()->get('doctrine')->getConnection($name);
}
}
@@ -1,80 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Bundle\DoctrineBundle\Command;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
/**
* Database tool allows you to easily drop and create your configured databases.
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Jonathan H. Wage <jonwage@gmail.com>
*/
class DropDatabaseDoctrineCommand extends DoctrineCommand
{
protected function configure()
{
$this
->setName('doctrine:database:drop')
->setDescription('Drop the configured databases')
->addOption('connection', null, InputOption::VALUE_OPTIONAL, 'The connection to use for this command')
->addOption('force', null, InputOption::VALUE_NONE, 'Set this parameter to execute this action')
->setHelp(<<<EOT
The <info>doctrine:database:drop</info> command drops the default connections
database:
<info>php app/console doctrine:database:drop</info>
The --force parameter has to be used to actually drop the database.
You can also optionally specify the name of a connection to drop the database
for:
<info>php app/console doctrine:database:drop --connection=default</info>
<error>Be careful: All data in a given database will be lost when executing
this command.</error>
EOT
);
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$connection = $this->getDoctrineConnection($input->getOption('connection'));
$params = $connection->getParams();
$name = isset($params['path']) ? $params['path'] : (isset($params['dbname']) ? $params['dbname'] : false);
if (!$name) {
throw new \InvalidArgumentException("Connection does not contain a 'path' or 'dbname' parameter and cannot be dropped.");
}
if ($input->getOption('force')) {
try {
$connection->getSchemaManager()->dropDatabase($name);
$output->writeln(sprintf('<info>Dropped database for connection named <comment>%s</comment></info>', $name));
} catch (\Exception $e) {
$output->writeln(sprintf('<error>Could not drop database for connection named <comment>%s</comment></error>', $name));
$output->writeln(sprintf('<error>%s</error>', $e->getMessage()));
}
} else {
$output->writeln('<error>ATTENTION:</error> This operation should not be executed in a production environment.');
$output->writeln('');
$output->writeln(sprintf('<info>Would drop the database named <comment>%s</comment>.</info>', $name));
$output->writeln('Please run the operation with --force to execute');
$output->writeln('<error>All data will be lost!</error>');
}
}
}
@@ -1,131 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Bundle\DoctrineBundle\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Doctrine\ORM\Tools\EntityRepositoryGenerator;
use Symfony\Bundle\DoctrineBundle\Mapping\DisconnectedMetadataFactory;
/**
* Generate entity classes from mapping information
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Jonathan H. Wage <jonwage@gmail.com>
*/
class GenerateEntitiesDoctrineCommand extends DoctrineCommand
{
protected function configure()
{
$this
->setName('doctrine:generate:entities')
->setAliases(array('generate:doctrine:entities'))
->setDescription('Generate entity classes and method stubs from your mapping information')
->addArgument('name', InputArgument::REQUIRED, 'A bundle name, a namespace, or a class name')
->addOption('path', null, InputOption::VALUE_REQUIRED, 'The path where to generate entities when it cannot be guessed')
->addOption('no-backup', null, InputOption::VALUE_NONE, 'Do not backup existing entities files.')
->setHelp(<<<EOT
The <info>doctrine:generate:entities</info> command generates entity classes
and method stubs from your mapping information:
You have to limit generation of entities:
* To a bundle:
<info>php app/console doctrine:generate:entities MyCustomBundle</info>
* To a single entity:
<info>php app/console doctrine:generate:entities MyCustomBundle:User</info>
<info>php app/console doctrine:generate:entities MyCustomBundle/Entity/User</info>
* To a namespace
<info>php app/console doctrine:generate:entities MyCustomBundle/Entity</info>
If the entities are not stored in a bundle, and if the classes do not exist,
the command has no way to guess where they should be generated. In this case,
you must provide the <comment>--path</comment> option:
<info>php app/console doctrine:generate:entities Blog/Entity --path=src/</info>
By default, the unmodified version of each entity is backed up and saved
(e.g. Product.php~). To prevent this task from creating the backup file,
pass the <comment>--no-backup</comment> option:
<info>php app/console doctrine:generate:entities Blog/Entity --no-backup</info>
<error>Important:</error> Even if you specified Inheritance options in your
XML or YAML Mapping files the generator cannot generate the base and
child classes for you correctly, because it doesn't know which
class is supposed to extend which. You have to adjust the entity
code manually for inheritance to work!
EOT
);
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$manager = new DisconnectedMetadataFactory($this->getContainer()->get('doctrine'));
try {
$bundle = $this->getApplication()->getKernel()->getBundle($input->getArgument('name'));
$output->writeln(sprintf('Generating entities for bundle "<info>%s</info>"', $bundle->getName()));
$metadata = $manager->getBundleMetadata($bundle);
} catch (\InvalidArgumentException $e) {
$name = strtr($input->getArgument('name'), '/', '\\');
if (false !== $pos = strpos($name, ':')) {
$name = $this->getContainer()->get('doctrine')->getEntityNamespace(substr($name, 0, $pos)).'\\'.substr($name, $pos + 1);
}
if (class_exists($name)) {
$output->writeln(sprintf('Generating entity "<info>%s</info>"', $name));
$metadata = $manager->getClassMetadata($name, $input->getOption('path'));
} else {
$output->writeln(sprintf('Generating entities for namespace "<info>%s</info>"', $name));
$metadata = $manager->getNamespaceMetadata($name, $input->getOption('path'));
}
}
$generator = $this->getEntityGenerator();
$backupExisting = !$input->getOption('no-backup');
$generator->setBackupExisting($backupExisting);
$repoGenerator = new EntityRepositoryGenerator();
foreach ($metadata->getMetadata() as $m) {
if ($backupExisting) {
$basename = substr($m->name, strrpos($m->name, '\\') + 1);
$output->writeln(sprintf(' > backing up <comment>%s.php</comment> to <comment>%s.php~</comment>', $basename, $basename));
}
// Getting the metadata for the entity class once more to get the correct path if the namespace has multiple occurrences
try {
$entityMetadata = $manager->getClassMetadata($m->getName(), $input->getOption('path'));
} catch (\RuntimeException $e) {
// fall back to the bundle metadata when no entity class could be found
$entityMetadata = $metadata;
}
$output->writeln(sprintf(' > generating <comment>%s</comment>', $m->name));
$generator->generate(array($m), $entityMetadata->getPath());
if ($m->customRepositoryClassName && false !== strpos($m->customRepositoryClassName, $metadata->getNamespace())) {
$repoGenerator->writeEntityRepositoryClass($m->customRepositoryClassName, $metadata->getPath());
}
}
}
}
Oops, something went wrong.

1 comment on commit dcf209a

@canni

This comment has been minimized.

Show comment
Hide comment
@canni

canni Jan 3, 2012

Contributor

Shouldn't this has to be noted in changelog? :)

Contributor

canni commented on dcf209a Jan 3, 2012

Shouldn't this has to be noted in changelog? :)

Please sign in to comment.