Getting Started With MateLemonBundle
This Bundle generates CRUD for your entities into your Symfony application
with the ability to customize your Controllers/Forms/Views files standards., (*1)
- Installation
- Run Lemon Generator
Installation
Prerequisites
This bundle requires the following additional package:, (*2)
Step 1: Download the Bundle
Open a command console, enter your project directory and execute the following command to download the latest version of this bundle:, (*3)
``` bash
$ composer require mate/lemon-bundle dev-master, (*4)
### Step 2: Enable the Bundle
Then, enable the bundle by adding it to the list of registered bundles in the `app/AppKernel.php` file of your project:
``` php
<?php
// app/AppKernel.php
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = array(
// ...
new Mate\LemonBundle\MateLemonBundle(),
);
}
}
Step 3: Add the overriding parameter
Add the overriding parameter to the app/config/parameters.yml
file:, (*5)
# app/config/parameters.yml
mate.lemon.template.override: false
NOTE: If you want to override the default Lemon generator templates, you have to turn this parameter to true, and then create your own template system by adding new folder to your bundle called LemonTemplate/
., (*6)
Run Lemon Generator
After creating and generating your own entities with Doctrine, you should pass the task for the Lemon Generator command., (*7)
bash
$ php bin/console mate:lemon:generate:full
, (*8)
The mate:lemon:generate:full
command generates CRUD for a given bundle and entity.
After running this command, you just have to follow the instructions., (*9)
What you'll get:, (*10)
Element |
Path |
Controller |
!YourBundle!/Controller/!YourEntity!/!EntityName!Controller.php |
Form |
!YourBundle!/Form/!EntityName!Type.php |
Form (View) |
!ViewsFolder!/LemonGenerator/!EntityName!/form.html.twig |
Index (View) |
!ViewsFolder!/LemonGenerator/!EntityName!/index.html.twig |
Show (View) |
!ViewsFolder!/LemonGenerator/!EntityName!/show.html.twig |
Menu (View) |
!ViewsFolder!/LemonGenerator/Include/menu.html.twig |
Header (View) |
!ViewsFolder!/LemonGenerator/Include/header.html.twig |
Layout (View) |
!ViewsFolder!/LemonGenerator/layout.html.twig |