constraint-mapping.xml 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <?xml version="1.0" ?>
  2. <constraint-mapping xmlns="http://symfony.com/schema/dic/constraint-mapping"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4. xsi:schemaLocation="http://symfony.com/schema/dic/constraint-mapping http://symfony.com/schema/dic/services/constraint-mapping-1.0.xsd">
  5. <namespace prefix="custom">Symfony\Tests\Component\Validator\Fixtures\</namespace>
  6. <class name="Symfony\Tests\Component\Validator\Fixtures\Entity">
  7. <group-sequence>
  8. <value>Foo</value>
  9. <value>Entity</value>
  10. </group-sequence>
  11. <!-- CLASS CONSTRAINTS -->
  12. <!-- Custom constraint -->
  13. <constraint name="Symfony\Tests\Component\Validator\Fixtures\ConstraintA" />
  14. <!-- Custom constraint with namespace abbreviation-->
  15. <constraint name="custom:ConstraintB" />
  16. <!-- PROPERTY CONSTRAINTS -->
  17. <property name="firstName">
  18. <!-- Constraint without value -->
  19. <constraint name="NotNull" />
  20. <!-- Constraint with single value -->
  21. <constraint name="Min">3</constraint>
  22. <!-- Constraint with multiple values -->
  23. <constraint name="Choice">
  24. <value>A</value>
  25. <value>B</value>
  26. </constraint>
  27. <!-- Constraint with child constraints -->
  28. <constraint name="All">
  29. <constraint name="NotNull" />
  30. <constraint name="Min">3</constraint>
  31. </constraint>
  32. <!-- Option with child constraints -->
  33. <constraint name="All">
  34. <option name="constraints">
  35. <constraint name="NotNull" />
  36. <constraint name="Min">3</constraint>
  37. </option>
  38. </constraint>
  39. <!-- Value with child constraints -->
  40. <constraint name="Collection">
  41. <option name="fields">
  42. <value key="foo">
  43. <constraint name="NotNull" />
  44. <constraint name="Min">3</constraint>
  45. </value>
  46. <value key="bar">
  47. <constraint name="Min">5</constraint>
  48. </value>
  49. </option>
  50. </constraint>
  51. <!-- Constraint with options -->
  52. <constraint name="Choice">
  53. <!-- Option with single value -->
  54. <option name="message">Must be one of %choices%</option>
  55. <!-- Option with multiple values -->
  56. <option name="choices">
  57. <value>A</value>
  58. <value>B</value>
  59. </option>
  60. </constraint>
  61. </property>
  62. <!-- GETTER CONSTRAINTS -->
  63. <getter property="lastName">
  64. <constraint name="NotNull" />
  65. </getter>
  66. </class>
  67. </constraint-mapping>