gpt4 book ai didi

doctrine - Doctrine_Expression 问题(Doctrine 2) 'There is no open connection'

转载 作者:行者123 更新时间:2023-12-04 06:22:50 25 4
gpt4 key购买 nike

我的 Doctrine2 与我的 Zend PHP 堆栈一起工作得很好。

但是,如果我想使用 Doctrine_Expression ,

$item->setDateCreated(new Doctrine_Expression('NOW()'));

然后我收到以下错误 '没有打开的连接' .
这是堆栈跟踪:
#0 D:\data\wamp\bin\php\php5.3.5\PEAR\Doctrine\Manager.php(264): Doctrine_Manager->getCurrentConnection()
#1 D:\data\wamp\bin\php\php5.3.5\PEAR\Doctrine\Expression.php(72): Doctrine_Manager::connection()
#2 D:\data\wamp\bin\php\php5.3.5\PEAR\Doctrine\Expression.php(116): Doctrine_Expression->getConnection()
#3 D:\data\wamp\bin\php\php5.3.5\PEAR\Doctrine\Expression.php(133): Doctrine_Expression->parseExpression('NOW()')
#4 D:\data\wamp\bin\php\php5.3.5\PEAR\Doctrine\Expression.php(89): Doctrine_Expression->parseClause('NOW()')
#5 D:\data\wamp\bin\php\php5.3.5\PEAR\Doctrine\Expression.php(60): Doctrine_Expression->setExpression('NOW()')
#6 D:\data\work\gazette\Projects\NorskTipping\admin-system\code\application\library\MagicHeads\Knalledge\Models\Tagging.php(91): Doctrine_Expression->__construct('NOW()')
...
#14 {main}

我尝试添加连接
$item->setDateCreated(new Doctrine_Expression('NOW()', $this->_em->getConnection()));

但是,它恰好是 Doctrine\DBAL\Connection 类型的连接。而 Doctrine_Expression 需要 Doctrine_Connection

我如何获得 Doctrine_Connection 并将其提供给 Doctrine_Expression?

最佳答案

Doctrine_Expression 是 Doctrine 1 类,不能与 Doctrine 2 一起使用。两个版本差异很大,不兼容。

关于doctrine - Doctrine_Expression 问题(Doctrine 2) 'There is no open connection',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6360572/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com