ClassMetadataInterface.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\Validator\Mapping;
  11. use Symfony\Component\Validator\ClassBasedInterface;
  12. use Symfony\Component\Validator\PropertyMetadataContainerInterface as LegacyPropertyMetadataContainerInterface;
  13. /**
  14. * Stores all metadata needed for validating objects of specific class.
  15. *
  16. * Most importantly, the metadata stores the constraints against which an object
  17. * and its properties should be validated.
  18. *
  19. * Additionally, the metadata stores whether the "Default" group is overridden
  20. * by a group sequence for that class and whether instances of that class
  21. * should be traversed or not.
  22. *
  23. * @since 2.5
  24. *
  25. * @author Bernhard Schussek <bschussek@gmail.com>
  26. *
  27. * @see MetadataInterface
  28. * @see \Symfony\Component\Validator\Constraints\GroupSequence
  29. * @see \Symfony\Component\Validator\GroupSequenceProviderInterface
  30. * @see TraversalStrategy
  31. */
  32. interface ClassMetadataInterface extends MetadataInterface, LegacyPropertyMetadataContainerInterface, ClassBasedInterface
  33. {
  34. /**
  35. * Returns the names of all constrained properties.
  36. *
  37. * @return string[] A list of property names
  38. */
  39. public function getConstrainedProperties();
  40. /**
  41. * Returns whether the "Default" group is overridden by a group sequence.
  42. *
  43. * If it is, you can access the group sequence with {@link getGroupSequence()}.
  44. *
  45. * @return bool Returns true if the "Default" group is overridden
  46. *
  47. * @see \Symfony\Component\Validator\Constraints\GroupSequence
  48. */
  49. public function hasGroupSequence();
  50. /**
  51. * Returns the group sequence that overrides the "Default" group for this
  52. * class.
  53. *
  54. * @return \Symfony\Component\Validator\Constraints\GroupSequence|null The group sequence or null
  55. *
  56. * @see \Symfony\Component\Validator\Constraints\GroupSequence
  57. */
  58. public function getGroupSequence();
  59. /**
  60. * Returns whether the "Default" group is overridden by a dynamic group
  61. * sequence obtained by the validated objects.
  62. *
  63. * If this method returns true, the class must implement
  64. * {@link \Symfony\Component\Validator\GroupSequenceProviderInterface}.
  65. * This interface will be used to obtain the group sequence when an object
  66. * of this class is validated.
  67. *
  68. * @return bool Returns true if the "Default" group is overridden by
  69. * a dynamic group sequence
  70. *
  71. * @see \Symfony\Component\Validator\GroupSequenceProviderInterface
  72. */
  73. public function isGroupSequenceProvider();
  74. }