mate/lemon-bundle

Symfony CRUD/Templates generator and creator bundle for Doctrine Entities

dev-master 2017-09-19 12:18 UTC

This package is not auto-updated.

Last update: 2024-04-17 18:16:53 UTC


README

This Bundle generates CRUD for your entities into your Symfony application with the ability to customize your Controllers/Forms/Views files standards.

  1. Installation
  2. Run Lemon Generator

Installation

Prerequisites

This bundle requires the following additional package:

  • Symfony 2.8.x or 3.2.x

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:

$ composer require mate/lemon-bundle dev-master

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
// 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:

# 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/.

Run Lemon Generator

After creating and generating your own entities with Doctrine, you should pass the task for the Lemon Generator command.

$ php bin/console mate:lemon:generate:full

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.

What you'll get:

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