1
0
mirror of synced 2025-01-18 06:21:40 +03:00

Fixed documentation for Doctrine\ORM\Tools\Console

This commit is contained in:
Benjamin Morel 2012-12-14 12:49:05 +00:00
parent e72445b836
commit 71e78014e5
19 changed files with 171 additions and 89 deletions

View File

@ -28,7 +28,6 @@ use Doctrine\Common\Cache\ApcCache;
/**
* Command to clear the metadata cache of the various cache drivers.
*
*
* @link www.doctrine-project.org
* @since 2.0
* @author Benjamin Eberlei <kontakt@beberlei.de>
@ -39,7 +38,7 @@ use Doctrine\Common\Cache\ApcCache;
class MetadataCommand extends Command
{
/**
* @see Console\Command\Command
* {@inheritdoc}
*/
protected function configure()
{
@ -74,7 +73,7 @@ EOT
}
/**
* @see Console\Command\Command
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{

View File

@ -28,7 +28,6 @@ use Doctrine\Common\Cache\ApcCache;
/**
* Command to clear the query cache of the various cache drivers.
*
*
* @link www.doctrine-project.org
* @since 2.0
* @author Benjamin Eberlei <kontakt@beberlei.de>
@ -38,6 +37,9 @@ use Doctrine\Common\Cache\ApcCache;
*/
class QueryCommand extends Command
{
/**
* {@inheritdoc}
*/
protected function configure()
{
$this
@ -70,6 +72,9 @@ EOT
);
}
/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$em = $this->getHelper('em')->getEntityManager();

View File

