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
Post a Comment