Zend 框架 + Doctrine1.2 项目结构具有更多模块
应用程序与 ZendFramework + Doctrine 1.2 的实现相结合已经有一段时间了,但现在他们第一次体验了更多模块的使用。我要求每个人都可以看到具有特定布局的默认模块和具有不同布局的管理模块。
到目前为止,在我的应用程序中,我一直使用以下结构:
/app
/application
/acls
/configs
/controllers
/forms
/layouts
/models --> models by doctrine
/generated --> base models by doctrine
/plugins
/views
/Bootstrap.php
/data
/doctrine
/data
/migrations
/schema
/schema.yml
/doctrine.php
/library
/public
/tests
所以我的问题是:我的应用程序的结构应该如何执行所需的操作?
我尝试使用 zend 工具并查看我创建了命令的类型:
zf create module admin
当然,启动后
zf create project app
我注意到创建命令模块在 application
中创建了一个文件夹 modules
。 在modules
中创建了admin
,并在其中创建了controllers
、models
和views
。
因此,除了正确分离zf控制器和视图之外,还意味着模型。 但我的学说一方面创造了所有模型! :D
如何使用学说为每个模块创建的模板?
那么如何为管理模块分配新的布局呢?
对于聚会客人,您建议我离开当前使用的设施还是以默认
的形式将其全部移动?
抱歉,如果我问了很多问题,也许太多了,但我真的很困惑!
谢谢
applications coupled with the realization ZendFramework + Doctrine 1.2 for some time, but now they have their first experience with the use of more modules. I requested a default module is visible to everyone with a certain layout and an admin module with a different layout.
So far in my applications I have always used the following structure:
/app
/application
/acls
/configs
/controllers
/forms
/layouts
/models --> models by doctrine
/generated --> base models by doctrine
/plugins
/views
/Bootstrap.php
/data
/doctrine
/data
/migrations
/schema
/schema.yml
/doctrine.php
/library
/public
/tests
So my question is: how should the structure of my application to do what is required?
I tried using zend tool and see what kind of structure I created the command:
zf create module admin
course after launching
zf create project app
I noticed that the create command module I created a folder modules
in application
.
Into modules
created admin
and inside it has created controllers
, models
and views
.
So in addition to separating means zf controller and view correctly, but also models.
But my doctrine creates all the models on the one hand! :D
How can I do to use templates created by doctrine for each module?
Then how do I assign a new layout for the admin module?
For the party guest you advise me to leave the facility that currently use or move it all in a form default
?
Sorry if I made a lot of questions, maybe too much, but I am really very confused about it!
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
经过详尽的文档后,我找到了正确的项目结构
为了根据您所在的模块查看不同的布局,我使用了以下插件:
进入 Bootstrap.php 文件
进入 application.ini 文件< /strong>
上述插件会根据使用的模块在“layouts/scripts”中设置名为 module.phtml 的布局。
如何在模块内自动加载表单
将以下两行添加到您的 application.ini 文件
为每个模块创建一个 boostrap 文件。该文件名为 Bootstrap.php,应放置在模块目录的根目录中,类名称应为 {模块名称}_Boostrap。该引导文件将使 zend 框架自动将新的 forms 目录添加到自动加载器。
将表单类添加到 /forms 目录。登录表单的文件名为 Login.php,类名为 {模块名称}_Form_Login
从同一模块内的控制器文件调用表单
简单而有效! ;)
After a thorough documentation I've found the right project structure
To view a different layout according to where you are module I used the following plugins:
into Bootstrap.php file
into application.ini file
the plugin described above according to the module in use will set the layout with the name of module.phtml within "layouts/scripts".
How to Autoload forms within a module
add the two below lines to your application.ini file
Create a boostrap file for each module. The file, named Bootstrap.php, should be placed in the root of the module directory and the class name should be {module name}_Boostrap. This bootstrap file will cause zend framework to automatically add the new forms directory to the autoloader.
Add for form class to the /forms directory. A login form would have a filename of Login.php and a class name of {module name}_Form_Login
Call your form from a controller file from within the same module
Simple and effective! ;)