duanqun9618 2018-08-17 05:57
浏览 68
已采纳

我试图更新Shopware中的客户属性,但收到错误

I am trying to update customer attribute in Shopware but getting error

$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();

Fatal error: Uncaught Doctrine\ORM\Query\QueryException: Invalid parameter: token email is not defined in the query. in /var/www/html/shopware/vendor/doctrine/orm/lib/Doctrine/ORM/Query/QueryException.php:134 Stack trace: #0 /var/www/html/shopware/vendor/doctrine/orm/lib/Doctrine/ORM/Query.php(362): Doctrine\ORM\Query\QueryException::unknownParameter('email ') #1 /var/www/html/shopware/vendor/doctrine/orm/lib/Doctrine/ORM/Query.php(319): Doctrine\ORM\Query->processParameterMappings(Array) #2 /var/www/html/shopware/vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php(962): Doctrine\ORM\Query->_doExecute() #3 /var/www/html/shopware/vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php(917): Doctrine\ORM\AbstractQuery->executeIgnoreQueryCache(NULL, NULL) #4 /var/www/html/shopware/custom/plugins/CustomPlugin/Controllers/Frontend/CustomPlugin.php(17): Doctrine\ORM\AbstractQuery->execute() #5 /var/www/html/shopware/engine/Library/Enlight/Controller/Action.php(193): Shopware_Controllers_Frontend_CustomPlugin->indexAction() # in /var/www/html/shopware/vendor/doctrine/orm/lib/Doctrine/ORM/Query/QueryException.php on line 134

  • 写回答

1条回答 默认 最新

  • douhu2898 2018-08-17 06:07
    关注
    • Try to use where statement like this;

      ->where('customer.email = ?1')->setParameter(1 ,'xyz@test.com');
      
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题