1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- <?php
- namespace WorkflowBundle\Admin;
- use Base\AdminBundle\Admin\BaseAdmin;
- use Sonata\AdminBundle\Datagrid\DatagridMapper;
- use Sonata\AdminBundle\Datagrid\ListMapper;
- use Sonata\AdminBundle\Form\FormMapper;
- use Sonata\AdminBundle\Show\ShowMapper;
- use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
- use \WorkflowBundle\Utils\DoctrineEvents;
- use \WorkflowBundle\Utils\WorkFlowEntityClasses;
- class Doctrine2WorkFlowActionAdmin extends BaseAdmin
- {
- /**
- * @param DatagridMapper $datagridMapper
- */
- protected function configureDatagridFilters(DatagridMapper $datagridMapper)
- {
- $datagridMapper
- ->add('name')
- ->add('eventName')
- ->add('entityClass')
- ;
- }
- /**
- * @param ListMapper $listMapper
- */
- protected function configureListFields(ListMapper $listMapper)
- {
- $listMapper
- ->add('name')
- ->add('eventName')
- ->add('entityClass')
- ->add('actions')
- ->add('_action', null, array(
- 'actions' => array(
- 'show' => array(),
- 'edit' => array(),
- 'delete' => array(),
- )
- ))
- ;
- }
- /**
- * @param FormMapper $formMapper
- */
- protected function configureFormFields(FormMapper $formMapper)
- {
- $formMapper
- ->add('name')
- ->add('eventName', ChoiceType::class, array(
- 'choices' => DoctrineEvents::getDoctrineEventChoices(),
- ))
- ->add('entityClass', ChoiceType::class, array(
- 'choices' => WorkFlowEntityClasses::getChoices(),
- ))
- ->add('actions', null, array(
- 'multiple' => true,
- 'expanded' => true,
- 'by_reference' => false
- ))
- ;
- }
- /**
- * @param ShowMapper $showMapper
- */
- protected function configureShowFields(ShowMapper $showMapper)
- {
- $showMapper
- ->add('name')
- ->add('eventName')
- ->add('entityClass')
- ->add('actions')
- ;
- }
- }
|