I'm working on a symfony project, I tried to add a data to database using entity but I got an Doctrine sql error?!!!! so any help is appritiated in advanced
I made an entity myselft which is :
/**
* @ORM\Table(name="u001_user_group")
* @ORM\Entity
*/
class UserGroup
{
/**
* @var integer
*
* @ORM\Column(name="group", type="integer", length=20, nullable=false)
*/
private $group;
public function setGroup($group)
{
$this->group = $group;
return $this;
}
public function getGroup()
{
return $this->group;
}
}
And when I try to add something like this:
$UserGroup= new UserGroup();
$UserGroup->setUser($registerAction->getId());
$UserGroup->setGroup(4);
$em->persist($UserGroup);
$em->flush();
it give me this error:
An exception occurred while executing 'INSERT INTO u001_user_group (user, group) VALUES (?, ?)' with params [20, 4]:
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 'group) VALUES (20, 4)' at line 1