constraint-mapping.xml 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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/constraint-mapping/constraint-mapping-1.0.xsd">
  5. <namespace prefix="custom">Symfony\Component\Validator\Tests\Fixtures\</namespace>
  6. <class name="Symfony\Component\Validator\Tests\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\Component\Validator\Tests\Fixtures\ConstraintA" />
  14. <!-- Custom constraint with namespace abbreviation-->
  15. <constraint name="custom:ConstraintB" />
  16. <!-- Callbacks -->
  17. <constraint name="Callback">validateMe</constraint>
  18. <constraint name="Callback">validateMeStatic</constraint>
  19. <constraint name="Callback">
  20. <value>Symfony\Component\Validator\Tests\Fixtures\CallbackClass</value>
  21. <value>callback</value>
  22. </constraint>
  23. <!-- Traverse with boolean default option -->
  24. <constraint name="Traverse">
  25. false
  26. </constraint>
  27. <!-- PROPERTY CONSTRAINTS -->
  28. <property name="firstName">
  29. <!-- Constraint without value -->
  30. <constraint name="NotNull" />
  31. <!-- Constraint with single value -->
  32. <constraint name="Range">
  33. <option name="min">3</option>
  34. </constraint>
  35. <!-- Constraint with multiple values -->
  36. <constraint name="Choice">
  37. <value>A</value>
  38. <value>B</value>
  39. </constraint>
  40. <!-- Constraint with child constraints -->
  41. <constraint name="All">
  42. <constraint name="NotNull" />
  43. <constraint name="Range">
  44. <option name="min">3</option>
  45. </constraint>
  46. </constraint>
  47. <!-- Option with child constraints -->
  48. <constraint name="All">
  49. <option name="constraints">
  50. <constraint name="NotNull" />
  51. <constraint name="Range">
  52. <option name="min">3</option>
  53. </constraint>
  54. </option>
  55. </constraint>
  56. <!-- Value with child constraints -->
  57. <constraint name="Collection">
  58. <option name="fields">
  59. <value key="foo">
  60. <constraint name="NotNull" />
  61. <constraint name="Range">
  62. <option name="min">3</option>
  63. </constraint>
  64. </value>
  65. <value key="bar">
  66. <constraint name="Range">
  67. <option name="min">5</option>
  68. </constraint>
  69. </value>
  70. </option>
  71. </constraint>
  72. <!-- Constraint with options -->
  73. <constraint name="Choice">
  74. <!-- Option with single value -->
  75. <option name="message"> Must be one of %choices% </option>
  76. <!-- Option with multiple values -->
  77. <option name="choices">
  78. <value>A</value>
  79. <value>B</value>
  80. </option>
  81. </constraint>
  82. </property>
  83. <!-- GETTER CONSTRAINTS -->
  84. <getter property="lastName">
  85. <constraint name="NotNull" />
  86. </getter>
  87. <getter property="valid">
  88. <constraint name="IsTrue" />
  89. </getter>
  90. <getter property="permissions">
  91. <constraint name="IsTrue" />
  92. </getter>
  93. </class>
  94. <class name="Symfony\Component\Validator\Tests\Fixtures\GroupSequenceProviderEntity">
  95. <!-- GROUP SEQUENCE PROVIDER -->
  96. <group-sequence-provider />
  97. </class>
  98. </constraint-mapping>