idci / admin-generator-bundle
Symfony AdminGeneratorBundle
v2.2.0
2013-07-30 16:09 UTC
Requires
- php: >=5.3.2
- doctrine/doctrine-bundle: *
- pagerfanta/pagerfanta: dev-master
- symfony/framework-bundle: 2.2.*
- twig/twig: *
- white-october/pagerfanta-bundle: dev-master
This package is auto-updated.
Last update: 2024-08-24 20:29:02 UTC
README
添加Symfony2命令以扩展CRUD生成器
要求
此包扩展了 Sensio\Bundle\GeneratorBundle\Generator\DoctrineCrudGenerator
并且需要 php5-intl
。分页是通过white october提供的pagerfanta包实现的。
安装
要安装此包,请按照以下步骤操作
首先将依赖项添加到您的 composer.json
文件中
"require": { ... "pagerfanta/pagerfanta": "dev-master", "white-october/pagerfanta-bundle": "dev-master", "idci/admin-generator-bundle": "dev-master" },
然后使用以下命令安装包
php composer update
在您的应用程序内核中启用包
<?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle(), new IDCI\Bundle\AdminGeneratorBundle\IDCIAdminGeneratorBundle(), ); }
如你所见,我们使用 WhiteOctoberPagerfantaBundle 来分页列表结果。因此,您需要在 app/config/parameters.yml
中定义 max_per_page
参数。
parameters: ... max_per_page: 25
现在,您需要安装bootstrap。您可以选择以下任一方式
- 从 http://twitter.github.com/bootstrap/assets/bootstrap.zip 下载bootstrap
- 然后将它解压到项目的根目录下的 /web 目录。
或者
将 bootstrap_source
添加到您的 app/config/parameters.yml
parameters: ... bootstrap_source: http://twitter.github.com/bootstrap/assets/bootstrap.zip
然后运行以下命令以自动在您的web目录中安装bootstrap资源
php app/console admin-generator:install:bootstrap-files
生成CRUD后台
可以使用此命令轻松生成已经用bootstrap样式化的CRUD界面。
php app/console doctrine:generate:crud:twitter-bootstrap
然后您需要
- 指定您想生成CRUD的实体(例如:MyBundle:Entity)
- 指定是否要生成“写操作”例如“新建、更新和删除”
- 确定要使用的格式(注解、yml、php、xml)
- 确定路由前缀
您的CRUD实体已生成,以及布局。
享受吧!