nitra/admingenerator-generator-bundle

Admingenerator for Symfony2 based on YAML configuration and Twig templating

Installs: 299

Dependents: 1

Watchers: 14

Forks: 142

Language: PHP

1.0.0 2014-01-25 15:05 UTC

README

KnpBundles Badge project status build status Latest Stable Version Total Downloads

The Real Missing Admin Generator for Symfony2!

This package is a Symfony2 Admin Generator based on YAML configuration and Twig templating. It's inspired by fzaninotto/Doctrine2ActiveRecord.

Follow us on Twitter!

Don't miss any updates from Symfony2 Admin Generator! Join Twitter today and follow us!

Features:

  • Generate Views and Controllers for Models with one command
  • Configure all options in one (per model) YAML file
  • Includes standard actions: create/edit, show, delete, list/nestedset tree list
  • Flexible and extendable: you can easily add or overwrite almost everything!
  • Supports most popular model managers: Doctrine ORM, Doctrine ODM and Propel
  • Introduces nested forms: create/edit object and all it's associated objects in one form!
  • Manage relations one to one, one to many, many to one and many to many
  • Fully translatable: all field elements (labels, placeholders, helpers), all widgets, actions, error messages and titles
  • List features: sortable, paginated, filters, batch actions, scopes
  • Nestedset tree list features: drag&drop to manage your tree
  • New/Edit featues: fieldsets, tabbable, cool widgets for collection, file upload, date and entity fields
  • Translated into DE, EN (default), ES, FA, FR, GR, IT, JA, NL, PL, PT, RO, RU, SL, TR, UK (you can easily contribute to add your own)
  • Credentials for actions, columns and form fields
  • Complete admin design based on twitter bootstrap (see next section)
  • ... and more!

This bundle in pictures

Preview of list

Preview of edit

Preview of dashboard

Important note

Documentation is currently being rewritten. Old documentation can be found in:

Sorry for inconvenience, we will fix that as soon as possible!

Installation

All the installation instructions are located in documentation.

Documentation

The documentation for this bundle is located in Resources/doc directory. Start by reading Table of contents.

Translations

If you wish to use default texts provided in this bundle, you have to make sure you have translator enabled in your config.

# app/config/config.yml

framework:
    translator: ~

For more information about translations, check Symfony documentation.

Installation

Installation is a 3 step process:

  1. Download NitraThemeBundle using composer
  2. Enable the Bundle
  3. Configure the NitraThemeBundle

Step 1: Download NitraThemeBundle using composer

Add NitraThemeBundle in your composer.json:

{
    "require": {
        "nitra/admingenerator-generator-bundle": "2.3.*@dev"
    }
}

Now tell composer to download the bundle by running the command:

$ php composer.phar update nitra/admingenerator-generator-bundle

Composer will install the bundle to your project's vendor/nitra directory.

Step 2: Enable the bundle

Enable the bundle in the kernel:

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Knp\Bundle\MenuBundle\KnpMenuBundle(),
        new WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle(),
        new Admingenerator\GeneratorBundle\AdmingeneratorGeneratorBundle(),
        new Millwright\MenuBundle\MillwrightMenuBundle(),
    new Millwright\ConfigurationBundle\MillwrightConfigurationBundle(),
        new Genemu\Bundle\FormBundle\GenemuFormBundle(),
        new Pinano\Select2Bundle\PinanoSelect2Bundle(),
    new FOS\UserBundle\FOSUserBundle(),
    );
}

Step 3: Configure

Add the following configuration to your config.yml file according to which type of datastore you are using.

# app/config/config.yml
imports:
    - { resource: menu.yml }
    - { resource: ../../vendor/nitra/doctrine-behaviors/config/orm-services.yml }


# Assetic Configuration
assetic:
    debug:          %kernel.debug%
    use_controller: false
    bundles:        [ AdmingeneratorGeneratorBundle ]
    #java: /usr/bin/java
    filters:
        cssrewrite: ~
        lessphp: ~

# Doctrine Configuration
doctrine:
    orm:
        filters:
            softdeleteable:
                class: Admingenerator\GeneratorBundle\Filter\SoftDeleteableFilter
                enabled: true
        hydrators:
            KeyPair: Admingenerator\GeneratorBundle\Hydrators\KeyPairHydrator      

# FOS Configuration
fos_user:
    db_driver: orm # other valid values are 'mongodb'
    firewall_name: main
    user_class: Nitra\NitraThemeBundle\Entity\User

# Admingenerator Configuration
admingenerator_generator:
    base_admin_template: ::base_admin.html.twig
    use_doctrine_orm: true
    stylesheets: []
    logout_path: fos_user_security_logout
    twig:
        use_localized_date: true
        use_form_resources: true
        date_format: 'Y-M-d'
        localized_date_format: 'medium'
        localized_datetime_format: 'medium'
        datetime_format: 'Y-m-d H:i'  
        number_format:
            decimal: 2
            decimal_point: ','
            thousand_separator: ' '

# Замена combobox на Select2             
genemu_form:
    select2:
        enabled: true

# Add blameable listener
parameters:
    knp.doctrine_behaviors.blameable_listener.user_entity: Nitra\NitraThemeBundle\Entity\User