@@ -6,7 +6,7 @@ |
||
6 | 6 | /** |
7 | 7 | * @var Composer\Autoload\ClassLoader $loader |
8 | 8 | */ |
9 | -$loader = require __DIR__ . '/../app/autoload.php'; |
|
9 | +$loader = require __DIR__.'/../app/autoload.php'; |
|
10 | 10 | Debug::enable(); |
11 | 11 | |
12 | 12 | $kernel = new AppKernel('test', true); |
@@ -110,7 +110,7 @@ |
||
110 | 110 | * @return string |
111 | 111 | */ |
112 | 112 | protected function translate($id, $domain = null, array $parameters = []){ |
113 | - return $this->get('translator')->trans($id, $parameters, $domain); |
|
113 | + return $this->get('translator')->trans($id, $parameters, $domain); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | /** |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * |
87 | 87 | * @return array |
88 | 88 | */ |
89 | - protected function getFormErrors($form){ |
|
89 | + protected function getFormErrors($form) { |
|
90 | 90 | $errors = $this->get("starkerxp_structure.services.form_errors")->getFormErrors($form); |
91 | 91 | return $errors; |
92 | 92 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | * |
97 | 97 | * @return string |
98 | 98 | */ |
99 | - protected function getUuid(){ |
|
99 | + protected function getUuid() { |
|
100 | 100 | return (\Ramsey\Uuid\Uuid::uuid4())->toString(); |
101 | 101 | } |
102 | 102 | |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | * |
110 | 110 | * @return string |
111 | 111 | */ |
112 | - protected function translate($id, $domain = null, array $parameters = []){ |
|
112 | + protected function translate($id, $domain = null, array $parameters = []) { |
|
113 | 113 | return $this->get('translator')->trans($id, $parameters, $domain); |
114 | 114 | } |
115 | 115 | |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | * |
121 | 121 | * @return array|mixed |
122 | 122 | */ |
123 | - protected function getRequestData(Request $request){ |
|
123 | + protected function getRequestData(Request $request) { |
|
124 | 124 | $data = json_decode($request->getContent(), true); |
125 | 125 | if (empty($data)) { |
126 | 126 | $data = $request->request->all(); |
@@ -143,14 +143,14 @@ discard block |
||
143 | 143 | /** |
144 | 144 | * Vide l'UnitOfWork de l'entity manager. |
145 | 145 | */ |
146 | - public function clear(){ |
|
146 | + public function clear() { |
|
147 | 147 | $this->entityManager->clear(); |
148 | 148 | } |
149 | 149 | |
150 | 150 | /** |
151 | 151 | * Permet de passer en gestion des transations manuelles. (Conseillé par SensioLabs). |
152 | 152 | */ |
153 | - public function beginTransaction(){ |
|
153 | + public function beginTransaction() { |
|
154 | 154 | $this->modeTransactionnal = true; |
155 | 155 | $this->entityManager->beginTransaction(); |
156 | 156 | } |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | /** |
159 | 159 | * Dans le cas d'une gestion des transactions manuelles en cas d'échec on rollback le tout. |
160 | 160 | */ |
161 | - public function rollback(){ |
|
161 | + public function rollback() { |
|
162 | 162 | $this->entityManager->rollback(); |
163 | 163 | $this->entityManager->close(); |
164 | 164 | $this->modeTransactionnal = false; |
@@ -167,8 +167,8 @@ discard block |
||
167 | 167 | /** |
168 | 168 | * Permet de gérer un flush en mode transactions manuelles. |
169 | 169 | */ |
170 | - private function flush(){ |
|
171 | - if($this->modeTransactionnal){ |
|
170 | + private function flush() { |
|
171 | + if ($this->modeTransactionnal) { |
|
172 | 172 | $this->entityManager->commit(); |
173 | 173 | } |
174 | 174 | $this->entityManager->flush(); |
@@ -46,7 +46,7 @@ |
||
46 | 46 | '/Controller/_nomController_Controller.php', |
47 | 47 | '/Tests/Controller/_nomController_ControllerTest.php', |
48 | 48 | '/Form/Type/_nomController_Type.php', |
49 | - '/Resources/config/routing.yml', // Il faut récupérer la locale par défaut afin de générer le bon fichier. |
|
49 | + '/Resources/config/routing.yml', // Il faut récupérer la locale par défaut afin de générer le bon fichier. |
|
50 | 50 | //'/Resources/translations/_lnomController_._defaultLocale_.yml', // Il faut récupérer la locale par défaut afin de générer le bon fichier. |
51 | 51 | ]; |
52 | 52 | } |
@@ -27,7 +27,7 @@ |
||
27 | 27 | protected function execute(InputInterface $input, OutputInterface $output) |
28 | 28 | { |
29 | 29 | $metadata = $this->getContainer()->get('doctrine.orm.entity_manager')->getClassMetadata("StarkerxpCampagneBundle:Template2") |
30 | - ; |
|
30 | + ; |
|
31 | 31 | dump($metadata); |
32 | 32 | |
33 | 33 | } |
@@ -70,7 +70,7 @@ |
||
70 | 70 | /** |
71 | 71 | * Set uuid. |
72 | 72 | * |
73 | - * @param guid $uuid |
|
73 | + * @param string $uuid |
|
74 | 74 | * |
75 | 75 | * @return Template |
76 | 76 | */ |
@@ -31,26 +31,26 @@ discard block |
||
31 | 31 | $currentServices = Yaml::parse(file_get_contents($target)); |
32 | 32 | $newServices = Yaml::parse($this->render($fichier.'.twig', $parameters)); |
33 | 33 | // gestion de fichiers sans services ni parameters => routing |
34 | - $listeDesParametres = !empty($currentServices['parameters'])?array_keys($currentServices['parameters']):[]; |
|
35 | - $listeDesServices = !empty($currentServices['services'])?array_keys($currentServices['services']):[]; |
|
36 | - $listeDesDeclarations = !empty($currentServices)?array_keys($currentServices):[]; |
|
37 | - $listeDesNouveauxParametres = !empty($newServices['parameters'])?array_keys($newServices['parameters']):[]; |
|
38 | - $listeDesNouveauxServices = !empty($newServices['services'])?array_keys($newServices['services']):[]; |
|
39 | - $listeDesNouvellesDeclarations = !empty($newServices)?array_keys($newServices):[]; |
|
34 | + $listeDesParametres = !empty($currentServices['parameters']) ? array_keys($currentServices['parameters']) : []; |
|
35 | + $listeDesServices = !empty($currentServices['services']) ? array_keys($currentServices['services']) : []; |
|
36 | + $listeDesDeclarations = !empty($currentServices) ? array_keys($currentServices) : []; |
|
37 | + $listeDesNouveauxParametres = !empty($newServices['parameters']) ? array_keys($newServices['parameters']) : []; |
|
38 | + $listeDesNouveauxServices = !empty($newServices['services']) ? array_keys($newServices['services']) : []; |
|
39 | + $listeDesNouvellesDeclarations = !empty($newServices) ? array_keys($newServices) : []; |
|
40 | 40 | |
41 | 41 | $diffServices = array_diff($listeDesNouveauxServices, $listeDesServices); |
42 | 42 | $diffParametres = array_diff($listeDesNouveauxParametres, $listeDesParametres); |
43 | 43 | $diffDeclarations = array_diff($listeDesNouvellesDeclarations, $listeDesDeclarations); |
44 | - if(empty($diffServices) && empty($diffParametres) && empty($diffDeclarations) ){ |
|
44 | + if (empty($diffServices) && empty($diffParametres) && empty($diffDeclarations)) { |
|
45 | 45 | return false; |
46 | 46 | } |
47 | - foreach ($diffServices as $libelle){ |
|
47 | + foreach ($diffServices as $libelle) { |
|
48 | 48 | $currentServices['services'][$libelle] = $newServices['services'][$libelle]; |
49 | 49 | } |
50 | - foreach ($diffParametres as $libelle){ |
|
50 | + foreach ($diffParametres as $libelle) { |
|
51 | 51 | $currentServices['parameters'][$libelle] = $newServices['parameters'][$libelle]; |
52 | 52 | } |
53 | - foreach ($diffDeclarations as $libelle){ |
|
53 | + foreach ($diffDeclarations as $libelle) { |
|
54 | 54 | $currentServices[$libelle] = $newServices[$libelle]; |
55 | 55 | } |
56 | 56 | $content = Yaml::dump($currentServices, 3, 4); |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | return true; |
65 | 65 | } |
66 | 66 | // On ne modifie pas un fichier existant. |
67 | - if(file_exists($target)){ |
|
67 | + if (file_exists($target)) { |
|
68 | 68 | return false; |
69 | 69 | } |
70 | 70 | $this->renderFile($fichier.'.twig', $target, $parameters); |