@@ -42,7 +42,7 @@  | 
                                                    ||
| 42 | 42 | * ActionConfiguration constructor.  | 
                                                        
| 43 | 43 | *  | 
                                                        
| 44 | 44 | * @param string $actionName  | 
                                                        
| 45 | - * @param $adminName  | 
                                                        |
| 45 | + * @param string $adminName  | 
                                                        |
| 46 | 46 | * @param AdminConfiguration $adminConfiguration  | 
                                                        
| 47 | 47 | */  | 
                                                        
| 48 | 48 | public function __construct($actionName, $adminName, AdminConfiguration $adminConfiguration)  | 
                                                        
@@ -15,11 +15,11 @@  | 
                                                    ||
| 15 | 15 | |
| 16 | 16 | class ActionConfiguration extends Configuration  | 
                                                        
| 17 | 17 |  { | 
                                                        
| 18 | - /**  | 
                                                        |
| 19 | - * Related Action name.  | 
                                                        |
| 20 | - *  | 
                                                        |
| 21 | - * @var string  | 
                                                        |
| 22 | - */  | 
                                                        |
| 18 | + /**  | 
                                                        |
| 19 | + * Related Action name.  | 
                                                        |
| 20 | + *  | 
                                                        |
| 21 | + * @var string  | 
                                                        |
| 22 | + */  | 
                                                        |
| 23 | 23 | private $actionName;  | 
                                                        
| 24 | 24 | |
| 25 | 25 | /**  | 
                                                        
@@ -164,7 +164,7 @@ discard block  | 
                                                    ||
| 164 | 164 | */  | 
                                                        
| 165 | 165 | private function getFieldsNormalizer()  | 
                                                        
| 166 | 166 |      { | 
                                                        
| 167 | -        return function (Options $options, $fields) { | 
                                                        |
| 167 | +        return function(Options $options, $fields) { | 
                                                        |
| 168 | 168 | $normalizedFields = [];  | 
                                                        
| 169 | 169 | |
| 170 | 170 |              foreach ($fields as $name => $field) { | 
                                                        
@@ -187,7 +187,7 @@ discard block  | 
                                                    ||
| 187 | 187 | */  | 
                                                        
| 188 | 188 | private function getOrderNormalizer()  | 
                                                        
| 189 | 189 |      { | 
                                                        
| 190 | -        return function (Options $options, $order) { | 
                                                        |
| 190 | +        return function(Options $options, $order) { | 
                                                        |
| 191 | 191 |              foreach ($order as $field => $sort) { | 
                                                        
| 192 | 192 | |
| 193 | 193 |                  if (!is_string($sort) || !is_string($field) || !in_array(strtolower($sort), ['asc', 'desc'])) { | 
                                                        
@@ -211,7 +211,7 @@ discard block  | 
                                                    ||
| 211 | 211 | */  | 
                                                        
| 212 | 212 | private function getLoadStrategyNormalizer()  | 
                                                        
| 213 | 213 |      { | 
                                                        
| 214 | -        return function (Options $options, $value) { | 
                                                        |
| 214 | +        return function(Options $options, $value) { | 
                                                        |
| 215 | 215 |              if (!$value) { | 
                                                        
| 216 | 216 |                  if ($this->actionName == 'create') { | 
                                                        
| 217 | 217 | $value = LAGAdminBundle::LOAD_STRATEGY_NONE;  | 
                                                        
@@ -234,7 +234,7 @@ discard block  | 
                                                    ||
| 234 | 234 | */  | 
                                                        
| 235 | 235 | private function getMenuNormalizer()  | 
                                                        
| 236 | 236 |      { | 
                                                        
| 237 | -        return function (Options $options, $menus) { | 
                                                        |
| 237 | +        return function(Options $options, $menus) { | 
                                                        |
| 238 | 238 | // set default to an array  | 
                                                        
| 239 | 239 |              if ($menus === false) { | 
                                                        
| 240 | 240 | $menus = [];  | 
                                                        
@@ -252,7 +252,7 @@ discard block  | 
                                                    ||
| 252 | 252 | */  | 
                                                        
| 253 | 253 | private function getCriteriaNormalizer()  | 
                                                        
| 254 | 254 |      { | 
                                                        
| 255 | -        return function (Options $options, $value) { | 
                                                        |
| 255 | +        return function(Options $options, $value) { | 
                                                        |
| 256 | 256 |              if (!$value) { | 
                                                        
| 257 | 257 | $idActions = [  | 
                                                        
| 258 | 258 | 'edit',  | 
                                                        
@@ -302,7 +302,7 @@ discard block  | 
                                                    ||
| 302 | 302 | */  | 
                                                        
| 303 | 303 | private function getBatchNormalizer()  | 
                                                        
| 304 | 304 |      { | 
                                                        
| 305 | -        return function (Options $options, $batch) { | 
                                                        |
| 305 | +        return function(Options $options, $batch) { | 
                                                        |
| 306 | 306 | // if batch is not activated, no more checks should be done  | 
                                                        
| 307 | 307 |              if ($batch === false) { | 
                                                        
| 308 | 308 | return $batch;  | 
                                                        
@@ -349,7 +349,7 @@ discard block  | 
                                                    ||
| 349 | 349 | */  | 
                                                        
| 350 | 350 | private function getFiltersNormalizer()  | 
                                                        
| 351 | 351 |      { | 
                                                        
| 352 | -        return function (Options $options, $data) { | 
                                                        |
| 352 | +        return function(Options $options, $data) { | 
                                                        |
| 353 | 353 | $normalizedData = [];  | 
                                                        
| 354 | 354 | |
| 355 | 355 |              foreach ($data as $name => $field) { | 
                                                        
@@ -375,7 +375,7 @@ discard block  | 
                                                    ||
| 375 | 375 | |
| 376 | 376 | private function getRouteDefaultNormalizer()  | 
                                                        
| 377 | 377 |      { | 
                                                        
| 378 | -        return function (Options $options, $value) { | 
                                                        |
| 378 | +        return function(Options $options, $value) { | 
                                                        |
| 379 | 379 |              if (!is_array($value)) { | 
                                                        
| 380 | 380 | $value = [];  | 
                                                        
| 381 | 381 | }  | 
                                                        
@@ -143,7 +143,7 @@  | 
                                                    ||
| 143 | 143 | }  | 
                                                        
| 144 | 144 | |
| 145 | 145 | /**  | 
                                                        
| 146 | - * @param $name  | 
                                                        |
| 146 | + * @param string $name  | 
                                                        |
| 147 | 147 | * @param $type  | 
                                                        
| 148 | 148 | *  | 
                                                        
| 149 | 149 | * @return FieldInterface  | 
                                                        
@@ -3,13 +3,11 @@  | 
                                                    ||
| 3 | 3 | namespace LAG\AdminBundle\Factory;  | 
                                                        
| 4 | 4 | |
| 5 | 5 | use Exception;  | 
                                                        
| 6 | -use LAG\AdminBundle\Admin\Exception\AdminException;  | 
                                                        |
| 7 | 6 | use LAG\AdminBundle\Configuration\ActionConfiguration;  | 
                                                        
| 8 | 7 | use LAG\AdminBundle\Configuration\ApplicationConfiguration;  | 
                                                        
| 9 | 8 | use LAG\AdminBundle\Configuration\ApplicationConfigurationStorage;  | 
                                                        
| 10 | 9 | use LAG\AdminBundle\Field\FieldInterface;  | 
                                                        
| 11 | 10 | use LAG\AdminBundle\Field\TwigAwareFieldInterface;  | 
                                                        
| 12 | -use LAG\AdminBundle\Field\TwigAwareInterface;  | 
                                                        |
| 13 | 11 | use LAG\AdminBundle\Field\TranslatorAwareFieldInterface;  | 
                                                        
| 14 | 12 | use Symfony\Component\OptionsResolver\OptionsResolver;  | 
                                                        
| 15 | 13 | use Symfony\Component\Translation\TranslatorInterface;  | 
                                                        
@@ -64,8 +64,8 @@  | 
                                                    ||
| 64 | 64 | /**  | 
                                                        
| 65 | 65 | * View constructor.  | 
                                                        
| 66 | 66 | *  | 
                                                        
| 67 | - * @param $actionName  | 
                                                        |
| 68 | - * @param $adminName  | 
                                                        |
| 67 | + * @param string $actionName  | 
                                                        |
| 68 | + * @param string $adminName  | 
                                                        |
| 69 | 69 | * @param ActionConfiguration $configuration  | 
                                                        
| 70 | 70 | * @param AdminConfiguration $adminConfiguration  | 
                                                        
| 71 | 71 | * @param FieldInterface[] $fields  | 
                                                        
@@ -79,7 +79,7 @@ discard block  | 
                                                    ||
| 79 | 79 |              ->setAllowedTypes('routing_name_pattern', 'string') | 
                                                        
| 80 | 80 |              ->setAllowedTypes('routing_url_pattern', 'string') | 
                                                        
| 81 | 81 |              ->setAllowedTypes('page_parameter', 'string') | 
                                                        
| 82 | -            ->setNormalizer('routing_name_pattern', function (Options $options, $value) { | 
                                                        |
| 82 | +            ->setNormalizer('routing_name_pattern', function(Options $options, $value) { | 
                                                        |
| 83 | 83 |                  if (strstr($value, '{admin}') === false) { | 
                                                        
| 84 | 84 | throw new InvalidOptionsException(  | 
                                                        
| 85 | 85 |                          'Admin routing configuration pattern name should contains the {admin} placeholder' | 
                                                        
@@ -93,7 +93,7 @@ discard block  | 
                                                    ||
| 93 | 93 | |
| 94 | 94 | return $value;  | 
                                                        
| 95 | 95 | })  | 
                                                        
| 96 | -            ->setNormalizer('routing_url_pattern', function (Options $options, $value) { | 
                                                        |
| 96 | +            ->setNormalizer('routing_url_pattern', function(Options $options, $value) { | 
                                                        |
| 97 | 97 |                  if (strstr($value, '{admin}') === false) { | 
                                                        
| 98 | 98 |                      throw new InvalidOptionsException('Admin routing configuration url pattern should contains {admin} placeholder'); | 
                                                        
| 99 | 99 | }  | 
                                                        
@@ -76,7 +76,7 @@  | 
                                                    ||
| 76 | 76 | null,  | 
                                                        
| 77 | 77 | 'pagerfanta',  | 
                                                        
| 78 | 78 | ])  | 
                                                        
| 79 | -            ->setNormalizer('actions', function (Options $options, $actions) { | 
                                                        |
| 79 | +            ->setNormalizer('actions', function(Options $options, $actions) { | 
                                                        |
| 80 | 80 | $normalizedActions = [];  | 
                                                        
| 81 | 81 | $addBatchAction = false;  | 
                                                        
| 82 | 82 | |
@@ -46,7 +46,7 @@ discard block  | 
                                                    ||
| 46 | 46 | '_self',  | 
                                                        
| 47 | 47 | '_blank',  | 
                                                        
| 48 | 48 | ])  | 
                                                        
| 49 | -            ->setNormalizer('route', function (Options $options, $value) use ($actionConfiguration) { | 
                                                        |
| 49 | +            ->setNormalizer('route', function(Options $options, $value) use ($actionConfiguration) { | 
                                                        |
| 50 | 50 | // route or url should be defined  | 
                                                        
| 51 | 51 |                  if (!$value && !$options->offsetGet('url') && !$options->offsetGet('admin')) { | 
                                                        
| 52 | 52 | throw new InvalidOptionsException(  | 
                                                        
@@ -64,7 +64,7 @@ discard block  | 
                                                    ||
| 64 | 64 | |
| 65 | 65 | return $value;  | 
                                                        
| 66 | 66 | })  | 
                                                        
| 67 | -            ->setNormalizer('admin', function (Options $options, $value) { | 
                                                        |
| 67 | +            ->setNormalizer('admin', function(Options $options, $value) { | 
                                                        |
| 68 | 68 | // if a Admin is defined, an Action should be defined too  | 
                                                        
| 69 | 69 |                  if ($value && !$options->offsetGet('action')) { | 
                                                        
| 70 | 70 | throw new InvalidOptionsException(  | 
                                                        
@@ -74,7 +74,7 @@ discard block  | 
                                                    ||
| 74 | 74 | |
| 75 | 75 | return $value;  | 
                                                        
| 76 | 76 | })  | 
                                                        
| 77 | -            ->setNormalizer('parameters', function (Options $options, $values) { | 
                                                        |
| 77 | +            ->setNormalizer('parameters', function(Options $options, $values) { | 
                                                        |
| 78 | 78 | $cleanedValues = [];  | 
                                                        
| 79 | 79 | |
| 80 | 80 |                  foreach ($values as $name => $method) { | 
                                                        
@@ -26,6 +26,6 @@  | 
                                                    ||
| 26 | 26 | $value = $this->options['map'][$value];  | 
                                                        
| 27 | 27 | }  | 
                                                        
| 28 | 28 | |
| 29 | - return (string)$value;  | 
                                                        |
| 29 | + return (string) $value;  | 
                                                        |
| 30 | 30 | }  | 
                                                        
| 31 | 31 | }  | 
                                                        
@@ -18,7 +18,7 @@ discard block  | 
                                                    ||
| 18 | 18 | 'copy' => [],  | 
                                                        
| 19 | 19 | ];  | 
                                                        
| 20 | 20 | $eventDispatcher = new EventDispatcher();  | 
                                                        
| 21 | -$eventDispatcher->addListener(NotificationEvent::NAME, function (NotificationEvent $event) { | 
                                                        |
| 21 | +$eventDispatcher->addListener(NotificationEvent::NAME, function(NotificationEvent $event) { | 
                                                        |
| 22 | 22 | echo $event->getMessage()."\n";  | 
                                                        
| 23 | 23 | });  | 
                                                        
| 24 | 24 | |
@@ -68,7 +68,7 @@ discard block  | 
                                                    ||
| 68 | 68 | $builder = new TaskBuilder();  | 
                                                        
| 69 | 69 | $tasks = $builder->build($tasks);  | 
                                                        
| 70 | 70 | |
| 71 | -$normalizer = new Normalizer(realpath(__DIR__ . '/AdminBundle'));  | 
                                                        |
| 71 | +$normalizer = new Normalizer(realpath(__DIR__.'/AdminBundle'));  | 
                                                        |
| 72 | 72 | $locator = new Locator($normalizer);  | 
                                                        
| 73 | 73 | |
| 74 | 74 | $runner = new TaskRunner(  | 
                                                        
@@ -117,6 +117,9 @@ discard block  | 
                                                    ||
| 117 | 117 | ];  | 
                                                        
| 118 | 118 | }  | 
                                                        
| 119 | 119 | |
| 120 | + /**  | 
                                                        |
| 121 | + * @param string $adminName  | 
                                                        |
| 122 | + */  | 
                                                        |
| 120 | 123 | private function addDefaultTopMenu(array &$configuration, $adminName)  | 
                                                        
| 121 | 124 |      { | 
                                                        
| 122 | 125 |          if (!$this->applicationConfiguration->getParameter('enable_menus')) { | 
                                                        
@@ -151,6 +154,10 @@ discard block  | 
                                                    ||
| 151 | 154 | ];  | 
                                                        
| 152 | 155 | }  | 
                                                        
| 153 | 156 | |
| 157 | + /**  | 
                                                        |
| 158 | + * @param string $entityClass  | 
                                                        |
| 159 | + * @param string $adminName  | 
                                                        |
| 160 | + */  | 
                                                        |
| 154 | 161 | private function addDefaultFields(array &$configuration, $entityClass, $adminName)  | 
                                                        
| 155 | 162 |      { | 
                                                        
| 156 | 163 | $fieldsMapping = [  | 
                                                        
@@ -429,6 +436,9 @@ discard block  | 
                                                    ||
| 429 | 436 | return $metadata;  | 
                                                        
| 430 | 437 | }  | 
                                                        
| 431 | 438 | |
| 439 | + /**  | 
                                                        |
| 440 | + * @param string $type  | 
                                                        |
| 441 | + */  | 
                                                        |
| 432 | 442 | private function getOperatorFromFieldType($type)  | 
                                                        
| 433 | 443 |      { | 
                                                        
| 434 | 444 | $mapping = [  |