0

There is an example about @SqlResultSetMapping in http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/native-sql.html

I do not understand where and how i should use it? In controller action? In some custom class or trait?

olga
  • 959
  • 1
  • 15
  • 42

1 Answers1

1

You can use it wherever you have access to repository class for entity in which you define it, i.e. from controller:

$em = $this->getDoctrine()->getManager();
$repo = $em->getRepository("SomeCertainBundle:YourEntity");
$results = $repo->createNativeNamedQuery("name-of-the-query")->execute();
Grzegorz Krauze
  • 1,130
  • 12
  • 26