You are here

class StatusService in Heartbeat 8

Class StatusService.

@package Drupal\statusmessage

Hierarchy

Expanded class hierarchy of StatusService

4 files declare their use of StatusService
ContentController.php in modules/statusmessage/src/Controller/ContentController.php
DefaultForm.php in modules/statusmessage/src/Form/DefaultForm.php
StatusForm.php in modules/statusmessage/src/Form/StatusForm.php
StatusTypeForm.php in modules/statusmessage/src/Form/StatusTypeForm.php
1 string reference to 'StatusService'
statusmessage.services.yml in modules/statusmessage/statusmessage.services.yml
modules/statusmessage/statusmessage.services.yml
1 service uses StatusService
statusservice in modules/statusmessage/statusmessage.services.yml
Drupal\statusmessage\StatusService

File

modules/statusmessage/src/StatusService.php, line 16

Namespace

Drupal\statusmessage
View source
class StatusService {

  /**
   * 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\flag\FlagService definition.
   *
   * @var Drupal\flag\FlagService
   */
  protected $flag;

  /**
   * Constructor.
   */
  public function __construct(EntityTypeManager $entity_type_manager, QueryFactory $entity_query, FlagService $flag) {
    $this->entityTypeManager = $entity_type_manager;
    $this->entityQuery = $entity_query;
    $this->flag = $flag;
  }
  public function getMimeTypes() {
    return [
      'image/jpeg',
      'image/png',
      'application/octet-stream',
      'video/mp4',
      'text/plain',
      'application/pdf',
      'image/gif',
    ];
  }
  public function getStatuses() {
    return $this->entityQuery
      ->get('status')
      ->execute();
  }
  public function load($id) {
    return $this->entityTypeManager
      ->getStorage('status')
      ->load($id);
  }
  public function loadAll() {
    return $this->entityTypeManager
      ->getStorage('status')
      ->loadMultiple($this
      ->getStatuses());
  }

}

Members