symfony2 - doctrine how to fetch database switch a datetime -



symfony2 - doctrine how to fetch database switch a datetime -

i can't find reply in documentation. utilize symfony application, have database datetime each of table , row recent datetime there function $repository->findonebyid($id) obtain object ?

here solution using querybuilder:

$repository = $this->getdoctrine() ->getrepository('acmestorebundle:product'); $query = $repository->createquerybuilder('p') ->orderby('p.datetime', 'desc') ->setmaxresults(1) ->getquery(); $product = $query->getresult();

regards.

symfony2 datetime doctrine

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -