2017-05-18 10:08
浏览 25

Symfony 3.2 Doctrine2以类的形式存储复杂查询的ORM

Kind time of the day, connoisseurs Symfony Already the third day I study Symfony 3.2 I learned to access several databases and tried a little Doctrine 2

Everything worked out. Prompt please where to me to store a library of requests to a database that I did not have to use repeated requests in various controllers.

If I do not understand explain

There is a controller for example this src / ParserBundle / EmployeesController.php

There is a:

$Repository = $this->getDoctrine()->getRepository('ParserBundle:Provider');
$Providers = $repository->findAll();

There is a class on queries to the database for example this src / ParserBundle / Entity / Provider.php

Then how to make complex queries I can read from the Doctrine 2 documentation, but where can I store them that would not duplicate? And how to access them from the main controllers - is there documentation about this?

图片转代码服务由CSDN问答提供 功能建议

当天的时间,鉴赏家Symfony已经是第三天我研究Symfony 3.2我学会了访问几个数据库并试过 一点点学说2

一切都成功了。 请提示我在哪里向数据库存储请求库,我不必在各种控制器中使用重复请求。


有一个控制器,例如 src / ParserBundle / EmployeesController.php

有一个: < pre> $ Repository = $ this-&gt; getDoctrine() - &gt; getRepository('ParserBundle:Provider'); $ Providers = $ repository-&gt; findAll();

对数据库的查询有一个类,例如 src / ParserBundle / Entity / Provider.php

那么如何 我可以从Doctrine 2文档中读取复杂的查询,但是我可以在哪里存储那些不会复制的文档? 以及如何从主控制器访问它们 - 是否有关于此的文档?

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

相关推荐 更多相似问题