|
@@ -0,0 +1,56 @@
|
|
1
|
+<?php
|
|
2
|
+
|
|
3
|
+namespace Muzich\AdminBundle\Admin;
|
|
4
|
+
|
|
5
|
+use Sonata\AdminBundle\Admin\Admin;
|
|
6
|
+use Sonata\AdminBundle\Form\FormMapper;
|
|
7
|
+use Sonata\AdminBundle\Datagrid\DatagridMapper;
|
|
8
|
+use Sonata\AdminBundle\Datagrid\ListMapper;
|
|
9
|
+
|
|
10
|
+class GroupAdmin extends Admin
|
|
11
|
+{
|
|
12
|
+
|
|
13
|
+ protected function configureListFields(ListMapper $listMapper)
|
|
14
|
+ {
|
|
15
|
+ $listMapper
|
|
16
|
+ ->addIdentifier('name')
|
|
17
|
+ ->add('open')
|
|
18
|
+ ->add('owner', 'many_to_one')
|
|
19
|
+ ->add('tags')
|
|
20
|
+ ->add('_action', 'actions', array(
|
|
21
|
+ 'actions' => array(
|
|
22
|
+ 'view' => array(),
|
|
23
|
+ 'edit' => array(),
|
|
24
|
+ )
|
|
25
|
+ ))
|
|
26
|
+ ;
|
|
27
|
+ }
|
|
28
|
+
|
|
29
|
+ protected function configureDatagridFilters(DatagridMapper $datagrid)
|
|
30
|
+ {
|
|
31
|
+ $datagrid
|
|
32
|
+ ->add('name')
|
|
33
|
+ ->add('tags')
|
|
34
|
+ ;
|
|
35
|
+ }
|
|
36
|
+
|
|
37
|
+ protected function configureFormFields(FormMapper $formMapper)
|
|
38
|
+ {
|
|
39
|
+ $formMapper
|
|
40
|
+ ->add('name')
|
|
41
|
+ ->add('description')
|
|
42
|
+ ->add('open', null, array('required' => false))
|
|
43
|
+ ->add('owner', 'sonata_type_model', array(), array('edit' => 'list'))
|
|
44
|
+ // Attention, il semble que le lien pointe vers des records de la table de relation
|
|
45
|
+ // il faudra utiliser le many to many, quand j'y arriverai ...
|
|
46
|
+ //->add('tags', null, array('required' => false))
|
|
47
|
+
|
|
48
|
+ ;
|
|
49
|
+ }
|
|
50
|
+
|
|
51
|
+// public function validate(ErrorElement $errorElement, $object)
|
|
52
|
+// {
|
|
53
|
+//
|
|
54
|
+// }
|
|
55
|
+
|
|
56
|
+}
|