StatusTypeService.php in Heartbeat 8
File
modules/statusmessage/src/StatusTypeService.php
View source
<?php
namespace Drupal\statusmessage;
use Drupal\Core\Entity\Query\QueryFactory;
use Drupal\Core\Entity\EntityTypeManager;
class StatusTypeService {
protected $entityQuery;
protected $entityTypeManager;
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());
}
}