123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- <?php
- /*
- * This file is part of the Sonata package.
- *
- * (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
- namespace Sonata\UserBundle\Admin\Entity;
- use Sonata\AdminBundle\Admin\Admin;
- use Sonata\AdminBundle\Form\FormMapper;
- use Sonata\AdminBundle\Datagrid\DatagridMapper;
- use Sonata\AdminBundle\Datagrid\ListMapper;
- use Sonata\AdminBundle\Route\RouteCollection;
- class GroupAdmin extends Admin
- {
- protected $formOptions = array(
- 'validation_groups' => 'Registration'
- );
- public function getNewInstance()
- {
- $class = $this->getClass();
- return new $class('', array());
- }
- protected function configureListFields(ListMapper $listMapper)
- {
- $listMapper
- ->addIdentifier('name')
- ->add('roles')
- ;
- }
- protected function configureDatagridFilters(DatagridMapper $datagridMapper)
- {
- $datagridMapper
- ->add('name')
- ;
- }
- protected function configureFormFields(FormMapper $formMapper)
- {
- $formMapper
- ->add('name')
- ->add('roles', 'sonata_security_roles', array( 'multiple' => true, 'required' => false))
- ;
- }
- }
|