Version

Documentation » Doctrine2 ORM Admin

5. Defining admin class »

« 3. Defining the routing

4. Defining the CRUD controller

A crud controller class is just an empty class with no methods. However, you can add new actions or overwrite the default CRUD actions to suit your application.

Note

The controller declaration is optional, if none is defined, then the AdminBundle will use the CRUDController.

Just create 3 files inside the Controller directory

4.1. CommentAdminController

<?php
// src/Tutorial/BlogBundle/Controller/CommentAdminController.php

namespace Tutorial\BlogBundle\Controller;

use Sonata\AdminBundle\Controller\CRUDController as Controller;

class CommentAdminController extends Controller
{

}

4.2. PostAdminController

<?php
// src/Tutorial/BlogBundle/Controller/PostAdminController.php
namespace Tutorial\BlogBundle\Controller;

use Sonata\AdminBundle\Controller\CRUDController as Controller;

class PostAdminController extends Controller
{

}

4.3. TagAdminController

<?php
// src/Tutorial/BlogBundle/Controller/TagAdminController.php
namespace Tutorial\BlogBundle\Controller;

use Sonata\AdminBundle\Controller\CRUDController as Controller;

class TagAdminController extends Controller
{

}

When the controller class is instantiated, the admin class is attached to the controller.

Let’s create the admin classes ...

Found a typo? Something is wrong in this documentation? Just fork and edit it!