定制 yepsua/generator-bundle 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

yepsua/generator-bundle

Composer 安装命令:

composer require yepsua/generator-bundle

包简介

The RICH CRUD Generator for Symfony2

README 文档

README

YepsuaGeneratorBundle by @oyepez003

The RICH CRUD Generator for Symfony2.

The generate:doctrine:richcrud generates a basic controller for a given entity located in a given bundle. This controller allows to perform the five basic operations on a model.

Listing all records with pager and filters,
Showing one given record identified by its primary key,
Creating a new record,
Editing an existing record,
Deleting an existing record.

By default the command is run in the interactive mode and asks questions to determine the entity name, the route prefix or whether or not to generate write actions:

php app/console generate:doctrine:richcrud

To deactivate the interactive mode, use the --no-interaction option but don't forget to pass all needed options:

php app/console generate:doctrine:richcrud --entity=AcmeBlogBundle:Post --format=annotation --with-write --no-interaction

Installation

Download and make sure you have the composer.phar latest version running the command:

$ php composer.phar self-update

Add the next dependency in the composer.json file

"require": {
        ...
        "yepsua/generator-bundle": "dev-master"
        ...
    },

v1.0.0 for sf2.2.x or Old versions

v1.3.0 for sf2.3.x or Higher

Info: Use always the Last Stable Release of Symfony2.

For install and up to date the bundle

$ php composer.phar update yepsua/generator-bundle

Configuration

1) Add the required Bundles to your application kernel

<?php
// app/AppKernel.php

public function registerBundles()
{
    return array(
        ...
		new Yepsua\CommonsBundle\YepsuaCommonsBundle(),
		new Yepsua\RADBundle\YepsuaRADBundle(),
		new Yepsua\SmarTwigBundle\YepsuaSmarTwigBundle(),
		new Yepsua\GeneratorBundle\YepsuaGeneratorBundle(),
        ...
    );
}

2) Publishing assets

Run the symfony command

$ php app/console assets:install web

3) Run

The next command and follow the steps:

$ php app/console generate:doctrine:richcrud

4) Translation

Uncomment the translator in the configuration file ( config.yml ):

# app/config/config.yml

# ...
framework:
    # ...
    translator:      { fallback: %locale% }

Set the locale in the configuration file ( parameters.yml ):

# app/config/parameters.yml

parameters:
	# ...
    locale: en

Now, for each created module you need create a translation file for the managed entity.

If you run:

$ php app/console generate:doctrine:richcrud --entity:AcmeDemoBundle:Post

You must create the AcmeDemoBundle_Post.en.xliff file in Acme/DemoBundle/Resources/translations to translate the Module for the Post Entity

<?xml version="1.0"?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
    <file source-language="en" datatype="plaintext" original="file.ext">
        <body>
            <trans-unit id="entity.label">
                <source>entity.label</source>
                <target>Post</target>
            </trans-unit>
            <trans-unit id="list.view.title">
                <source>list.view.title</source>
                <target>Post Module</target>
            </trans-unit>
            <trans-unit id="list.view.grid.title">
                <source>list.view.grid.title</source>
                <target>Post List</target>
            </trans-unit>
            <trans-unit id="kanban.view.title">
                <source>kanban.view.title</source>
                <target>Post Kanban</target>
            </trans-unit>
            <trans-unit id="PostFooAttribute">
                <source>PostFooAttribute</source>
                <target>Post Foo Attribute</target>
            </trans-unit>
            <trans-unit id="PostBarAttribute">
                <source>PostBarAttribute</source>
                <target>Post Bar Attribute</target>
            </trans-unit>
        </body>
    </file>
</xliff>

Remember clear the cache.

New command options

The doctrine:generate:richcrud command has 3 new options (layout, multipart and with-kanban) please use the help for more information.

php app/console generate:doctrine:richcrud --help

Enjoy

yepsua/generator-bundle 适用场景与选型建议

yepsua/generator-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 373 次下载、GitHub Stars 达 4, 最近一次更新时间为 2013 年 01 月 22 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「admin」 「generator」 「jquery」 「ui」 「extensions」 「RIA」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 yepsua/generator-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 yepsua/generator-bundle 我们能提供哪些服务?
定制开发 / 二次开发

基于 yepsua/generator-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 373
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 5
  • 点击次数: 14
  • 依赖项目数: 1
  • 推荐数: 1

GitHub 信息

  • Stars: 4
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2013-01-22