커스텀 커맨드를 빌드하려고합니다. Doctrine이 DB에서 일부 레코드를 받아 SwiftMailer가 이메일을 보내야합니다. 심포니 2.6.1을 사용하십시오. I했습니다 코드 :symfony2.6 doctrine과 swift를 사용한 커스텀 커스텀
namespace MyBundle\Console\Command;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class Raport extends ContainerAwareCommand
{
protected function configure()
{
$this
->setName('raport:count-day')
->setDescription('test');
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$em = $this->getContainer()->get('doctrine')->getManager();
$em->getRepository('My:Application')->findAll();
// $output->writeln($text);
}
}
내가 콘솔 raport에서 명령을 실행 카운트 날은 항상 같은 오류 사람이 그것을 해결하는 방법을 알고
PHP Fatal error: Call to undefined method Symfony\Component\Console\Application::getKernel() in /var/www/auto/pzu-voucher/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Command/ContainerAwareCommand.php on line 42 ($this->container = $application->getKernel()->getContainer();)
을받을 수?
이 명령을 어떻게 실행하고 있습니까? – Augwa