我试图用Symfony 1.4和Doctrine 1.2调用MySQL存储过程时遇到问题.我想做的是以下内容:
在键入表单中的所有数据后的模块/ new中,我想在另一个表中插入其中一个值.
我不知道在不使用存储过程的情况下是否可以使用Doctrine.
谢谢你的帮助.
我目前正在努力从nativquerySymfony 2.4.3中获取结果.简单来说,我正在构建一个JobQueue/MsgQueue系统,它只会添加/删除队列中的作业.过程将获取第一个作业,将其设置为活动状态,并且应该返回整个结果.确实存在问题 - 我无法取任何东西.
我以此为例:如何使用Doctrine2和MySQL执行存储过程
这是我在以下代码中使用的代码ConsoleCommand Class:
protected function execute(InputInterface $input, OutputInterface $output)
{
## start
$output->writeln('<comment>Starting JobQueue Ping process</comment>');
// set doctrine
$em = $this->getContainer()->get('doctrine')->getManager();
$rsm = new ResultSetMapping;
$result = $em->createNativeQuery(
'CALL JobQueueGetJob (' .
':jobTypeCode' .
')', $rsm
);
$result->setParameters(array('jobTypeCode' => 1));
$result->execute();
$em->flush();
if ($input->getOption('verbose')) {
$output->writeln(var_dump($result->getResult()));
}
}
Run Code Online (Sandbox Code Playgroud)
在这里,您将使用过程代码和结果:
代码
PROCEDURE `JobQueueGetJob`(IN `jobType` TINYINT(2))
BEGIN
DECLARE jId int(11);
SELECT `msgId` into jId FROM `jobqueue` WHERE `MsgTypeCode` = jobType AND `jState` …Run Code Online (Sandbox Code Playgroud)