We do not have a published flex recipe, so make sure to create a configuration file first.
Choose your model manager (Doctrine, Doctrine ODM or Propel) and choose if you want to use Assetic.
Create config/packages/admingenerator_generator.yaml
and add the following:
admingenerator_generator:
# choose and enable at least one
use_propel: false
use_doctrine_orm: true
use_doctrine_odm: false
# add this line if you want to use assetic
base_admin_template: @AdmingeneratorGenerator/base_uncompressed.html.twig
Run following commands:
composer require symfony2admingenerator/generator-bundle
This bundle depends on:
- BabDevPagerfantaBundle
Note: there are also some optional dependencies, each is described in corresponding feature`s doc. This guide describes only the minimal-setup.
Enable Admin Generator and its dependencies in your config/bundles.php
. (when using flex, this has been done for you):
<?php
BabDev\PagerfantaBundle\BabDevPagerfantaBundle::class => ['all' => true],
Admingenerator\GeneratorBundle\AdmingeneratorGeneratorBundle::class => ['all' => true],
Required to prevent cache issues.
Note: This is not needed when using the
generate_base_in_project_dir
setting.
Place the following in your frontend controller (public/index.php
) and your console binary (bin/console
)
to ensure the AdminGenerated
namespace is loaded! Make sure to place it directly after the kernel instantiation.
use Admingenerator\GeneratorBundle\ClassLoader\AdmingeneratedClassLoader;
// Preload the admin generator namespace to prevent class load errors when checking whether the cache is fresh
AdmingeneratedClassLoader::initAdmingeneratorClassLoader($kernel->getCacheDir());
If you want to use the JMS Security Extra expressions, make sure to install the bundle and enable it in the config:
jms_security_extra:
# Enables expression language
expressions: true
admingenerator_generator:
use_jms_security: true
By default, the base.html.twig
uses UglifyCSS and UglifyJS to minify assets and combine them into one file (less HTTP requests).
In order to properly install and configure UglifyCSS and UglifyJS follow this article
See also Asset Management cookbook entry.
The Admin Generator requires NodeJS and bower package to download its assets dependencies (jQuery, Twitter Bootstrap and so on).
Make sure bower
is available through your PATH environment variable, then run the following command:
php app/console admin:assets-install
Assets will be downloaded to the admin
directory into the root web
directory.
If you're using assetic for asset management, dump your assets by running:
php app/console assetic:dump
By default, the brand text ("Dashboard") is disabled. To link it with your Dashboard add dashboard_route
under admingenerator_generator
in your app/config/config.yml
:
admingenerator_generator:
dashboard_route: MyDashboard_path