Developed with love by KnpLabs Hire us for your project!
105

WhiteOctoberAdminBundle

by whiteoctober

A different take on an AdminBundle for Symfony2

WhiteOctoberAdminBundle

WARNING!: This bundle is now deprecated and no further development will take place on it. Use at your own risk :-)

Installation

You have to install this bundle as usual:

git submodule add git://github.com/whiteoctober/WhiteOctoberAdminBundle.git vendor/bundles/WhiteOctober/AdminBundle

You also have to install Pagerfanta with its bundle:

git submodule add git://github.com/whiteoctober/Pagerfanta.git vendor/pagerfanta

git submodule add git://github.com/whiteoctober/WhiteOctoberPagerfantaBundle.git vendor/bundles/WhiteOctober/PagerfantaBundle

Register namespaces in your autoload.php:

// app/autoload.php
$loader->registerNamespaces(array(
// ...
    'WhiteOctober' => __DIR__.'/../vendor/bundles',
    'Pagerfanta'   => __DIR__.'/../vendor/pagerfanta/src',
    // ...
));

Register bundles in your AppKernel class:

// app/AppKernel.php
public function registerBundles()
{
    return array(
        // ...
        new WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle(),
        new WhiteOctober\AdminBundle\WhiteOctoberAdminBundle(),
    );
}

Add these lines to your app/config/routing.yml file:

_white_october_admin:
    resource: .
    type: white_october_admin

white_october_admin:
    resource: "@WhiteOctoberAdminBundle/Resources/config/routing/admin.xml"

Here you go ! Pretty easy isn't it ?

Configuration

Data managers

WhiteOctoberAdminBundle provides three data managers:

  • Doctrine ORM
  • Doctrine ODM
  • Mandango

You have to choose at least one of them. You can add your own.

Edit your app/config/config.yml file:

# app/config/config.yml
white_october_admin:
    data_managers:
        doctrine:
            orm:    true
            odm:    false
        mandango:   false

Set true for each data manager you want to load.

Next, you have to declare your admin classes:

# app/config/config.yml
white_october_admin:
    ...
    admins:
        - { class: My\Bundle\Admin\MyClassAdmin }

Admin classes

An admin class must extend WhiteOctober\AdminBundle\Admin\Admin.

This bundle provides some admin classes for each data manager:

  • WhiteOctober\AdminBundle\DataManager\Doctrine\ORM\Admin\DoctrineORMAdmin
  • WhiteOctober\AdminBundle\DataManager\Doctrine\ODM\Admin\DoctrineODMAdmin
  • WhiteOctober\AdminBundle\DataManager\Mandango\Admin\MandangoAdmin

Example:

<?php

namespace My\Bundle\Admin;

use WhiteOctober\AdminBundle\DataManager\Doctrine\ORM\Admin\DoctrineORMAdmin;

class MyClassAdmin extends DoctrineORMAdmin
{
    protected function configure()
    {

    }
}

To finish, you have to define a comportment the configure() method.

protected function configure()
{
    $this
        ->setName('Articles')
        ->setDataClass('MyBundle\Entity\Article')
        ->addActions(array(
            'doctrine.orm.crud',
        ))
        ->addFields(array(
            'title',
            'content',
            'isActive',
            // ...
        ))
    ;
}

You have to set a data class which can be your entity class with the setDataClass() method.

You also have to define actions (crud, create, list, edit, update, ...) in the configure() method.

Actions

Each data manager provides a set of actions:

  • CRUDActionCollection
  • CreateAction
  • DeleteAction
  • EditAction
  • ListAdmin
  • NewAction
  • UpdateAction

To use one of them, just add it by using the addAction() method.

Each action is named like: xxxxx.action where xxxxx is the data manager (*mandango*, doctrine.orm or doctrine.odm)
and action is the lowered word before Action.

Fields

You should specify fields by using the addFields() method.

Copyright (c) 2011 Pablo Díez

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
  • Merge pull request #55 from makasim/composer-add
    By richsage, 2 years ago
  • Deprecation copy
    By richsage, 5 years ago
  • Merge pull request #51 from richsage/action-dependencies-find
    By richsage, 5 years ago
  • Merge branch 'multipart'
    By benfoxall, 5 years ago
  • added enctype to new and edit pages to allow file uploads
    By benfoxall, 5 years ago
  • add composer
    By makasim, 5 years ago
  • Merge pull request #54 from formapro/session-fix
    By pablodip, 5 years ago
  • fix session namespace.
    By makasim, 5 years ago
  • modified a bit batch actions
    By pablodip, 5 years ago
  • Added action dependency after all actions have been cleaned initially.
    By richsage, 6 years ago
  • Merge pull request #43 from formapro/bug-td-click-should-check-is-editable
    By johnwards, 6 years ago
  • disable click on td and redirect to edit page if not ediatable
    By makasim, 6 years ago
  • Merge pull request #38 from richsage/rich-styles-js
    By johnwards, 6 years ago
  • Nicer input submit buttons. Add 'jsreplace' class to said buttons.
    By richsage, 6 years ago
  • Merge remote-tracking branch 'nibsirahsieu/batch_actions'
    By pablodip, 6 years ago
  • Merge remote-tracking branch 'Infranology/patch-4'
    By pablodip, 6 years ago
  • fixed fields creating the form in different actions
    By pablodip, 6 years ago
  • added to customize the form creation, to use custom form types for instance
    By pablodip, 6 years ago
  • [PropelAdmin] improved batch delete action
    By nibsirahsieu, 6 years ago
  • Merge remote-tracking branch 'nibsirahsieu/patch-3' into patch3
    By pablodip, 6 years ago
  • Merge remote-tracking branch 'z7/master'
    By pablodip, 6 years ago
  • clean up AdminSession after a BatchAction execution
    By Eriksen Costa, 6 years ago
  • fixed batch actions
    By Eriksen Costa, 6 years ago
  • fixed typo
    By Eriksen Costa, 6 years ago
  • removed var_dump() call
    By Eriksen Costa, 6 years ago
  • [list.html.twig] select and unselect all checkbox
    By nibsirahsieu, 6 years ago
  • changed the position of the global selector for batch
    By pablodip, 6 years ago
  • Corrected a bug on Choices guessing in Guesser/ValidatorFieldGuesser.php
    By sandulungu, 6 years ago
  • avoid click on checkbox select
    By pablodip, 6 years ago
  • Merge remote-tracking branch 'origin/master'
    By pablodip, 6 years ago