@ -28,7 +28,6 @@ use Doctrine\Common\Cache\ApcCache;
/**
* Command to clear the result cache of the various cache drivers.
*
*
* @link www.doctrine-project.org
* @since 2.0
* @author Benjamin Eberlei <kontakt@beberlei.de>
@ -39,7 +38,7 @@ use Doctrine\Common\Cache\ApcCache;
class ResultCommand extends Command
{
/**
* @see Console\Command\Command
* {@inheritdoc}
*/
protected function configure()
{
@ -74,7 +73,7 @@ EOT
}
/**
* @see Console\Command\Command
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{

View File

@ -19,12 +19,12 @@
namespace Doctrine\ORM\Tools\Console\Command;
use Symfony\Component\Console\Input\InputArgument,
Symfony\Component\Console\Input\InputOption,
Symfony\Component\Console,
Doctrine\ORM\Tools\Export\ClassMetadataExporter,
Doctrine\ORM\Tools\ConvertDoctrine1Schema,
Doctrine\ORM\Tools\EntityGenerator;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console;
use Doctrine\ORM\Tools\Export\ClassMetadataExporter;
use Doctrine\ORM\Tools\ConvertDoctrine1Schema;
use Doctrine\ORM\Tools\EntityGenerator;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Command\Command;
@ -32,7 +32,6 @@ use Symfony\Component\Console\Command\Command;
/**
* Command to convert a Doctrine 1 schema to a Doctrine 2 mapping file.
*
*
* @link www.doctrine-project.org
* @since 2.0
* @author Benjamin Eberlei <kontakt@beberlei.de>
@ -43,12 +42,12 @@ use Symfony\Component\Console\Command\Command;
class ConvertDoctrine1SchemaCommand extends Command
{
/**
* @var EntityGenerator
* @var EntityGenerator|null
*/
private $entityGenerator = null;
/**
* @var ClassMetadataExporter
* @var ClassMetadataExporter|null
*/
private $metadataExporter = null;
@ -66,6 +65,8 @@ class ConvertDoctrine1SchemaCommand extends Command
/**
* @param EntityGenerator $entityGenerator
*
* @return void
*/
public function setEntityGenerator(EntityGenerator $entityGenerator)
{
@ -86,6 +87,8 @@ class ConvertDoctrine1SchemaCommand extends Command
/**
* @param ClassMetadataExporter $metadataExporter
*
* @return void
*/
public function setMetadataExporter(ClassMetadataExporter $metadataExporter)
{
@ -93,7 +96,7 @@ class ConvertDoctrine1SchemaCommand extends Command
}
/**
* @see Console\Command\Command
* {@inheritdoc}
*/
protected function configure()
{
@ -131,6 +134,9 @@ EOT
);
}
/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
// Process source directories
@ -147,12 +153,14 @@ EOT
}
/**
* @param array $fromPaths
* @param string $destPath
* @param string $toType
* @param int $numSpaces
* @param string|null $extend
* @param array $fromPaths
* @param string $destPath
* @param string $toType
* @param int $numSpaces
* @param string|null $extend
* @param OutputInterface $output
*
* @throws \InvalidArgumentException
*/
public function convertDoctrine1Schema(array $fromPaths, $destPath, $toType, $numSpaces, $extend, OutputInterface $output)
{

View File

@ -19,12 +19,12 @@
namespace Doctrine\ORM\Tools\Console\Command;
use Symfony\Component\Console\Input\InputArgument,
Symfony\Component\Console\Input\InputOption,
Doctrine\ORM\Tools\Console\MetadataFilter,
Doctrine\ORM\Tools\Export\ClassMetadataExporter,
Doctrine\ORM\Tools\EntityGenerator,
Doctrine\ORM\Tools\DisconnectedClassMetadataFactory;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
use Doctrine\ORM\Tools\Console\MetadataFilter;
use Doctrine\ORM\Tools\Export\ClassMetadataExporter;
use Doctrine\ORM\Tools\EntityGenerator;
use Doctrine\ORM\Tools\DisconnectedClassMetadataFactory;
use Doctrine\ORM\Mapping\Driver\DatabaseDriver;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputInterface;
@ -33,7 +33,6 @@ use Symfony\Component\Console\Command\Command;
/**
* Command to convert your mapping information between the various formats.
*
*
* @link www.doctrine-project.org
* @since 2.0
* @author Benjamin Eberlei <kontakt@beberlei.de>
@ -43,6 +42,9 @@ use Symfony\Component\Console\Command\Command;
*/
class ConvertMappingCommand extends Command
{
/**
* {@inheritdoc}
*/
protected function configure()
{
$this
@ -100,6 +102,9 @@ EOT
);
}
/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$em = $this->getHelper('em')->getEntityManager();
@ -174,8 +179,8 @@ EOT
}
/**
* @param $toType
* @param $destPath
* @param string $toType
* @param string $destPath
*
* @return \Doctrine\ORM\Tools\Export\Driver\AbstractExporter
*/

View File

@ -27,7 +27,6 @@ use Symfony\Component\Console\Output\OutputInterface;
/**
* Command to ensure that Doctrine is properly configured for a production environment.
*
*
* @link www.doctrine-project.org
* @since 2.0
* @version $Revision$
@ -38,6 +37,9 @@ use Symfony\Component\Console\Output\OutputInterface;
*/
class EnsureProductionSettingsCommand extends Command
{
/**
* {@inheritdoc}
*/
protected function configure()
{
$this
@ -55,6 +57,9 @@ EOT
);
}
/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$em = $this->getHelper('em')->getEntityManager();

View File

