remg/generator-bundle
Composer 安装命令:
composer require remg/generator-bundle
包简介
Code generation tool for Symfony3.
README 文档
README
Introduction
This bundle provides commands to intuitively generate code inside Symfony-based projects.
Overview
Features
1. Entity generation
Fields
- Handles all Doctrine2 column types.
Associations
- Handles all Doctrine2 association types (OneToOne, OneToMany, ManyToOne, ManyToMany).
- Handles unidirectional and bidirectional associations.
- Auto-detect association mappings when generating an Entity already targetted by other entities.
Configuration formats
- Handles all Doctrine2 metadata drivers (annotations, yaml, xml, php).
2. Entity re-generation
The bundle provides a command that will start an entity generation from the mappping informations of an existing entity. It is then possible to edit or add fields and associations before the entity is regenerated from scratch.
This same command can be used to regenerate an entity in a different mapping configuration format.
Installation
Step 1: Download the bundle
Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:
$ composer require --dev remg/generator-bundle dev-master
This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.
Step 2: Enable the bundle
Then, enable the bundle by adding
new Remg\GeneratorBundle\RemgGeneratorBundle() to the list of registered
bundles for the dev environment in the app/AppKernel.php file of your
project:
// app/AppKernel.php // ... class AppKernel extends Kernel { public function registerBundles() { // ... if (in_array($this->getEnvironment(), ['dev', 'test'])) { $bundles[] = new Remg\GeneratorBundle\RemgGeneratorBundle(); // ... } } // ... }
Step 3: Configure the bundle
The bundle comes with a default configuration, which is listed below. You can define these options in your configuration if you need to change them:
remg_generator: entity: # available configuration formats are: 'annotation', 'yaml', 'xml' and 'php'. configuration_format: annotation
Since this bundle is only useful in command line interface, you can override the
bundle configuration in your development configuration in
app/config/config_dev.yml.
Usage
You can now generate new Doctrine2 entities using the command below:
$ php bin/console remg:generate:entity
You can also regenerate Doctrine2 entities from scratch using the command below:
$ php bin/console remg:regenerate:entity
NOTE: Since this bundle can only generate code, and not manipulate existing code, this command will regenerate the entity from scratch without implementing any custom code that could live in the existing entity.
No code can be lost. Each file generation checks if the target file already exists, and creates a timestamped backup of the file before generation.
Under development
- Repository generation.
- Entity edition.
- CRUD generation (handling embed form collections).
License
This bundle is under the MIT license. See the complete license in the bundle.
remg/generator-bundle 适用场景与选型建议
remg/generator-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 21.83k 次下载、GitHub Stars 达 25, 最近一次更新时间为 2017 年 02 月 19 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 remg/generator-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 remg/generator-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 21.83k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 25
- 点击次数: 10
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-02-19
