我正在尝试更新 Shopware 中的客户属性但出现错误
I am trying to update customer attribute in Shopware but getting error
我正在尝试更新 Shopware 中的客户属性但出现错误
$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
尝试使用这样的 where 语句;
->where('customer.email = ?1')->setParameter(1 ,'xyz@test.com');
我正在尝试更新 Shopware 中的客户属性但出现错误
$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
尝试使用这样的 where 语句;
->where('customer.email = ?1')->setParameter(1 ,'xyz@test.com');