2017-08-02 4 views

答えて

0

それはあなたが興味を持っている場合は、あなたが見ることができますWHERE句

$repository->findBy(['email' => '[email protected]', 'city' => 'Berlin']) 

SELECT * FROM table WHERE email = "[email protected]" AND city = "Berlin" 

の基準を作成します。方法getSelectSQLのリンク

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

+0

あなたの答えをありがとう –

0

これは通常、エンティティのプロパティで使用されます。これは、エンティティのプロパティ名としてのキーと、探しているものとしての値を持つ配列をとります。

例:

$this->getDoctrine() 
    ->getRepository('AppBundle:Users') 
    ->findBy(['id' => $id]) 
; 

$this->getDoctrine() 
    ->getRepository('AppBundle:Users') 
    ->findBy(['userName' => $userName]) 
; 

$this->getDoctrine() 
    ->getRepository('AppBundle:Users') 
    ->findBy(['email' => $email]) 
; 

あなたがここでそれについての詳細を読むことができます:https://symfony.com/doc/current/doctrine.html#fetching-objects-from-the-database

+0

Tnxしかし、私は 'select u from ... 'のようなdql構文が何であるか知りたいです。 –