【发布时间】:2013-02-22 16:33:27
【问题描述】:
我对服务、实体和存储库以及我应该将我正在从事的项目的内容放在哪里有点困惑。我想我错过了一些东西,我担心我会以错误的方式去做。我不认为原则映射表名称非常适合报告,因为有很多列,并且这些列通常是其他 groupby 在日期、月份、年份等上的结果。
项目的简要简化概述是基于 Web 的报告的集合(作为捆绑包)。
为了创建报告,我必须使用销售日志包预先构建数据。销售日志从事务数据库中获取数据并将其放入准备好由各种其他报告运行的表中,即具有自定义索引等的报告。数据聚合是解释它的更好方法。数据源拥有数百万年前的预订数据,因此直接基于源的报告效率不高,因此销售日志就派上用场了。
SalesJournalBundle - fetches data from source and puts it into a table ready for other reports
WeeklyConversionReportBundle - exports sales journal into weekly conversion report table has functions for totals for the week, totals for month, etc
OtherReportBundle - etc
销售日志
类来运行销售日志并从大表导出到另一个表。
createQuery($parameters);
runQuery($exportTableName);
WeeklyConversionBundle
// runs the sales journal and saves to the report. Entity? Or Service or Repoistory?
runSalesJournalQuery();
// generates conversion figures and saves the to the table? Entity Or Service or Repoistory?
generateConversions();
getWeekTotals(); // used when displaying the report..
getMonthTotals($month) // used when displaying the report..
getTotals() // used when displaying the report..
etc.
所以当我开始项目时,我假设所有函数都属于实体类。但是我不确定它们是否是严格的模型,因为它们需要数据库访问和对其他类的访问?困惑在哪里放置类/方法。任何反馈将不胜感激。
【问题讨论】:
标签: php symfony architecture