EntityHandlerInterface.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. namespace Drupal\Core\Entity;
  3. use Symfony\Component\DependencyInjection\ContainerInterface;
  4. /**
  5. * Defines an interface for entity handlers.
  6. *
  7. * This interface can be implemented by entity handlers that require
  8. * dependency injection.
  9. *
  10. * @ingroup entity_api
  11. */
  12. interface EntityHandlerInterface {
  13. /**
  14. * Instantiates a new instance of this entity handler.
  15. *
  16. * This is a factory method that returns a new instance of this object. The
  17. * factory should pass any needed dependencies into the constructor of this
  18. * object, but not the container itself. Every call to this method must return
  19. * a new instance of this object; that is, it may not implement a singleton.
  20. *
  21. * @param \Symfony\Component\DependencyInjection\ContainerInterface $container
  22. * The service container this object should use.
  23. * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
  24. * The entity type definition.
  25. *
  26. * @return static
  27. * A new instance of the entity handler.
  28. */
  29. public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type);
  30. }