[英]symfony should I create a new bundle or use appbundle
I am new to Symfony and have been watching a lot of tutorials on using this MVC. 我是Symfony的新手,并且已经观看了很多有关使用此MVC的教程。 They all start (at least the ones I've seen) by saying your app should be in it's own bundle.
他们都说(至少我见过这些),它们都说您的应用程序应该放在它自己的捆绑包中。 When I start a new project it comes with AppBundle already there.
当我开始一个新项目时,它已经带有AppBundle。 Should I create a new bundle or use this one.
我应该创建一个新捆绑包还是使用这个捆绑包。
I realise that people to things differently and that symfony.com says that best practice is to use AppBundle but from what I can see the resources folder is outside of AppBundle instead of within the bundle in the case of creating a new one. 我意识到人们的看法有所不同,symfony.com表示最佳实践是使用AppBundle,但从我的眼中可以看到,资源文件夹位于AppBundle外部,而不是在创建新文件夹时位于捆绑软件中。
I hope I'm not being too cryptic in my question. 我希望我对这个问题不要太含糊。
Any help would be greatly appreciated. 任何帮助将不胜感激。
Symfony2/3 has a great documentation. Symfony2 / 3有很好的文档。 There is a complete section that handle the topic of bundles.
有一个完整的部分处理捆绑软件主题。
http://symfony.com/doc/current/cookbook/bundles/best_practices.html http://symfony.com/doc/current/cookbook/bundles/best_practices.html
Take a look at the Cookbook there are a lot of great informations. 看看菜谱,这里有很多很棒的信息。 For your question you can create so much Bundles you need.
对于您的问题,您可以创建所需的大量Bundles。 A bundle should be a complete topic of a function for example a "NewsletterBundle" which holds all your functions for a complete Newsletter section.
捆绑软件应该是功能的完整主题,例如“ NewsletterBundle”,其中包含完整新闻简报部分的所有功能。 You should find your own way with one eye on the guidelines.
您应该一只眼睛看指南。
To complete the @Stony's answer, and answer the title of your question, you can perfectly use the AppBundle. 要完成@Stony的答案并回答问题的标题,您可以完美地使用AppBundle。
It's a good example to start with Symfony. 这是从Symfony开始的一个很好的例子。
It contains a first route that checks your configuration, uses the Request
component, access to a config parameter and display a link to the Create your first page with Symfony2 part of Symfony2 book, in a twig template. 它包含一个第一条路径,该路径检查您的配置,使用“
Request
组件,访问config参数并在树枝模板中显示指向Symfony2的“ 使用Symfony2创建您的第一页”部分的链接。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.