This topic contains 2 replies, has 2 voices, and was last updated by shreyas 7 years, 5 months ago.
- Topic
Hi Team,
I am writing a custom report. I am trying to use a stored procedure in a controller function. when i call the stored procedure i am able to get result in controller when i debug the array obtained using print_r().Even when i send this array to twig template i am able to get result as needed.Now when i extend the index twig page from OroUIBundle i.e ({% extends ‘OroUIBundle:actions:index.html.twig’ %} )it throws an error.
Please find the Controller function used to call stored procedure and send result to twig file:
123456789101112131415161718/*** @Route("/checkstoredproc",name="storedproc_testing")*/public function chckspAction(){$connection = $this->getDoctrine()->getManager()->getConnection();$curstartmonthdate = date('Y-m-01');$startTime = $curstartmonthdate;$endTime = date('Y-m-d');$var = "call GetAllLeadsForStatus('".$startTime."','".$endTime."',0,0)";//$testing1 = $connection->prepare($var, array(\PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => false));$testing1 = $connection->prepare($var);$testing1->execute();$testing1res = $testing1->fetchAll();return $this->render('CustomSalesBundle:Lead:statusreport.html.twig',array('resultset' => $testing1res));//print_r($testing1res);}Please find the twig file used to access the data:
123456789101112131415161718192021222324{% extends 'OroUIBundle:actions:index.html.twig' %}{% import 'OroDataGridBundle::macros.html.twig' as UI %}{% block content %}{%block body %}<div class="other-scroll-container"><div class="container-fluid grid-scrollable-container"><div class="grid-container"><table><tbody>{% for key,value in resultset %}<tr><td> {{ value.leaddata1}} </td><td> {{ value.leaddata2}} </td></tr>{% endfor %}</tbody></table></div></div></div>{% endblock %}{% endblock %}Now using this file when i try accessing the Stored Procedure , i get the error as
1General error: 2014 Cannot execute queries while other unbuffered queries are active. Consider using PDOStatement::fetchAll(). Alternatively, if your code is only ever going to run against mysql, you may enable query buffering by setting the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute.") in OroUIBundle:Default:index.html.twig at line 6Please find exception details thrown in given below screenshot:
Now if i comment {% extends ‘OroUIBundle:actions:index.html.twig’ %} in twig above , i get expected result in plain browser page.i am not sure on how to use stored procedure in OROCRM so that i can extend UIBundle index page to get default OROCRM style page.Please need help in how to solve this issue.
Thanks & Regards,
Shreyas S
The forum ‘OroPlatform – How do I? Questions’ is closed to new topics and replies.