【问题标题】:php app / console stops workingphp应用程序/控制台停止工作
【发布时间】:2015-11-10 10:21:35
【问题描述】:

在对我的单位稍作修改后,我想用一个简单的php app/console doctrine: update --force 进行更新。但是没有执行任何操作,此外没有响应。然后我做了一个php app/check.php,这意味着我没有问题(Your system is ready to run Symfony2 projects)。我不明白,它没有提供错误。这是我所做的:

Command: ********: ***** ProjetSymphony $ php app / console***
Answer (none): ******* **** $ ProjetSymphony***

如果有人有想法。

屏幕:

【问题讨论】:

  • 请在运行该命令时发布终端截图
  • 她向我推荐了任何东西......

标签: php symfony web terminal mamp


【解决方案1】:

另外,如果有人试图在较新的 symfony 版本(例如 symfony 3.0)中运行 php app/console,你会得到一个错误:找不到文件,因为文件被移动到了 'bin' 文件夹。现在要从控制台运行,您必须改用php bin/console。以防这个变化让任何开始学习 symfony 并更新到 3.0 的人感到困惑。

【讨论】:

    【解决方案2】:

    我终于发现了我的错误。我有一个命令文件阻止执行我的订单 (CreateUserCommand.php) 如果有人想向我解释为什么这个 cosait 在我的订单执行过程中会报错... 这是文件:

    <?php
    
    namespace FP\UserBundle\Command;
    
    use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
    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 FOS\UserBundle\Model\User;
    use FOS\UserBundle\Command\CreateUserCommand as BaseCommand;
    
    class CreateUserCommand extends BaseCommand
    {
        /**
         * @see Command
         */
        protected function configure()
        {
            exit;
            echo "tes";
            parent::configure();
            $this
                ->setName('fp:user:create')
                ->getDefinition()->addArguments(array(
                    new InputArgument('age', InputArgument::REQUIRED, 'The age')
                ))
            ;
        }
    
        /**
         * @see Command
         */
        protected function execute(InputInterface $input, OutputInterface $output)
        {
            exit;
            echo "tes";
            $username   = $input->getArgument('username');
            $email      = $input->getArgument('email');
            $password   = $input->getArgument('password');
            $age        = $input->getArgument('age');
            $inactive   = $input->getOption('inactive');
            $superadmin = $input->getOption('super-admin');
    
            $manipulator = $this->getContainer()->get('fos_user.util.user_manipulator');
            $manipulator->setAge($age);
            $manipulator->create($username, $password, $email, !$inactive, $superadmin);
    
            $output->writeln(sprintf('Created user <comment>%s</comment>', $username));
        }
    
        /**
         * @see Command
         */
        protected function interact(InputInterface $input, OutputInterface $output)
        {
            exit;
            echo "tes";
            parent::interact($input, $output);
            if (!$input->getArgument('age')) {
                $age = $this->getHelper('dialog')->askAndValidate(
                    $output,
                    'Please choose a age:',
                    function($age) {
                        if (empty($age)) {
                            throw new \Exception('Lastname can not be empty');
                        }
    
                        return $age;
                    }
                );
                $input->setArgument('age', $age);
            }
        }
    }
    

    【讨论】:

      【解决方案3】:

      尝试:

      php app/console doctrine:schema:update --force

      也许只是语法错误。

      【讨论】:

      • 您的控制台正在运行到您的 symfony 应用程序路径中?
      • 假设您的 symfony 项目位于:"C:\user\user1\symofony\project" 您需要在相同的路径中启动控制台。
      • 我使用为我的订单制作的 mac 终端应用程序。但是不是来自终端 pyisque 命令的错误总是适用于其他项目...
      • 你的 AppKernel.php 中有 new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(), 吗?
      • 是的,我的 AppKernel.php 中有一个学说包
      猜你喜欢
      • 2013-12-13
      • 1970-01-01
      • 1970-01-01
      • 2015-11-26
      • 2018-09-29
      • 2015-05-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多