EntityHandlerInterface.php 1.09 KB
Newer Older
1 2 3 4 5 6 7
<?php

namespace Drupal\Core\Entity;

use Symfony\Component\DependencyInjection\ContainerInterface;

/**
8
 * Defines an interface for entity handlers.
9
 *
10 11
 * This interface can be implemented by entity handlers that require
 * dependency injection.
12 13
 *
 * @ingroup entity_api
14
 */
15
interface EntityHandlerInterface {
16 17

  /**
18
   * Instantiates a new instance of this entity handler.
19 20 21 22 23 24 25 26
   *
   * This is a factory method that returns a new instance of this object. The
   * factory should pass any needed dependencies into the constructor of this
   * object, but not the container itself. Every call to this method must return
   * a new instance of this object; that is, it may not implement a singleton.
   *
   * @param \Symfony\Component\DependencyInjection\ContainerInterface $container
   *   The service container this object should use.
27 28
   * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
   *   The entity type definition.
29 30
   *
   * @return static
31
   *   A new instance of the entity handler.
32
   */
33
  public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type);
34 35

}