You are here

class StatusTypeService in Heartbeat 8

Class StatusTypeService.

@package Drupal\statusmessage

Hierarchy

Expanded class hierarchy of StatusTypeService

2 files declare their use of StatusTypeService
ContentController.php in modules/statusmessage/src/Controller/ContentController.php
StatusForm.php in modules/statusmessage/src/Form/StatusForm.php
1 string reference to 'StatusTypeService'
statusmessage.services.yml in modules/statusmessage/statusmessage.services.yml
modules/statusmessage/statusmessage.services.yml
1 service uses StatusTypeService
status_type_service in modules/statusmessage/statusmessage.services.yml
Drupal\statusmessage\StatusTypeService

File

modules/statusmessage/src/StatusTypeService.php, line 12

Namespace

Drupal\statusmessage
View source
class StatusTypeService {

  /**
   * Drupal\Core\Entity\Query\QueryFactory definition.
   *
   * @var \Drupal\Core\Entity\Query\QueryFactory
   */
  protected $entityQuery;

  /**
   * Drupal\Core\Entity\EntityTypeManager definition.
   *
   * @var \Drupal\Core\Entity\EntityTypeManager
   */
  protected $entityTypeManager;

  /**
   * Constructor.
   */
  public function __construct(QueryFactory $entity_query, EntityTypeManager $entity_type_manager) {
    $this->entityQuery = $entity_query;
    $this->entityTypeManager = $entity_type_manager;
  }
  public function getTypes() {
    return $this->entityQuery
      ->get('status_type')
      ->execute();
  }
  public function load($id) {
    return $this->entityTypeManager
      ->getStorage('status_type')
      ->load($id);
  }
  public function loadAll() {
    return $this->entityTypeManager
      ->getStorage('status_type')
      ->loadMultiple($this
      ->getTypes());
  }

}

Members