| Total Complexity | 6 |
| Total Lines | 69 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 18 | class StaticReferenceAdmin extends Admin |
||
|
|
|||
| 19 | { |
||
| 20 | /** |
||
| 21 | * @{inheritDoc} |
||
| 22 | */ |
||
| 23 | public function configureListFields(ListMapper $listMapper) |
||
| 24 | { |
||
| 25 | $listMapper |
||
| 26 | ->add('machine_name') |
||
| 27 | ->add( |
||
| 28 | '_action', |
||
| 29 | 'actions', |
||
| 30 | array( |
||
| 31 | 'actions' => array( |
||
| 32 | 'show' => array(), |
||
| 33 | 'edit' => array(), |
||
| 34 | 'delete' => array() |
||
| 35 | ) |
||
| 36 | ) |
||
| 37 | ); |
||
| 38 | } |
||
| 39 | |||
| 40 | /** |
||
| 41 | * @{inheritDoc} |
||
| 42 | */ |
||
| 43 | protected function configureFormFields(FormMapper $form) |
||
| 44 | { |
||
| 45 | if ($this->getSubject()->getId()) { |
||
| 46 | $form |
||
| 47 | ->add('machine_name') |
||
| 48 | ->add( |
||
| 49 | 'translations', |
||
| 50 | 'sonata_type_collection', |
||
| 51 | array(), |
||
| 52 | array( |
||
| 53 | 'edit' => 'inline', |
||
| 54 | 'inline' => 'table', |
||
| 55 | ) |
||
| 56 | ); |
||
| 57 | } else { |
||
| 58 | $form |
||
| 59 | ->add('machine_name'); |
||
| 60 | } |
||
| 61 | } |
||
| 62 | |||
| 63 | /** |
||
| 64 | * @{inheritDoc} |
||
| 65 | */ |
||
| 66 | protected function configureShowFields(ShowMapper $show) |
||
| 67 | { |
||
| 68 | $show |
||
| 69 | ->add('machine_name') |
||
| 70 | ->add('url'); |
||
| 71 | } |
||
| 72 | |||
| 73 | /** |
||
| 74 | * @{inheritDoc} |
||
| 75 | */ |
||
| 76 | public function prePersist($object) |
||
| 77 | { |
||
| 78 | $object->addMissingTranslations(); |
||
| 79 | } |
||
| 80 | |||
| 81 | /** |
||
| 82 | * @{inheritDoc} |
||
| 83 | */ |
||
| 84 | public function preUpdate($object) |
||
| 87 | } |
||
| 88 | } |
||
| 89 |