welcome back to dyb-tech
This commit is contained in:
+31
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineBundle\Command\Proxy;
|
||||
|
||||
use Doctrine\ORM\Tools\Console\Command\ClearCache\MetadataCommand;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
||||
/**
|
||||
* Command to clear the metadata cache of the various cache drivers.
|
||||
*
|
||||
* @deprecated use Doctrine\ORM\Tools\Console\Command\ClearCache\MetadataCommand instead
|
||||
*/
|
||||
class ClearMetadataCacheDoctrineCommand extends MetadataCommand
|
||||
{
|
||||
use OrmProxyCommand;
|
||||
|
||||
protected function configure(): void
|
||||
{
|
||||
parent::configure();
|
||||
|
||||
$this
|
||||
->setName('doctrine:cache:clear-metadata')
|
||||
->setDescription('Clears all metadata cache for an entity manager');
|
||||
|
||||
if ($this->getDefinition()->hasOption('em')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->addOption('em', null, InputOption::VALUE_OPTIONAL, 'The entity manager to use for this command');
|
||||
}
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineBundle\Command\Proxy;
|
||||
|
||||
use Doctrine\ORM\Tools\Console\Command\ClearCache\QueryCommand;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
||||
/**
|
||||
* Command to clear the query cache of the various cache drivers.
|
||||
*
|
||||
* @deprecated use Doctrine\ORM\Tools\Console\Command\ClearCache\QueryCommand instead
|
||||
*/
|
||||
class ClearQueryCacheDoctrineCommand extends QueryCommand
|
||||
{
|
||||
use OrmProxyCommand;
|
||||
|
||||
protected function configure(): void
|
||||
{
|
||||
parent::configure();
|
||||
|
||||
$this
|
||||
->setName('doctrine:cache:clear-query')
|
||||
->setDescription('Clears all query cache for an entity manager');
|
||||
|
||||
if ($this->getDefinition()->hasOption('em')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->addOption('em', null, InputOption::VALUE_OPTIONAL, 'The entity manager to use for this command');
|
||||
}
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineBundle\Command\Proxy;
|
||||
|
||||
use Doctrine\ORM\Tools\Console\Command\ClearCache\ResultCommand;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
||||
/**
|
||||
* Command to clear the result cache of the various cache drivers.
|
||||
*
|
||||
* @deprecated use Doctrine\ORM\Tools\Console\Command\ClearCache\ResultCommand instead
|
||||
*/
|
||||
class ClearResultCacheDoctrineCommand extends ResultCommand
|
||||
{
|
||||
use OrmProxyCommand;
|
||||
|
||||
protected function configure(): void
|
||||
{
|
||||
parent::configure();
|
||||
|
||||
$this
|
||||
->setName('doctrine:cache:clear-result')
|
||||
->setDescription('Clears result cache for an entity manager');
|
||||
|
||||
if ($this->getDefinition()->hasOption('em')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->addOption('em', null, InputOption::VALUE_OPTIONAL, 'The entity manager to use for this command');
|
||||
}
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineBundle\Command\Proxy;
|
||||
|
||||
use Doctrine\ORM\Tools\Console\Command\ClearCache\CollectionRegionCommand;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
||||
/**
|
||||
* Command to clear a collection cache region.
|
||||
*
|
||||
* @deprecated use Doctrine\ORM\Tools\Console\Command\ClearCache\CollectionRegionCommand instead
|
||||
*/
|
||||
class CollectionRegionDoctrineCommand extends CollectionRegionCommand
|
||||
{
|
||||
use OrmProxyCommand;
|
||||
|
||||
protected function configure(): void
|
||||
{
|
||||
parent::configure();
|
||||
|
||||
$this
|
||||
->setName('doctrine:cache:clear-collection-region');
|
||||
|
||||
if ($this->getDefinition()->hasOption('em')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->addOption('em', null, InputOption::VALUE_OPTIONAL, 'The entity manager to use for this command');
|
||||
}
|
||||
}
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineBundle\Command\Proxy;
|
||||
|
||||
use Doctrine\ORM\Tools\Console\Command\ConvertMappingCommand;
|
||||
use Doctrine\ORM\Tools\Export\Driver\AbstractExporter;
|
||||
use Doctrine\ORM\Tools\Export\Driver\XmlExporter;
|
||||
use Doctrine\ORM\Tools\Export\Driver\YamlExporter;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
||||
use function assert;
|
||||
|
||||
/**
|
||||
* Convert Doctrine ORM metadata mapping information between the various supported
|
||||
* formats.
|
||||
*
|
||||
* @deprecated use Doctrine\ORM\Tools\Console\Command\ConvertMappingCommand instead
|
||||
*/
|
||||
class ConvertMappingDoctrineCommand extends ConvertMappingCommand
|
||||
{
|
||||
use OrmProxyCommand;
|
||||
|
||||
/** @return void */
|
||||
protected function configure()
|
||||
{
|
||||
parent::configure();
|
||||
|
||||
$this
|
||||
->setName('doctrine:mapping:convert');
|
||||
|
||||
if ($this->getDefinition()->hasOption('em')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->addOption('em', null, InputOption::VALUE_OPTIONAL, 'The entity manager to use for this command');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $toType
|
||||
* @param string $destPath
|
||||
*
|
||||
* @return AbstractExporter
|
||||
*/
|
||||
protected function getExporter($toType, $destPath)
|
||||
{
|
||||
$exporter = parent::getExporter($toType, $destPath);
|
||||
assert($exporter instanceof AbstractExporter);
|
||||
if ($exporter instanceof XmlExporter) {
|
||||
$exporter->setExtension('.orm.xml');
|
||||
} elseif ($exporter instanceof YamlExporter) {
|
||||
$exporter->setExtension('.orm.yml');
|
||||
}
|
||||
|
||||
return $exporter;
|
||||
}
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineBundle\Command\Proxy;
|
||||
|
||||
use Doctrine\ORM\Tools\Console\Command\SchemaTool\CreateCommand;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
||||
/**
|
||||
* Command to execute the SQL needed to generate the database schema for
|
||||
* a given entity manager.
|
||||
*
|
||||
* @deprecated use Doctrine\ORM\Tools\Console\Command\SchemaTool\CreateCommand instead
|
||||
*/
|
||||
class CreateSchemaDoctrineCommand extends CreateCommand
|
||||
{
|
||||
use OrmProxyCommand;
|
||||
|
||||
protected function configure(): void
|
||||
{
|
||||
parent::configure();
|
||||
|
||||
$this
|
||||
->setName('doctrine:schema:create')
|
||||
->setDescription('Executes (or dumps) the SQL needed to generate the database schema');
|
||||
|
||||
if ($this->getDefinition()->hasOption('em')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->addOption('em', null, InputOption::VALUE_OPTIONAL, 'The entity manager to use for this command');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineBundle\Command\Proxy;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\Tools\Console\EntityManagerProvider;
|
||||
use Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper;
|
||||
use Symfony\Bundle\FrameworkBundle\Console\Application;
|
||||
|
||||
use function assert;
|
||||
use function trigger_deprecation;
|
||||
|
||||
/**
|
||||
* Provides some helper and convenience methods to configure doctrine commands in the context of bundles
|
||||
* and multiple connections/entity managers.
|
||||
*
|
||||
* @deprecated since DoctrineBundle 2.7 and will be removed in 3.0
|
||||
*/
|
||||
abstract class DoctrineCommandHelper
|
||||
{
|
||||
/**
|
||||
* Convenience method to push the helper sets of a given entity manager into the application.
|
||||
*
|
||||
* @param string $emName
|
||||
*/
|
||||
public static function setApplicationEntityManager(Application $application, $emName)
|
||||
{
|
||||
$em = $application->getKernel()->getContainer()->get('doctrine')->getManager($emName);
|
||||
assert($em instanceof EntityManagerInterface);
|
||||
$helperSet = $application->getHelperSet();
|
||||
$helperSet->set(new EntityManagerHelper($em), 'em');
|
||||
|
||||
trigger_deprecation(
|
||||
'doctrine/doctrine-bundle',
|
||||
'2.7',
|
||||
'Providing an EntityManager using "%s" is deprecated. Use an instance of "%s" instead.',
|
||||
EntityManagerHelper::class,
|
||||
EntityManagerProvider::class,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineBundle\Command\Proxy;
|
||||
|
||||
use Doctrine\ORM\Tools\Console\Command\SchemaTool\DropCommand;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
||||
/**
|
||||
* Command to drop the database schema for a set of classes based on their mappings.
|
||||
*
|
||||
* @deprecated use Doctrine\ORM\Tools\Console\Command\SchemaTool\DropCommand instead
|
||||
*/
|
||||
class DropSchemaDoctrineCommand extends DropCommand
|
||||
{
|
||||
use OrmProxyCommand;
|
||||
|
||||
protected function configure(): void
|
||||
{
|
||||
parent::configure();
|
||||
|
||||
$this
|
||||
->setName('doctrine:schema:drop')
|
||||
->setDescription('Executes (or dumps) the SQL needed to drop the current database schema');
|
||||
|
||||
if ($this->getDefinition()->hasOption('em')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->addOption('em', null, InputOption::VALUE_OPTIONAL, 'The entity manager to use for this command');
|
||||
}
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineBundle\Command\Proxy;
|
||||
|
||||
use Doctrine\ORM\Tools\Console\Command\EnsureProductionSettingsCommand;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
||||
/**
|
||||
* Ensure the Doctrine ORM is configured properly for a production environment.
|
||||
*
|
||||
* @deprecated use Doctrine\ORM\Tools\Console\Command\EnsureProductionSettingsCommand instead
|
||||
*/
|
||||
class EnsureProductionSettingsDoctrineCommand extends EnsureProductionSettingsCommand
|
||||
{
|
||||
use OrmProxyCommand;
|
||||
|
||||
protected function configure(): void
|
||||
{
|
||||
parent::configure();
|
||||
|
||||
$this
|
||||
->setName('doctrine:ensure-production-settings');
|
||||
|
||||
if ($this->getDefinition()->hasOption('em')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->addOption('em', null, InputOption::VALUE_OPTIONAL, 'The entity manager to use for this command');
|
||||
}
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineBundle\Command\Proxy;
|
||||
|
||||
use Doctrine\ORM\Tools\Console\Command\ClearCache\EntityRegionCommand;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
||||
/**
|
||||
* Command to clear a entity cache region.
|
||||
*
|
||||
* @deprecated use Doctrine\ORM\Tools\Console\Command\ClearCache\EntityRegionCommand instead
|
||||
*/
|
||||
class EntityRegionCacheDoctrineCommand extends EntityRegionCommand
|
||||
{
|
||||
use OrmProxyCommand;
|
||||
|
||||
protected function configure(): void
|
||||
{
|
||||
parent::configure();
|
||||
|
||||
$this
|
||||
->setName('doctrine:cache:clear-entity-region');
|
||||
|
||||
if ($this->getDefinition()->hasOption('em')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->addOption('em', null, InputOption::VALUE_OPTIONAL, 'The entity manager to use for this command');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineBundle\Command\Proxy;
|
||||
|
||||
use Doctrine\ORM\Tools\Console\Command\InfoCommand;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
||||
/**
|
||||
* Show information about mapped entities
|
||||
*
|
||||
* @deprecated use Doctrine\ORM\Tools\Console\Command\InfoCommand instead
|
||||
*/
|
||||
class InfoDoctrineCommand extends InfoCommand
|
||||
{
|
||||
use OrmProxyCommand;
|
||||
|
||||
protected function configure(): void
|
||||
{
|
||||
$this
|
||||
->setName('doctrine:mapping:info');
|
||||
|
||||
if ($this->getDefinition()->hasOption('em')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->addOption('em', null, InputOption::VALUE_OPTIONAL, 'The entity manager to use for this command');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineBundle\Command\Proxy;
|
||||
|
||||
use Doctrine\ORM\Tools\Console\EntityManagerProvider;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
use function trigger_deprecation;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @deprecated
|
||||
*/
|
||||
trait OrmProxyCommand
|
||||
{
|
||||
private ?EntityManagerProvider $entityManagerProvider;
|
||||
|
||||
public function __construct(?EntityManagerProvider $entityManagerProvider = null)
|
||||
{
|
||||
parent::__construct($entityManagerProvider);
|
||||
|
||||
$this->entityManagerProvider = $entityManagerProvider;
|
||||
|
||||
trigger_deprecation(
|
||||
'doctrine/doctrine-bundle',
|
||||
'2.8',
|
||||
'Class "%s" is deprecated. Use "%s" instead.',
|
||||
self::class,
|
||||
parent::class,
|
||||
);
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
if (! $this->entityManagerProvider) {
|
||||
DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));
|
||||
}
|
||||
|
||||
return parent::execute($input, $output);
|
||||
}
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineBundle\Command\Proxy;
|
||||
|
||||
use Doctrine\ORM\Tools\Console\Command\ClearCache\QueryRegionCommand;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
||||
/**
|
||||
* Command to clear a query cache region.
|
||||
*
|
||||
* @deprecated use Doctrine\ORM\Tools\Console\Command\ClearCache\QueryRegionCommand instead
|
||||
*/
|
||||
class QueryRegionCacheDoctrineCommand extends QueryRegionCommand
|
||||
{
|
||||
use OrmProxyCommand;
|
||||
|
||||
protected function configure(): void
|
||||
{
|
||||
parent::configure();
|
||||
|
||||
$this
|
||||
->setName('doctrine:cache:clear-query-region');
|
||||
|
||||
if ($this->getDefinition()->hasOption('em')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->addOption('em', null, InputOption::VALUE_OPTIONAL, 'The entity manager to use for this command');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineBundle\Command\Proxy;
|
||||
|
||||
use Doctrine\ORM\Tools\Console\Command\RunDqlCommand;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
||||
/**
|
||||
* Execute a Doctrine DQL query and output the results.
|
||||
*
|
||||
* @deprecated use Doctrine\ORM\Tools\Console\Command\RunDqlCommand instead
|
||||
*/
|
||||
class RunDqlDoctrineCommand extends RunDqlCommand
|
||||
{
|
||||
use OrmProxyCommand;
|
||||
|
||||
protected function configure(): void
|
||||
{
|
||||
parent::configure();
|
||||
|
||||
$this
|
||||
->setName('doctrine:query:dql')
|
||||
->setHelp(<<<'EOT'
|
||||
The <info>%command.name%</info> command executes the given DQL query and
|
||||
outputs the results:
|
||||
|
||||
<info>php %command.full_name% "SELECT u FROM UserBundle:User u"</info>
|
||||
|
||||
You can also optional specify some additional options like what type of
|
||||
hydration to use when executing the query:
|
||||
|
||||
<info>php %command.full_name% "SELECT u FROM UserBundle:User u" --hydrate=array</info>
|
||||
|
||||
Additionally you can specify the first result and maximum amount of results to
|
||||
show:
|
||||
|
||||
<info>php %command.full_name% "SELECT u FROM UserBundle:User u" --first-result=0 --max-result=30</info>
|
||||
EOT);
|
||||
|
||||
if ($this->getDefinition()->hasOption('em')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->addOption('em', null, InputOption::VALUE_OPTIONAL, 'The entity manager to use for this command');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineBundle\Command\Proxy;
|
||||
|
||||
use Doctrine\DBAL\Tools\Console\Command\RunSqlCommand;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
use function trigger_deprecation;
|
||||
|
||||
/**
|
||||
* Execute a SQL query and output the results.
|
||||
*
|
||||
* @deprecated use Doctrine\DBAL\Tools\Console\Command\RunSqlCommand instead
|
||||
*/
|
||||
class RunSqlDoctrineCommand extends RunSqlCommand
|
||||
{
|
||||
protected function configure(): void
|
||||
{
|
||||
parent::configure();
|
||||
|
||||
$this
|
||||
->setName('doctrine:query:sql')
|
||||
->setHelp(<<<'EOT'
|
||||
The <info>%command.name%</info> command executes the given SQL query and
|
||||
outputs the results:
|
||||
|
||||
<info>php %command.full_name% "SELECT * FROM users"</info>
|
||||
EOT);
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
trigger_deprecation(
|
||||
'doctrine/doctrine-bundle',
|
||||
'2.2',
|
||||
'The "%s" (doctrine:query:sql) is deprecated, use dbal:run-sql command instead.',
|
||||
self::class,
|
||||
);
|
||||
|
||||
return parent::execute($input, $output);
|
||||
}
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineBundle\Command\Proxy;
|
||||
|
||||
use Doctrine\ORM\Tools\Console\Command\SchemaTool\UpdateCommand;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
||||
/**
|
||||
* Command to generate the SQL needed to update the database schema to match
|
||||
* the current mapping information.
|
||||
*
|
||||
* @deprecated use Doctrine\ORM\Tools\Console\Command\SchemaTool\UpdateCommand instead
|
||||
*/
|
||||
class UpdateSchemaDoctrineCommand extends UpdateCommand
|
||||
{
|
||||
use OrmProxyCommand;
|
||||
|
||||
protected function configure(): void
|
||||
{
|
||||
parent::configure();
|
||||
|
||||
$this
|
||||
->setName('doctrine:schema:update');
|
||||
|
||||
if ($this->getDefinition()->hasOption('em')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->addOption('em', null, InputOption::VALUE_OPTIONAL, 'The entity manager to use for this command');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineBundle\Command\Proxy;
|
||||
|
||||
use Doctrine\ORM\Tools\Console\Command\ValidateSchemaCommand as DoctrineValidateSchemaCommand;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
||||
/**
|
||||
* Command to run Doctrine ValidateSchema() on the current mappings.
|
||||
*
|
||||
* @deprecated use Doctrine\ORM\Tools\Console\Command\ValidateSchemaCommand instead
|
||||
*/
|
||||
class ValidateSchemaCommand extends DoctrineValidateSchemaCommand
|
||||
{
|
||||
use OrmProxyCommand;
|
||||
|
||||
protected function configure(): void
|
||||
{
|
||||
parent::configure();
|
||||
|
||||
$this
|
||||
->setName('doctrine:schema:validate');
|
||||
|
||||
if ($this->getDefinition()->hasOption('em')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->addOption('em', null, InputOption::VALUE_OPTIONAL, 'The entity manager to use for this command');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user