Symfony form query_buider and entity repository
I'm trying to create a form with data in collection type depending on the user being logged. I'm following this chapter of the Symfony cookbook . Everything works fine when the query_builder option is a closure where I get my data from DQL. As the data need to be fetched from different location in code, I would prefer to define the query in the Repository class. Here is the function in my repository : public function findOwnedBy($user) { $query = $this->getEntityManager()->createQuery("SELECT l FROM MyBundle:Article a JOIN a.owndBy u WHERE u.id = :userId"); $query->setParameters(array("userId"