-1
有关于@SqlResultSetMapping
在 http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/native-sql.html如何在Symfony2,doctrine 2中使用@SqlResultSetMapping?
一个例子,我不明白的地方,以及如何我应该使用它?在控制器行动?在一些习俗班或特质?
有关于@SqlResultSetMapping
在 http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/native-sql.html如何在Symfony2,doctrine 2中使用@SqlResultSetMapping?
一个例子,我不明白的地方,以及如何我应该使用它?在控制器行动?在一些习俗班或特质?
只要您有从控制器访问库类的实体中,你定义它,即你可以使用它:
$em = $this->getDoctrine()->getManager();
$repo = $em->getRepository("SomeCertainBundle:YourEntity");
$results = $repo->createNativeNamedQuery("name-of-the-query")->execute();