I'm wondering if it's possible to querying doctrine entities by a property from a relation.
Here is an example :
Entity A fields :
-> title
-> content
-> description
-> date
Entity B fields :
-> title
-> link ( entity b )
-> date
Is it possible to querying Entity B by link->title property such as the following :
$this->getDoctrine()->getManager()->getRepository("acmeAppBundle:EntityB")->findBy(array( "title" => "test", "link.title" => "example" ) );
Currently I'm achieving this with a custom function from Entity B repository, but may be I'm missing something.
You can't use findBy like this. FindBy is only there to fetch very basic things. Generally it's considered as a best practice to use repository calls, because for example, if you here fetch all objects where title is test and then you get from A all B entity, then entity B will be fetched separately, while in a repository call you can use join, so only one query will be sent to your DB.