Browse Source

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

bastien 13 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
         throw  $this->createNotFoundException('Vous ne pouvez pas ajouter d\'éléments a ce groupe');
183
         throw  $this->createNotFoundException('Vous ne pouvez pas ajouter d\'éléments a ce groupe');
184
       }
184
       }
185
     }
185
     }
186
-    
186
+        
187
     $element = new Element();
187
     $element = new Element();
188
     $element->setType('none');
188
     $element->setType('none');
189
     $form = $this->getAddForm($element);
189
     $form = $this->getAddForm($element);
190
     $form->bindRequest($this->getRequest());
190
     $form->bindRequest($this->getRequest());
191
     
191
     
192
+    
192
     if ($form->isValid())
193
     if ($form->isValid())
193
     {
194
     {
194
 
195
 
271
         }
272
         }
272
         foreach ($form->getErrors() as $error)
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
         return $this->jsonResponse(array(
281
         return $this->jsonResponse(array(