我遇到一个错误,但不知道如何修复它
$query = $entityManager->createQuery("UPDATE AppBundle:ChangeAPI SET `key`='asd123' WHERE `id` = 1");
$query->execute();
我的AppBundle:ChangeAPI
/**
* @ORM\Entity
* @ORM\Table(name="api")
*/
class ChangeAPI
{
/**
* @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* The date on which the shipment has been created
*
* @ORM\Column(type="string", name="key")
*/
protected $key;
/** Creates a new standard ride */
function __construct()
{
}
}
这是我的错误结果:
[Syntax Error] line 0, col 31: Error: Expected Doctrine\ORM\Query\Lexer::T_SET, got '`'
QueryException: [Syntax Error] line 0, col 31: Error: Expected Doctrine\ORM\Query\Lexer::T_SET, got '`'
QueryException: UPDATE AppBundle:ChangeAPI SET `key`='asd123' WHERE `id` = 1
有人能帮我吗?谢谢。
AppBundle.ChangeAPI
而不是AppBundle:ChangeAPI
吗? - Sougata Bosewithout
,那么会出现以下错误: [语法错误] 第0行,第31列:错误:期望Doctrine\ORM\Query\Lexer::T_SET,得到'key' - Colar Paul