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 f
I just did a little fix of saamorim answer. The working code would be something like this:
public function queryOwnedBy($user) {
$query = $this->createQueryBuilder("u")
->where('u.id = :id')
->setParameter('id', $user->getId());
return $query;
}
public function findOwnedBy($user) {
return $this->queryOwnedBy($user)
->getQuery()
->getResult();
}