我正在尝试执行一些自定义 SQL 来检索 Symfony 应用程序中的一些模型对象。我在网上找到了一个教程,其中说类似的内容将允许我执行查询,但不填充模型(填充模型不是主要问题,它只是用于只读数据)。
$pdo = Doctrine_Manager::getInstance()->connection()->getDbh();
$pdo->prepare("SELECT * from something complicated");
$pdo->execute();
$this->sensorReadings = $pdo->fetchAll();
但我收到错误:
Fatal error: Call to undefined method PDO::execute()
in sfproject/apps/frontend/modules/site/actions/actions.class.php
$query = "SELECT * from something complicated";
$rs = Doctrine_Manager::getInstance()->getCurrentConnection()->fetchAssoc($query);
结果集是一个数组。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)