@ -19,11 +19,11 @@
namespace Doctrine\ORM\Tools\Console\Command;
use Symfony\Component\Console\Input\InputArgument,
Symfony\Component\Console\Input\InputOption,
Doctrine\ORM\Tools\Console\MetadataFilter,
Doctrine\ORM\Tools\EntityGenerator,
Doctrine\ORM\Tools\DisconnectedClassMetadataFactory;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
use Doctrine\ORM\Tools\Console\MetadataFilter;
use Doctrine\ORM\Tools\EntityGenerator;
use Doctrine\ORM\Tools\DisconnectedClassMetadataFactory;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Command\Command;
@ -31,7 +31,6 @@ use Symfony\Component\Console\Command\Command;
/**
* Command to generate entity classes and method stubs from your mapping information.
*
*
* @link www.doctrine-project.org
* @since 2.0
* @author Benjamin Eberlei <kontakt@beberlei.de>
@ -42,7 +41,7 @@ use Symfony\Component\Console\Command\Command;
class GenerateEntitiesCommand extends Command
{
/**
* @see Console\Command\Command
* {@inheritdoc}
*/
protected function configure()
{
@ -106,7 +105,7 @@ EOT
}
/**
* @see Console\Command\Command
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{

View File

@ -19,9 +19,9 @@
namespace Doctrine\ORM\Tools\Console\Command;
use Symfony\Component\Console\Input\InputArgument,
Symfony\Component\Console\Input\InputOption,
Doctrine\ORM\Tools\Console\MetadataFilter;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
use Doctrine\ORM\Tools\Console\MetadataFilter;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Command\Command;
@ -29,7 +29,6 @@ use Symfony\Component\Console\Command\Command;
/**
* Command to (re)generate the proxy classes used by doctrine.
*
*
* @link www.doctrine-project.org
* @since 2.0
* @author Benjamin Eberlei <kontakt@beberlei.de>
@ -39,6 +38,9 @@ use Symfony\Component\Console\Command\Command;
*/
class GenerateProxiesCommand extends Command
{
/**
* {@inheritdoc}
*/
protected function configure()
{
$this
@ -60,6 +62,9 @@ EOT
);
}
/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$em = $this->getHelper('em')->getEntityManager();
@ -105,6 +110,5 @@ EOT
} else {
$output->writeln('No Metadata Classes to process.');
}
}
}

View File

@ -19,10 +19,10 @@
namespace Doctrine\ORM\Tools\Console\Command;
use Symfony\Component\Console\Input\InputArgument,
Symfony\Component\Console\Input\InputOption,
Doctrine\ORM\Tools\Console\MetadataFilter,
Doctrine\ORM\Tools\EntityRepositoryGenerator;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
use Doctrine\ORM\Tools\Console\MetadataFilter;
use Doctrine\ORM\Tools\EntityRepositoryGenerator;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Command\Command;
@ -30,7 +30,6 @@ use Symfony\Component\Console\Command\Command;
/**
* Command to generate repository classes for mapping information.
*
*
* @link www.doctrine-project.org
* @since 2.0
* @author Benjamin Eberlei <kontakt@beberlei.de>
@ -40,6 +39,9 @@ use Symfony\Component\Console\Command\Command;
*/
class GenerateRepositoriesCommand extends Command
{
/**
* {@inheritdoc}
*/
protected function configure()
{
$this
@ -60,6 +62,9 @@ EOT
);
}
/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$em = $this->getHelper('em')->getEntityManager();

View File

@ -25,8 +25,7 @@ use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Command\Command;
/**
* Show information about mapped entities
*
* Show information about mapped entities.
*
* @link www.doctrine-project.org
* @since 2.1
@ -34,6 +33,9 @@ use Symfony\Component\Console\Command\Command;
*/
class InfoCommand extends Command
{
/**
* {@inheritdoc}
*/
protected function configure()
{
$this
@ -47,6 +49,9 @@ EOT
);
}
/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
/* @var $entityManager \Doctrine\ORM\EntityManager */

View File

@ -29,7 +29,6 @@ use Doctrine\Common\Util\Debug;
/**
* Command to execute DQL queries in a given EntityManager.
*
*
* @link www.doctrine-project.org
* @since 2.0
* @author Benjamin Eberlei <kontakt@beberlei.de>
@ -39,6 +38,9 @@ use Doctrine\Common\Util\Debug;
*/
class RunDqlCommand extends Command
{
/**
* {@inheritdoc}
*/
protected function configure()
{
$this
@ -70,6 +72,9 @@ EOT
);
}
/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$em = $this->getHelper('em')->getEntityManager();

View File

