Wednesday, 15 May 2013

php - Finding by Object in Doctrine : FindBy( Object ) -



php - Finding by Object in Doctrine : FindBy( Object ) -

is possible pass object in function such findby function retrieve data?

note: ** $resto object not have **id attribute filled in. doctrine has find closest matching entry.

for example:

$resto = new restaurant(); $resto->setname('...') ... $repository = $this->getdoctrine()->getrepository('lesdatabundle:restaurants'); $result = $repository->findby($resto);

no, can utilize custom expression

$repository->findby([ 'some_field' => $resto->getsomefield(), 'other_field' => $resto->getotherfield() ]);

php symfony2 doctrine2 query-builder

No comments:

Post a Comment