【发布时间】:2015-06-21 19:26:06
【问题描述】:
根据symfony 文档网站上的this page,他们解释了如何处理您的应用程序逻辑和最佳实践。我在本文档中缺少的一件事是存储和使用实体的方式。有一个 small section 涵盖了您的实体中注释的使用,但我们现在都在使用它,我希望你也这样做。
到目前为止,我的项目有以下实体:
+------------------------------------------------------------------------+
| Filename | Location | Type |
+------------------------------------------------------------------------+
| Account.php | src/AppBundle/Entity | Entity |
| AccountRepository.php | src/AppBundle/Entity/Repositories | Repository |
| News.php | src/AppBundle/Entity | Entity |
| NewsRepository.php | src/AppBundle/Entity/Repositories | Repository |
+------------------------------------------------------------------------+
现在我无法创建 Forum.php 实体,因为我需要 4 个数据库表:
- forum_sections
- 论坛类别
- 论坛主题
- 论坛帖子
我是否需要在src/AppBundle/Entity 的一个名为 Forum.php 的文件中创建 4 个实体,或者我是否需要做其他事情来归档存储和使用这些实体的最佳实践方式。例如ForumSections.php 和其他三个文件似乎占用了大量空间,而且很丑。
感谢您的阅读,并提前感谢您抽出时间回复。如果我的问题中有任何拼写错误,我深表歉意。
【问题讨论】:
标签: symfony php symfony doctrine-orm entity