I'm attempting to return data from a simple query but I get the following error:
Uncaught PHP Exception Doctrine\ORM\Query\QueryException: "[Semantical Error] line 0, col 63 near 'user_id = :u': Error: Class \Bundle\MyBundle\Entity\User\Users has no field or association named user_id" at …../doctrine/orm/lib/Doctrine/ORM/Query/QueryException.php line 49
The Entity:
/**
* Users
*
* @ORM\Table(name="company.users")
* @ORM\Entity
*/
class Users
{
/**
* @var integer
*
* @ORM\Column(name="user_id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
* @ORM\SequenceGenerator(sequenceName="company.user_id_seq")
*/
private $userId;
The Call in the Controller:
$query = $em->createQuery(
'SELECT u
FROM MyBundle:User\Users u
WHERE u.user_id = :user_id'
)->setParameter('user_id', 48201);
$users = $query->getResult();