Doctrine2 allows you to query the use of magic finders based on field names. If you have an object named User , you can call $repo->findOneByUsernameAndPassword() , assuming the object has username and password fields.
How to pass parameters to magic seekers? How to query when a field that is actually a relation?
I tried:
$repo->findOneByUsernameAndPassword('Jhon', 'password')
and
$repo->findOneByUsernameAndPassword(array('Jhon', 'password'))
but I get an error:
The User object does not have a usernameAndPassword field. Therefore, you can not call 'findOneByUsernameAndPassword'
gremo source share