Browse Source

Anomalie #136: Ajout d'élément ajax: erreurs list et err si pas http://

bastien 12 years ago
parent
commit
fa2b35f93e
1 changed files with 6 additions and 2 deletions
  1. 6 2
      src/Muzich/CoreBundle/Controller/CoreController.php

+ 6 - 2
src/Muzich/CoreBundle/Controller/CoreController.php View File

@@ -183,12 +183,13 @@ class CoreController extends Controller
183 183
         throw  $this->createNotFoundException('Vous ne pouvez pas ajouter d\'éléments a ce groupe');
184 184
       }
185 185
     }
186
-    
186
+        
187 187
     $element = new Element();
188 188
     $element->setType('none');
189 189
     $form = $this->getAddForm($element);
190 190
     $form->bindRequest($this->getRequest());
191 191
     
192
+    
192 193
     if ($form->isValid())
193 194
     {
194 195
 
@@ -271,7 +272,10 @@ class CoreController extends Controller
271 272
         }
272 273
         foreach ($form->getErrors() as $error)
273 274
         {
274
-          $errors[] = $this->trans($error->getMessageTemplate(), array(), 'validators');
275
+          if (!in_array($err = $this->trans($error->getMessageTemplate(), array(), 'validators'), $errors))
276
+          {
277
+            $errors[] = $err;
278
+          }
275 279
         }
276 280
         
277 281
         return $this->jsonResponse(array(