ClassMetadataInterface.php 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. * @author Bernhard Schussek <bschussek@gmail.com>
  24. *
  25. * @see MetadataInterface
  26. * @see \Symfony\Component\Validator\Constraints\GroupSequence
  27. * @see \Symfony\Component\Validator\GroupSequenceProviderInterface
  28. * @see TraversalStrategy
  29. */
  30. interface ClassMetadataInterface extends MetadataInterface, LegacyPropertyMetadataContainerInterface, ClassBasedInterface
  31. {
  32. /**
  33. * Returns the names of all constrained properties.
  34. *
  35. * @return string[] A list of property names
  36. */
  37. public function getConstrainedProperties();
  38. /**
  39. * Returns whether the "Default" group is overridden by a group sequence.
  40. *
  41. * If it is, you can access the group sequence with {@link getGroupSequence()}.
  42. *
  43. * @return bool Returns true if the "Default" group is overridden
  44. *
  45. * @see \Symfony\Component\Validator\Constraints\GroupSequence
  46. */
  47. public function hasGroupSequence();
  48. /**
  49. * Returns the group sequence that overrides the "Default" group for this
  50. * class.
  51. *
  52. * @return \Symfony\Component\Validator\Constraints\GroupSequence|null The group sequence or null
  53. *
  54. * @see \Symfony\Component\Validator\Constraints\GroupSequence
  55. */
  56. public function getGroupSequence();
  57. /**
  58. * Returns whether the "Default" group is overridden by a dynamic group
  59. * sequence obtained by the validated objects.
  60. *
  61. * If this method returns true, the class must implement
  62. * {@link \Symfony\Component\Validator\GroupSequenceProviderInterface}.
  63. * This interface will be used to obtain the group sequence when an object
  64. * of this class is validated.
  65. *
  66. * @return bool Returns true if the "Default" group is overridden by
  67. * a dynamic group sequence
  68. *
  69. * @see \Symfony\Component\Validator\GroupSequenceProviderInterface
  70. */
  71. public function isGroupSequenceProvider();
  72. }