Search code examples
symfonydoctrinedql

DQL findBy default query


What is DQL findBy() query syntax?

Like this: $this->getDoctrine()->getRepository("AppBundle:Users")->findBy($queryWhere);


Solution

  • It will create criteria for WHERE CLAUSE

    $repository->findBy(['email' => 'test@test.com', 'city' => 'Berlin'])
    
    SELECT * FROM table WHERE email = "test@test.com" AND city = "Berlin"
    

    if you are interested, you can take a look in the method getSelectSQL under the following link

    http://www.doctrine-project.org/api/orm/2.5/source-class-Doctrine.ORM.Persisters.Entity.BasicEntityPersister.html#877-891