ObjectIdentityInterface.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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\Security\Acl\Model;
  11. /**
  12. * Represents the identity of an individual domain object instance.
  13. *
  14. * @author Johannes M. Schmitt <schmittjoh@gmail.com>
  15. */
  16. interface ObjectIdentityInterface
  17. {
  18. /**
  19. * We specifically require this method so we can check for object equality
  20. * explicitly, and do not have to rely on referencial equality instead.
  21. *
  22. * Though in most cases, both checks should result in the same outcome.
  23. *
  24. * Referential Equality: $object1 === $object2
  25. * Example for Object Equality: $object1->getId() === $object2->getId()
  26. *
  27. * @param ObjectIdentityInterface $identity
  28. *
  29. * @return bool
  30. */
  31. public function equals(ObjectIdentityInterface $identity);
  32. /**
  33. * Obtains a unique identifier for this object. The identifier must not be
  34. * re-used for other objects with the same type.
  35. *
  36. * @return string cannot return null
  37. */
  38. public function getIdentifier();
  39. /**
  40. * Returns a type for the domain object. Typically, this is the PHP class name.
  41. *
  42. * @return string cannot return null
  43. */
  44. public function getType();
  45. }