Skip to content

Instantly share code, notes, and snippets.

@cyberlex404
Created March 2, 2017 19:19
Show Gist options
  • Select an option

  • Save cyberlex404/fa8f05d595f1f930d3ba786a638eaf1d to your computer and use it in GitHub Desktop.

Select an option

Save cyberlex404/fa8f05d595f1f930d3ba786a638eaf1d to your computer and use it in GitHub Desktop.
/**
* Drupal\Core\Entity\EntityTypeManager definition.
*
* @var \Drupal\Core\Entity\EntityTypeManager
*/
protected $entityTypeManager;
/**
* Drupal\Core\Entity\Query\QueryFactory definition.
*
* @var \Drupal\Core\Entity\Query\QueryFactory
*/
protected $entityQuery;
/**
* Drupal\Core\Session\AccountProxy definition.
*
* @var \Drupal\Core\Session\AccountProxy
*/
protected $currentUser;
public function __construct(
EntityTypeManager $entity_type_manager,
QueryFactory $entity_query,
AccountProxy $current_user
) {
$this->entityTypeManager = $entity_type_manager;
$this->entityQuery = $entity_query;
$this->currentUser = $current_user;
}
public static function create(ContainerInterface $container) {
return new static(
$container->get('entity_type.manager'),
$container->get('entity.query'),
$container->get('current_user')
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment