@@ -21,11 +21,11 @@ discard block |
||
21 | 21 | private $formBuilder; |
22 | 22 | |
23 | 23 | |
24 | - public function getFormatValue($value){ |
|
25 | - if(!$value){ |
|
24 | + public function getFormatValue($value) { |
|
25 | + if (!$value) { |
|
26 | 26 | return null; |
27 | 27 | } |
28 | - if(!$this->formBuilder->getOption('class')){ |
|
28 | + if (!$this->formBuilder->getOption('class')) { |
|
29 | 29 | return $value; |
30 | 30 | } |
31 | 31 | |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | * Если значение число, то пытаемся найти его по ID. |
56 | 56 | * Если значение не число, то ищем его по полю name |
57 | 57 | */ |
58 | - if(is_numeric($value)){ |
|
58 | + if (is_numeric($value)) { |
|
59 | 59 | $value = $repo->find($value); |
60 | 60 | } else { |
61 | 61 | try { |
@@ -3,9 +3,9 @@ |
||
3 | 3 | |
4 | 4 | namespace Doctrs\SonataImportBundle\Service\SonataImportType; |
5 | 5 | |
6 | -class BooleanType implements ImportInterface{ |
|
6 | +class BooleanType implements ImportInterface { |
|
7 | 7 | |
8 | - public function getFormatValue($value){ |
|
8 | + public function getFormatValue($value) { |
|
9 | 9 | return filter_var($value, FILTER_VALIDATE_BOOLEAN); |
10 | 10 | } |
11 | 11 |
@@ -4,6 +4,6 @@ |
||
4 | 4 | |
5 | 5 | use Sonata\AdminBundle\Admin\AbstractAdmin; |
6 | 6 | |
7 | -interface AdminAbstractAwareInterface{ |
|
7 | +interface AdminAbstractAwareInterface { |
|
8 | 8 | public function setAdminAbstract(AbstractAdmin $abstractAdmin); |
9 | 9 | } |
@@ -4,6 +4,6 @@ |
||
4 | 4 | |
5 | 5 | use Symfony\Component\Form\FormBuilderInterface; |
6 | 6 | |
7 | -interface FormBuilderAwareInterface{ |
|
7 | +interface FormBuilderAwareInterface { |
|
8 | 8 | public function setFormBuilder(FormBuilderInterface $formBuilder); |
9 | 9 | } |
@@ -3,9 +3,9 @@ |
||
3 | 3 | |
4 | 4 | namespace Doctrs\SonataImportBundle\Service\SonataImportType; |
5 | 5 | |
6 | -class IntegerType implements ImportInterface{ |
|
6 | +class IntegerType implements ImportInterface { |
|
7 | 7 | |
8 | - public function getFormatValue($value){ |
|
8 | + public function getFormatValue($value) { |
|
9 | 9 | return (int)$value; |
10 | 10 | } |
11 | 11 |
@@ -3,9 +3,9 @@ |
||
3 | 3 | |
4 | 4 | namespace Doctrs\SonataImportBundle\Service\SonataImportType; |
5 | 5 | |
6 | -class DateType implements ImportInterface{ |
|
6 | +class DateType implements ImportInterface { |
|
7 | 7 | |
8 | - public function getFormatValue($value){ |
|
8 | + public function getFormatValue($value) { |
|
9 | 9 | return $value ? new \DateTime($value) : null; |
10 | 10 | } |
11 | 11 |
@@ -191,10 +191,10 @@ |
||
191 | 191 | |
192 | 192 | $class = $this->getContainer()->get($item['class']); |
193 | 193 | |
194 | - if($class instanceof AdminAbstractAwareInterface){ |
|
194 | + if ($class instanceof AdminAbstractAwareInterface) { |
|
195 | 195 | $class->setAdminAbstract($admin); |
196 | 196 | } |
197 | - if($class instanceof FormBuilderAwareInterface){ |
|
197 | + if ($class instanceof FormBuilderAwareInterface) { |
|
198 | 198 | $class->setFormBuilder($formBuilder); |
199 | 199 | } |
200 | 200 |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | * @param array $config |
37 | 37 | * @param ContainerBuilder $container |
38 | 38 | */ |
39 | - private function prepairConfig(array $config, ContainerBuilder $container){ |
|
39 | + private function prepairConfig(array $config, ContainerBuilder $container) { |
|
40 | 40 | $this->container = $container; |
41 | 41 | |
42 | 42 | $this->prepareConfigMappings($config); |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | 'doctrs_sonata_import.encode.list' => $config['encode']['list'] |
52 | 52 | ]; |
53 | 53 | |
54 | - foreach($parametersArray as $parameterKey => $value){ |
|
54 | + foreach ($parametersArray as $parameterKey => $value) { |
|
55 | 55 | $container->setParameter($parameterKey, $value); |
56 | 56 | } |
57 | 57 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | /** |
60 | 60 | * @param array $config |
61 | 61 | */ |
62 | - private function prepareConfigUploadDir(array &$config){ |
|
62 | + private function prepareConfigUploadDir(array &$config) { |
|
63 | 63 | $config['upload_dir'] = $config['upload_dir'] ? |
64 | 64 | $config['upload_dir'] : $this->container->get('kernel')->getRootDir() . '/../web/uploads'; |
65 | 65 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | /** |
68 | 68 | * @param array $config |
69 | 69 | */ |
70 | - private function prepareConfigEncode(array &$config){ |
|
70 | + private function prepareConfigEncode(array &$config) { |
|
71 | 71 | if (!isset($config['encode'])) { |
72 | 72 | $config['encode'] = [ |
73 | 73 | 'default' => 'utf8', |
@@ -79,23 +79,23 @@ discard block |
||
79 | 79 | /** |
80 | 80 | * @param array $config |
81 | 81 | */ |
82 | - private function prepareConfigMappings(array &$config){ |
|
82 | + private function prepareConfigMappings(array &$config) { |
|
83 | 83 | $config['mappings'] = array_merge($config['mappings'], [[ |
84 | 84 | 'name' => 'date', |
85 | 85 | 'class' => 'doctrs.type.datetime' |
86 | - ],[ |
|
86 | + ], [ |
|
87 | 87 | 'name' => 'datetime', |
88 | 88 | 'class' => 'doctrs.type.datetime' |
89 | - ],[ |
|
89 | + ], [ |
|
90 | 90 | 'name' => 'boolean', |
91 | 91 | 'class' => 'doctrs.type.boolean' |
92 | - ],[ |
|
92 | + ], [ |
|
93 | 93 | 'name' => 'integer', |
94 | 94 | 'class' => 'doctrs.type.integer' |
95 | - ],[ |
|
95 | + ], [ |
|
96 | 96 | 'name' => 'entity', |
97 | 97 | 'class' => 'doctrs.type.entity' |
98 | - ],[ |
|
98 | + ], [ |
|
99 | 99 | 'name' => 'choice', |
100 | 100 | 'class' => 'doctrs.type.entity' |
101 | 101 | ]]); |