【发布时间】:2019-08-12 10:10:43
【问题描述】:
我正在尝试创建一个 Symfony 命令,它在其中运行查询并最终将其作为 cronjob 运行。有人对这个有经验么?到目前为止,这是我的代码。我想知道我应该在哪里创建我的查询。
namespace KCM\GivingBundle\Command;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
class GivingTranReport extends ContainerAwareCommand
{
protected function configure()
{
$this
->setName('giving:report')
->setDescriptio('Runs query for giving transactions on hold')
;
}
protected function execute(InputInterface $input, OutputInterface $output)
{
}
【问题讨论】:
-
SO上有大量的DQL示例,你搜索了吗?您的自定义查询应该进入您的实体存储库。至于cron作业,是linux相关的。
-
对不起,我是教义和symfony的新手。
-
不用担心,看得出。无论如何,DQL 示例到处都是,搜索一些主题......很难给你一个正确的答案,因为你没有具体说明你想要做什么。所以我们无法真正为您提供 DQL 示例
标签: php mysql symfony doctrine-orm command