瀏覽代碼

Revert "[Form] removed validation.xml file (not used anymore)"

This reverts commit 3e476e1c3027d6781c2ad114a14a3f54e92a2cf0.
Bernhard Schussek 14 年之前
父節點
當前提交
325049ac73

+ 2 - 1
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

@@ -505,7 +505,8 @@ class FrameworkExtension extends Extension
 
     private function getValidatorXmlMappingFiles(ContainerBuilder $container)
     {
-        $files = array();
+        $files = array(__DIR__.'/../../../Component/Form/Resources/config/validation.xml');
+        $container->addResource(new FileResource($files[0]));
 
         foreach ($container->getParameter('kernel.bundles') as $bundle) {
             $reflection = new \ReflectionClass($bundle);

+ 90 - 0
src/Symfony/Component/Form/Resources/config/validation.xml

@@ -0,0 +1,90 @@
+<?xml version="1.0" ?>
+
+<constraint-mapping xmlns="http://symfony.com/schema/dic/constraint-mapping"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://symfony.com/schema/dic/constraint-mapping http://symfony.com/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd">
+
+  <class name="Symfony\Component\Form\Form">
+    <constraint name="Callback">
+      <value>
+        <value>Symfony\Component\Form\Validator\DelegatingValidator</value>
+        <value>validateFormData</value>
+      </value>
+    </constraint>
+    <property name="children">
+      <constraint name="Valid" />
+    </property>
+  </class>
+
+  <class name="Symfony\Component\Form\RepeatedField">
+    <getter property="firstEqualToSecond">
+      <constraint name="True">
+        <option name="message">The two values should be equal</option>
+      </constraint>
+    </getter>
+  </class>
+
+  <class name="Symfony\Component\Form\DateField">
+    <getter property="partiallyFilled">
+      <constraint name="False">
+        <option name="message">The date is not fully selected</option>
+      </constraint>
+    </getter>
+    <getter property="yearWithinRange">
+      <constraint name="True">
+        <option name="message">The year is invalid</option>
+      </constraint>
+    </getter>
+    <getter property="monthWithinRange">
+      <constraint name="True">
+        <option name="message">The month is invalid</option>
+      </constraint>
+    </getter>
+    <getter property="dayWithinRange">
+      <constraint name="True">
+        <option name="message">The day is invalid</option>
+      </constraint>
+    </getter>
+  </class>
+
+  <class name="Symfony\Component\Form\TimeField">
+    <getter property="partiallyFilled">
+      <constraint name="False">
+        <option name="message">The time is not fully selected</option>
+      </constraint>
+    </getter>
+    <getter property="hourWithinRange">
+      <constraint name="True">
+        <option name="message">The hour is invalid</option>
+      </constraint>
+    </getter>
+    <getter property="minuteWithinRange">
+      <constraint name="True">
+        <option name="message">The minutes are invalid</option>
+      </constraint>
+    </getter>
+    <getter property="secondWithinRange">
+      <constraint name="True">
+        <option name="message">The seconds are invalid</option>
+      </constraint>
+    </getter>
+  </class>
+
+  <class name="Symfony\Component\Form\FileField">
+    <getter property="iniSizeExceeded">
+      <constraint name="False">
+        <option name="message">The file is too large. Please upload a smaller file</option>
+      </constraint>
+    </getter>
+    <getter property="formSizeExceeded">
+      <constraint name="False">
+        <option name="message">The file is too large. Please upload a smaller file</option>
+      </constraint>
+    </getter>
+    <getter property="uploadComplete">
+      <constraint name="True">
+        <option name="message">The file was only partially uploaded. Please try again</option>
+      </constraint>
+    </getter>
+  </class>
+</constraint-mapping>