Vote count:
0
I have an entity called User that has the following:
class User implements UserInterface
{
/**
* @ORM\Id
* @ORM\Column(type="string",length=100)
**/
protected $id_user;
/** @ORM\Column(type="string")
*/
protected $surname;
/**
* @ORM\Column(type="string",length=50)
*/
protected $name;
/**
* @var ArrayCollection $friends
* @ORM\ManyToMany(targetEntity="UniDocs\UserBundle\Entity\User")
* @ORM\JoinTable(name="friends",
* joinColumns={@ORM\JoinColumn(name="friend1", referencedColumnName="id_user")},
* inverseJoinColumns={@ORM\JoinColumn(name="friend2", referencedColumnName="id_user")}
* )
*/
protected $friends;
.
.
.
/**
* Get friends
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getFriends()
{
return $this->friends;
}
.
.
.
}
I need to make a query that gives me the friends of an user which name contain letter 'a' and surname letter 'b' (for example. Those letter are specified on a filter in a web form).
I know I can access all the friends of the registered user using getFriends() method, but... how to filter those friends?
asked 50 secs ago
Aucun commentaire:
Enregistrer un commentaire