@ -19,11 +19,21 @@
namespace Doctrine\ORM\Tools\Console\Command\SchemaTool;
use Symfony\Component\Console\Input\InputInterface,
Symfony\Component\Console\Output\OutputInterface,
Symfony\Component\Console\Command\Command,
Doctrine\ORM\Tools\SchemaTool;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Command\Command;
use Doctrine\ORM\Tools\SchemaTool;
/**
* Base class for CreateCommand, DropCommand and UpdateCommand.
*
* @link www.doctrine-project.org
* @since 2.0
* @author Benjamin Eberlei <kontakt@beberlei.de>
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
*/
abstract class AbstractCommand extends Command
{
/**
@ -31,11 +41,13 @@ abstract class AbstractCommand extends Command
* @param OutputInterface $output
* @param SchemaTool $schemaTool
* @param array $metadatas
*
* @return null|int Null or 0 if everything went fine, or an error code.
*/
abstract protected function executeSchemaCommand(InputInterface $input, OutputInterface $output, SchemaTool $schemaTool, array $metadatas);
/**
* @see Console\Command\Command
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{

View File

@ -19,16 +19,15 @@
namespace Doctrine\ORM\Tools\Console\Command\SchemaTool;
use Symfony\Component\Console\Input\InputArgument,
Symfony\Component\Console\Input\InputOption,
Symfony\Component\Console\Input\InputInterface,
Symfony\Component\Console\Output\OutputInterface,
Doctrine\ORM\Tools\SchemaTool;
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\SchemaTool;
/**
* Command to create the database schema for a set of classes based on their mappings.
*
*
* @link www.doctrine-project.org
* @since 2.0
* @author Benjamin Eberlei <kontakt@beberlei.de>
@ -39,7 +38,7 @@ use Symfony\Component\Console\Input\InputArgument,
class CreateCommand extends AbstractCommand
{
/**
* @see Console\Command\Command
* {@inheritdoc}
*/
protected function configure()
{
@ -60,6 +59,9 @@ EOT
);
}
/**
* {@inheritdoc}
*/
protected function executeSchemaCommand(InputInterface $input, OutputInterface $output, SchemaTool $schemaTool, array $metadatas)
{
if ($input->getOption('dump-sql')) {

View File

@ -19,16 +19,15 @@
namespace Doctrine\ORM\Tools\Console\Command\SchemaTool;
use Symfony\Component\Console\Input\InputArgument,
Symfony\Component\Console\Input\InputOption,
Symfony\Component\Console\Input\InputInterface,
Symfony\Component\Console\Output\OutputInterface,
Doctrine\ORM\Tools\SchemaTool;
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\SchemaTool;
/**
* Command to drop the database schema for a set of classes based on their mappings.
*
*
* @link www.doctrine-project.org
* @since 2.0
* @author Benjamin Eberlei <kontakt@beberlei.de>
@ -39,7 +38,7 @@ use Symfony\Component\Console\Input\InputArgument,
class DropCommand extends AbstractCommand
{
/**
* @see Console\Command\Command
* {@inheritdoc}
*/
protected function configure()
{
@ -69,6 +68,9 @@ EOT
);
}
/**
* {@inheritdoc}
*/
protected function executeSchemaCommand(InputInterface $input, OutputInterface $output, SchemaTool $schemaTool, array $metadatas)
{
$isFullDatabaseDrop = $input->getOption('full-database');

View File

@ -19,17 +19,16 @@
namespace Doctrine\ORM\Tools\Console\Command\SchemaTool;
use Symfony\Component\Console\Input\InputArgument,
Symfony\Component\Console\Input\InputOption,
Symfony\Component\Console\Input\InputInterface,
Symfony\Component\Console\Output\OutputInterface,
Doctrine\ORM\Tools\SchemaTool;
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\SchemaTool;
/**
* Command to generate the SQL needed to update the database schema to match
* the current mapping information.
*
*
* @link www.doctrine-project.org
* @since 2.0
* @author Benjamin Eberlei <kontakt@beberlei.de>
@ -40,10 +39,13 @@ use Symfony\Component\Console\Input\InputArgument,
*/
class UpdateCommand extends AbstractCommand
{
/**
* @var string
*/
protected $name = 'orm:schema-tool:update';
/**
* @see Console\Command\Command
* {@inheritdoc}
*/
protected function configure()
{
@ -95,6 +97,9 @@ EOT
);
}
/**
* {@inheritdoc}
*/
protected function executeSchemaCommand(InputInterface $input, OutputInterface $output, SchemaTool $schemaTool, array $metadatas)
{
// Defining if update is complete or not (--complete not defined means $saveMode = true)

View File

@ -25,7 +25,7 @@ use Symfony\Component\Console\Output\OutputInterface;
use Doctrine\ORM\Tools\SchemaValidator;
/**
* Validate that the current mapping is valid
* Command to validate that the current mapping is valid.
*
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.doctrine-project.com
@ -37,6 +37,9 @@ use Doctrine\ORM\Tools\SchemaValidator;
*/
class ValidateSchemaCommand extends Command
{
/**
* {@inheritdoc}
*/
protected function configure()
{
$this
@ -48,6 +51,9 @@ EOT
);
}
/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$em = $this->getHelper('em')->getEntityManager();

View File

@ -26,10 +26,11 @@ use Doctrine\ORM\Version;
class ConsoleRunner
{
/**
* Run console with the given helperset.
* Runs console with the given helperset.
*
* @param \Symfony\Component\Console\Helper\HelperSet $helperSet
* @param \Symfony\Component\Console\Helper\HelperSet $helperSet
* @param \Symfony\Component\Console\Command\Command[] $commands
*
* @return void
*/
static public function run(HelperSet $helperSet, $commands = array())
@ -44,6 +45,8 @@ class ConsoleRunner
/**
* @param Application $cli
*
* @return void
*/
static public function addCommands(Application $cli)
{

View File

@ -19,13 +19,12 @@
namespace Doctrine\ORM\Tools\Console\Helper;
use Symfony\Component\Console\Helper\Helper,
Doctrine\ORM\EntityManager;
use Symfony\Component\Console\Helper\Helper;
use Doctrine\ORM\EntityManager;
/**
* Doctrine CLI Connection Helper.
*
*
* @link www.doctrine-project.org
* @since 2.0
* @author Benjamin Eberlei <kontakt@beberlei.de>
@ -36,13 +35,14 @@ use Symfony\Component\Console\Helper\Helper,
class EntityManagerHelper extends Helper
{
/**
* Doctrine ORM EntityManager
* Doctrine ORM EntityManager.
*
* @var EntityManager
*/
protected $_em;
/**
* Constructor
* Constructor.
*
* @param \Doctrine\ORM\EntityManager $em
*/
@ -52,7 +52,7 @@ class EntityManagerHelper extends Helper
}
/**
* Retrieves Doctrine ORM EntityManager
* Retrieves Doctrine ORM EntityManager.
*
* @return EntityManager
*/
@ -62,7 +62,7 @@ class EntityManagerHelper extends Helper
}
/**
* @see Helper
* {@inheritdoc}
*/
public function getName()
{

View File

@ -32,6 +32,9 @@ namespace Doctrine\ORM\Tools\Console;
*/
class MetadataFilter extends \FilterIterator implements \Countable
{
/**
* @var array
*/
private $filter = array();
/**
@ -49,6 +52,10 @@ class MetadataFilter extends \FilterIterator implements \Countable
return iterator_to_array($metadatas);
}
/**
* @param \ArrayIterator $metadata
* @param array|string $filter
*/
public function __construct(\ArrayIterator $metadata, $filter)
{
$this->filter = (array) $filter;
@ -56,6 +63,9 @@ class MetadataFilter extends \FilterIterator implements \Countable
parent::__construct($metadata);
}
/**
* @return bool
*/
public function accept()
{
if (count($this->filter) == 0) {
@ -74,6 +84,9 @@ class MetadataFilter extends \FilterIterator implements \Countable
return false;
}
/**
* @return int
*/
public function count()
{
return count($this->getInnerIterator());