有没有人可以详细解释 Symfony* 使用的标准来命名目录结构中的文件夹和文件?
MyBundle
?? Controller/ <-- 1) why singular?
?? Model/ <-- 2) why singular?
?? Resources/ <-- 3) why plural?
? ?? config/ <-- 4) why the "c" is lowercase?
? ?? translations/
? ?? views/ <-- 5) why the "v" is lowercase and views is plural?
? ? ?? Default/ <-- 6) Why uppercase?
? ? ?? my_view.html.twig <-- 7) Why lowercase and snake case?
? ?? public/
?? Service/ <-- 8) why singular?
?? Tests/
Run Code Online (Sandbox Code Playgroud)
这就引出了另一个问题:如果我想ArchiveSection在 Model 文件夹中创建一个包含类的文件夹,我应该如何命名它?
* 我使用的是 Symfony 2.3。
symfony框架中的结构和体系结构目录没有严格的规则。但存在最佳实践和标准惯例。
就您而言,没有任何问题,您可以做您想做的事。名称目录中的下划线似乎不是很标准的约定,但不是强制性的。
对于处理单数还是复数的问题,symfony 开发人员似乎没有回答约定。示例:我用“services”这样的复数来命名我的服务目录,并且我的所有代码都可以使用这个名称完美运行。
| 归档时间: |
|
| 查看次数: |
941 次 |
| 最近记录: |