entityTypeManager = $entity_type_manager; $this->entityQuery = $entity_query; } public function loadAll() { $entities = $this->entityQuery->get("heartbeat")->execute(); return $this->entityTypeManager->getStorage("heartbeat")->loadMultiple($entities); } public function load($id) { return $this->entityTypeManager->getStorage("heartbeat")->load($id); } public function loadByType($type) { return $this->entityTypeManager->getStorage("heartbeat")->loadMultiple($this->entityQuery->get('heartbeat')->condition('type', $type)->execute()); } public function loadByTypes($types) { return $this->entityTypeManager->getStorage("heartbeat")->loadMultiple($this->entityQuery->get('heartbeat')->condition('type', $types, 'IN')->sort('created', 'DESC')->execute()); } }