我试图更新shopware中的customer属性,但出现错误
$builder = $this->container->get('models')->createQueryBuilder()
->update(\Shopware\Models\Customer\Customer::class, 'customer')
->set('customer.active',0)
->where('customer.email= :email')
->setParameter('email ' ,'xyz@test.com');
$builder->getQuery()->execute();
致命错误:未捕获条令\orm\query\queryexception:无效参数:查询中未定义令牌电子邮件。在/var/www/html/shopware/vendor/doctrine/orm/lib/doctrine/orm/query/queryexception中。php:134 stack 跟踪:#0/var/www/html/shopware/vendor/doctrine/orm/lib/doctrine/orm/query.php(362):条令\orm\query\queryexception::未知参数('email')#1/var/www/html/shopware/vendor/doctrine/orm/lib/doctrine/orm/query.php(319):条令\orm\query->processparametermappings(array)#2/var/www/html/shopware/vendor/doctrine/orm/lib/doctrine/orm/abstractquery.php(962):条令\orm\query->#doexecute()#3/var/www/html/shopware/vendor/doctrine/orm/lib/doctrine/orm/abstractquery.php(917):条令\orm\abstractquery->executeignorequerycache(null,null)#4/var/www/html/shopware/custom/plugins/customplugin/controllers/frontend/customplugin.php(17):条令\orm\abstractquery->execute()#5/var/www/html/shopware/engine/library/enlight/controller/action.php(193):shopware\u controllers\u frontend\u customplugin->indexaction()#in/var/www/html/shopware/vendor/doctrine/orm/lib/doctrine/orm/query/queryexception.php第134行
1条答案
按热度按时间u4vypkhs1#
尽量使用where语句;