My code is:
$query = $em->createQuery("UPDATE AppBundle:Project u SET u.name=1, u.key=?2, u.leader=?3 WHERE u.id = ?4");
$query->setParameter(1, $project->name);
$query->setParameter(2, $project->key);
$query->setParameter(3, $project->lead->name);
$query->setParameter(4, $project->id);
$result = $query->getResult();
Now when I run it, it gives me a error:
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'key = 'EIAD', leader = 'fake.name' WHERE id = '12305'' at line 1
I cant figure out what I'm doing wrong here. I even tried with the Object update like:
$project->setname();
etc.
EDIT: Forgot to say the code is used in a self created command!