我在symfonyproject中有以下脚本。
use Rowoco\AllgemeinBundle\Entity\Place;
.
.
public function getPlacelist( $iduser )
{
$em = $this->getDoctrine()->getManager();
$request = Request::createFromGlobals();
$placeRepo = $em->getRepository( "RowocoAllgemeinBundle:Place" );
$placeEntity = $placeRepo->findBy(
array(),
array(),
$request->request->get( "limitCount" ),
$request->request->get( "limitStart" )
);
//return $placeEntity;
$q = $em
->createQuery("SELECT p.description
FROM RowocoAllgemeinBundle:Place p
");
return $q->getResult();
}我没有特别的仓库或者其他的。但是当我使用findby()时,我就得不到结果了。当使用createQuery时,结果是2行。
你能告诉我,在哪里可以找到我的代码中的错误?
发布于 2014-09-09 11:20:26
findBy需要一个键/值数组,如下所示:
array(
'id' => 5,
'name' => 'john',
'friends' => array(1,23)
);正如您在最后一个条目中所看到的,您还可以传递一个数组,该数组具有WHERE … IN()查询的效果。不能传递给findBy的是范围和复杂的模式。
https://stackoverflow.com/questions/25743152
复制相似问题