ClassMetadataInterface.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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\Serializer\Mapping;
  11. /**
  12. * Stores metadata needed for serializing and deserializing objects of specific class.
  13. *
  14. * Primarily, the metadata stores the set of attributes to serialize or deserialize.
  15. *
  16. * There may only exist one metadata for each attribute according to its name.
  17. *
  18. * @internal
  19. *
  20. * @author Kévin Dunglas <dunglas@gmail.com>
  21. */
  22. interface ClassMetadataInterface
  23. {
  24. /**
  25. * Returns the name of the backing PHP class.
  26. *
  27. * @return string The name of the backing class
  28. */
  29. public function getName(): string;
  30. /**
  31. * Adds an {@link AttributeMetadataInterface}.
  32. */
  33. public function addAttributeMetadata(AttributeMetadataInterface $attributeMetadata);
  34. /**
  35. * Gets the list of {@link AttributeMetadataInterface}.
  36. *
  37. * @return AttributeMetadataInterface[]
  38. */
  39. public function getAttributesMetadata(): array;
  40. /**
  41. * Merges a {@link ClassMetadataInterface} in the current one.
  42. */
  43. public function merge(self $classMetadata);
  44. /**
  45. * Returns a {@link \ReflectionClass} instance for this class.
  46. */
  47. public function getReflectionClass(): \ReflectionClass;
  48. public function getClassDiscriminatorMapping(): ?ClassDiscriminatorMapping;
  49. public function setClassDiscriminatorMapping(ClassDiscriminatorMapping $mapping = null);
  50. }