-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();