將Symfony2用於我的結構之一。我想保留與其他模塊文件相關的模塊和各種與模塊相關的文件。Symfony2確認應用程序和模塊的自定義文件夾結構
因此,例如。我有前端應用程序。在前端應用程序下,我有用戶,圖庫模塊。我想將與用戶相關的所有文件保存在一個地方,並將與畫廊相關的所有文件保存在一個地方。這樣我就可以在Symfony1.4中提供模塊級的抽象。
以下是我在此達到的文件夾結構。
web/
admin.php
frontend.php
apps/
autoload.php # this autloads the common libaries/vendors for all application eg. CommonBundle
admin/
AppKernel.php
AppAutoload.php # load application specific libraries
bootstrap.php.cache
config/
cache/
.
.
.
frontend/
AppKernel.php
AppAutoload.php
bootstrap.php.cache
config/
cache/
.
.
.
src/
Admin/
UserBundle/
Controller/
UsersController.php
Entity/
User.php
Repository/
UserRepository.php
Resources/
views/
indexUserView.twig.html
DiaryBundle/
Controller/
DiaryController.php
Entity/
Diary.php
Repository/
DiaryRepository.php
Resources/
views/
indexDiaryView.twig.html
Frontend/
UserBundle/
Controller/
UsersController.php
Entity/
User.php
Repository/
UserRepository.php
Resources/
views/
indexUserView.twig.html
DiaryBundle/
Controller/
DiaryController.php
Entity/
Diary.php
Repository/
DiaryRepository.php
Resources/
views/
indexDiaryView.twig.html
我對上述文件夾結構很有信心。但是,當我發現Symfony2社區支持在應用程序級創建Bundle而不是在模塊級時,我想知道在模塊級創建Bundle的優點和缺點。在模塊級別創建可能的陷阱是什麼?
我可以看到具有用於模塊
所有控制器,視圖模塊的模型是相同位置,並且從抽象控制器其他模塊,模型,視圖束的許多優點。這樣的人在一個模塊上的工作有一個文件夾內只工作,不操心人的工作正在進行中模塊2即bundle2中
清除緩存可以在應用層面發生使用以下命令清除緩存的只是前端應用
shell> php apps/frontend/console cache:clear
如果您需要在前端應用程序中創建一個包,那麼命令如下所示。它在src/frontend應用程序下創建UserBundle。它還在apps/frontend/AppKernel.php中註冊了軟件包名稱。
shell> php apps/frontend/console generate:bundle --namespace=frontend/userBundle --format=yml
所以一切似乎罰款。但是,似乎Symfony2社區並不認爲這種方法是正確的?
請在我的方法中建議循環孔?