@@ -26,8 +26,8 @@ discard block |
||
| 26 | 26 | ]); |
| 27 | 27 | $form->handleRequest($request); |
| 28 | 28 | |
| 29 | - if($form->isValid()){ |
|
| 30 | - if(!$fileEntity->getFile()->getError()) { |
|
| 29 | + if ($form->isValid()) { |
|
| 30 | + if (!$fileEntity->getFile()->getError()) { |
|
| 31 | 31 | $fileEntity->move($this->getParameter('doctrs_sonata_import.upload_dir')); |
| 32 | 32 | |
| 33 | 33 | $this->getDoctrine()->getManager()->persist($fileEntity); |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | * @param UploadFile $uploadFile |
| 62 | 62 | * @return JsonResponse|\Symfony\Component\HttpFoundation\Response |
| 63 | 63 | */ |
| 64 | - public function uploadAction(Request $request, UploadFile $uploadFile){ |
|
| 64 | + public function uploadAction(Request $request, UploadFile $uploadFile) { |
|
| 65 | 65 | $em = $this->getDoctrine()->getManager(); |
| 66 | 66 | |
| 67 | 67 | $countImport = $em->getRepository('DoctrsSonataImportBundle:ImportLog')->count([ |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | * @param UploadFile $uploadFile |
| 88 | 88 | * @return JsonResponse |
| 89 | 89 | */ |
| 90 | - public function importStatusAction(UploadFile $uploadFile){ |
|
| 90 | + public function importStatusAction(UploadFile $uploadFile) { |
|
| 91 | 91 | $countImport = $this->getDoctrine()->getManager()->getRepository('DoctrsSonataImportBundle:ImportLog')->count([ |
| 92 | 92 | 'uploadFile' => $uploadFile->getId() |
| 93 | 93 | ]); |
@@ -103,10 +103,10 @@ discard block |
||
| 103 | 103 | * get array from A to ZZ |
| 104 | 104 | * @return array |
| 105 | 105 | */ |
| 106 | - private function getLetterArray(){ |
|
| 106 | + private function getLetterArray() { |
|
| 107 | 107 | $array = range('A', 'Z'); |
| 108 | 108 | $letters = $array; |
| 109 | - foreach($array as $first) { |
|
| 109 | + foreach ($array as $first) { |
|
| 110 | 110 | foreach ($array as $second) { |
| 111 | 111 | $letters[] = $first . $second; |
| 112 | 112 | } |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | /** |
| 118 | 118 | * @param UploadFile $fileEntity |
| 119 | 119 | */ |
| 120 | - private function runCommand(UploadFile $fileEntity){ |
|
| 120 | + private function runCommand(UploadFile $fileEntity) { |
|
| 121 | 121 | $command = sprintf( |
| 122 | 122 | '/usr/bin/php %s/console doctrs:sonata:import %d "%s" "%s" %d > /dev/null 2>&1 &', |
| 123 | 123 | $this->get('kernel')->getRootDir(), |
@@ -7,12 +7,12 @@ |
||
| 7 | 7 | use Doctrine\ORM\EntityRepository; |
| 8 | 8 | use Symfony\Component\HttpFoundation\Request; |
| 9 | 9 | |
| 10 | -class DefaultRepository extends EntityRepository{ |
|
| 10 | +class DefaultRepository extends EntityRepository { |
|
| 11 | 11 | |
| 12 | - public function pagerfanta(Request $request){ |
|
| 12 | + public function pagerfanta(Request $request) { |
|
| 13 | 13 | $sql = $this->createQueryBuilder('data'); |
| 14 | 14 | $sql->select('data'); |
| 15 | - switch($request->get('type', 'all')){ |
|
| 15 | + switch ($request->get('type', 'all')) { |
|
| 16 | 16 | case 'success': |
| 17 | 17 | $sql->where('data.status = 1 or data.status = 2'); |
| 18 | 18 | break; |
@@ -2,6 +2,6 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Doctrs\SonataImportBundle\Service; |
| 4 | 4 | |
| 5 | -interface ImportInterface{ |
|
| 5 | +interface ImportInterface { |
|
| 6 | 6 | public function getFormatValue($value); |
| 7 | 7 | } |
@@ -31,21 +31,20 @@ |
||
| 31 | 31 | * @param array $config |
| 32 | 32 | * @param ContainerBuilder $container |
| 33 | 33 | */ |
| 34 | - private function prepairConfig(array $config, ContainerBuilder $container){ |
|
| 34 | + private function prepairConfig(array $config, ContainerBuilder $container) { |
|
| 35 | 35 | $container->setParameter( |
| 36 | 36 | 'doctrs_sonata_import.mappings', |
| 37 | 37 | $config['mappings'] |
| 38 | 38 | ); |
| 39 | 39 | $container->setParameter( |
| 40 | 40 | 'doctrs_sonata_import.upload_dir', |
| 41 | - $config['upload_dir'] ? $config['upload_dir'] : |
|
| 42 | - $container->get('kernel')->getRootDir() . '/../web/uploads' |
|
| 41 | + $config['upload_dir'] ? $config['upload_dir'] : $container->get('kernel')->getRootDir() . '/../web/uploads' |
|
| 43 | 42 | ); |
| 44 | 43 | $container->setParameter( |
| 45 | 44 | 'doctrs_sonata_import.class_loaders', |
| 46 | 45 | $config['class_loaders'] |
| 47 | 46 | ); |
| 48 | - if(!isset($config['encode'])){ |
|
| 47 | + if (!isset($config['encode'])) { |
|
| 49 | 48 | $config['encode'] = [ |
| 50 | 49 | 'default' => 'utf8', |
| 51 | 50 | 'list' => [] |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | /** |
| 139 | 139 | * @return mixed |
| 140 | 140 | */ |
| 141 | - public function messageEncode(){ |
|
| 141 | + public function messageEncode() { |
|
| 142 | 142 | return json_decode($this->message); |
| 143 | 143 | } |
| 144 | 144 | |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | * @ORM\PreUpdate() |
| 194 | 194 | * @ORM\PrePersist() |
| 195 | 195 | */ |
| 196 | - public function prePersistUpdate(){ |
|
| 196 | + public function prePersistUpdate() { |
|
| 197 | 197 | $this->ts = new \DateTime(); |
| 198 | 198 | } |
| 199 | 199 | |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | * @param $foreignId |
| 202 | 202 | * @return ImportLog |
| 203 | 203 | */ |
| 204 | - public function setForeignId($foreignId){ |
|
| 204 | + public function setForeignId($foreignId) { |
|
| 205 | 205 | $this->foreignId = $foreignId; |
| 206 | 206 | |
| 207 | 207 | return $this; |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | /** |
| 211 | 211 | * @return int |
| 212 | 212 | */ |
| 213 | - public function getForeignId(){ |
|
| 213 | + public function getForeignId() { |
|
| 214 | 214 | return $this->foreignId; |
| 215 | 215 | } |
| 216 | 216 | |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | /** |
| 36 | 36 | * @return string |
| 37 | 37 | */ |
| 38 | - public function getBlockPrefix(){ |
|
| 38 | + public function getBlockPrefix() { |
|
| 39 | 39 | return $this->getName(); |
| 40 | 40 | } |
| 41 | 41 | |
@@ -33,14 +33,14 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | $default_encode = $this->container->getParameter('doctrs_sonata_import.encode.default'); |
| 35 | 35 | $encode_list = $this->container->getParameter('doctrs_sonata_import.encode.list'); |
| 36 | - if(!count($encode_list)){ |
|
| 36 | + if (!count($encode_list)) { |
|
| 37 | 37 | $builder->add('encode', HiddenType::class, [ |
| 38 | 38 | 'data' => $default_encode, |
| 39 | 39 | 'label' => 'form.encode' |
| 40 | 40 | ]); |
| 41 | 41 | } else { |
| 42 | 42 | $el = []; |
| 43 | - foreach($encode_list as $item){ |
|
| 43 | + foreach ($encode_list as $item) { |
|
| 44 | 44 | $el[$item] = $item; |
| 45 | 45 | } |
| 46 | 46 | $builder->add('encode', ChoiceType::class, [ |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | $loader = []; |
| 54 | 54 | $loaders_list = $this->container->getParameter('doctrs_sonata_import.class_loaders'); |
| 55 | - foreach($loaders_list as $key => $item){ |
|
| 55 | + foreach ($loaders_list as $key => $item) { |
|
| 56 | 56 | $loader[$key] = $item['name']; |
| 57 | 57 | } |
| 58 | 58 | $builder->add('loaderClass', ChoiceType::class, [ |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | /** |
| 84 | 84 | * @return string |
| 85 | 85 | */ |
| 86 | - public function getBlockPrefix(){ |
|
| 86 | + public function getBlockPrefix() { |
|
| 87 | 87 | return $this->getName(); |
| 88 | 88 | } |
| 89 | 89 | |
@@ -5,7 +5,7 @@ |
||
| 5 | 5 | |
| 6 | 6 | use Symfony\Component\HttpFoundation\File\File; |
| 7 | 7 | |
| 8 | -interface FileLoaderInterface{ |
|
| 8 | +interface FileLoaderInterface { |
|
| 9 | 9 | |
| 10 | 10 | public function setFile(File $file) : FileLoaderInterface; |
| 11 | 11 | public function getIteration(); |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | use Symfony\Component\HttpFoundation\File\File; |
| 7 | 7 | use Symfony\Component\Process\Exception\InvalidArgumentException; |
| 8 | 8 | |
| 9 | -class CsvFileLoader implements FileLoaderInterface{ |
|
| 9 | +class CsvFileLoader implements FileLoaderInterface { |
|
| 10 | 10 | |
| 11 | 11 | /** @var File $file */ |
| 12 | 12 | protected $file = null; |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | public function getIteration() { |
| 20 | - if(!$this->file){ |
|
| 20 | + if (!$this->file) { |
|
| 21 | 21 | throw new InvalidArgumentException('File not found'); |
| 22 | 22 | } |
| 23 | 23 | |