问题是由于实体类中的一个重大拼写错误。我通过使用 Symfony 的附加组件检查架构结构找到了它:
<?php
namespace Lp\LibBundle\Command;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Bundle\DoctrineBundle\Command\Proxy\DoctrineCommandHelper;
use Doctrine\ORM\Tools\Console\Command\ValidateSchemaCommand;
class MyValidateSchemaCommand extends ValidateSchemaCommand
{
/**
* (non-PHPdoc)
* @see Tools/Console/Command/Doctrine\ORM\Tools\Console\Command.ValidateSchemaCommand::configure()
*
* Modifies name of the command to be in Doctrine namespace
* Adds the Helper em for the entity manager which is not defined in Doctrine class
* @author ulrich, 09/09/11
*/
protected function configure()
{
parent::configure();
$this->setName('doctrine:orm:validate-schema');
$this->addOption('em', null, InputOption::VALUE_OPTIONAL, 'The entity manager to use for this command');
}
/**
* (non-PHPdoc)
* @see Tools/Console/Command/Doctrine\ORM\Tools\Console\Command.ValidateSchemaCommand::execute()
*
* Ajoute le Helper em pour l'entity manager qui n'est pas définis dans la class Doctrine
* @author ulrich, 09/09/11
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));
return parent::execute($input, $output);
}
资料来源:乌尔里希
这允许使用此命令指令来检测实体拼写错误。
> php app/console doctrine:orm:validate-schema