The WsGeneratorBundle
extends the default Symfony2 command line
interface by providing new interactive and intuitive commands for generating
code skeletons like bundles, form classes, or CRUD controllers based on a
Doctrine 2 schema.
This version of the bundle requires Symfony 2.3+.
Installation is a quick 4 step process:
- Download WsGeneratorBundle using composer
- Enable the Bundle
- Generate your Entity class
- Generate CRUD for your Entity class
Add WsGeneratorBundle in your composer.json:
{
"require": {
"web-solution/generator-bundle": "dev-master"
}
}
Now tell composer to download the bundle by running the command:
$ php composer.phar update web-solution/generator-bundle
Composer will install the bundle to your project's vendor/web-solution
directory.
Enable the bundle in the kernel:
<?php
// app/AppKernel.php
public function registerBundles()
{
if (in_array($this->getEnvironment(), array('dev', 'test'))) {
$bundles[] = new Ws\Bundle\GeneratorBundle\WsGeneratorBundle();
}
}
$ php app/console ws:generate:entity
Add the constructor in your Entity class:
<?php
// Entity/Post.php
function __construct()
{
$this->token = base_convert(sha1(uniqid(mt_rand(1, 999) . new \DateTime(), true)), 16, 36);
}
$ php app/console ws:generate:crud
Issues and feature requests are tracked in the Github issue tracker.
When reporting a bug, it may be a good idea to reproduce it in a basic project built using the Symfony Standard Edition to allow developers of the bundle to reproduce the issue by simply cloning it and following some steps.