All pastes #2108937 Raw Edit

Anonymous

public php v1 · immutable
#2108937 ·published 2012-02-02 06:13 UTC
rendered paste body
<?phpnamespace Politistream\AdminBundle\Admin\Core;use Sonata\AdminBundle\Admin\Admin;use Sonata\AdminBundle\Datagrid\ListMapper;use Sonata\AdminBundle\Datagrid\DatagridMapper;use Sonata\AdminBundle\Validator\ErrorElement;use Sonata\AdminBundle\Form\FormMapper;use Politistream\CoreBundle\Form\Type\ProfileConfigurationType;use Politistream\CoreBundle\Entity\Profile;class ProfileRuleAdmin extends Admin{  protected function configureFormFields(FormMapper $formMapper)  {    $targetProfileTypes = array(Profile::PROFILE_TYPE_PARTY =>  Profile::PROFILE_TYPE_PARTY, Profile::PROFILE_TYPE_USER => Profile::PROFILE_TYPE_USER);        $formMapper            ->add('target_profile_type', 'choice', array('choices' => $targetProfileTypes))            ->add('rule', 'profile_rule', array('label' => '', 'required' => false))            ->add('configurations', 'collection', array('type' => new ProfileConfigurationType(), 'required' => false, 'allow_add' => true, 'by_reference' => false,))    ;  }  protected function configureListFields(ListMapper $listMapper)  {    $listMapper            ->addIdentifier('target_profile_type')            ->addIdentifier('rule')    ;  }  public function validate(ErrorElement $errorElement, $object)  {    $errorElement            ->end()    ;  }}