|
@@ -4,6 +4,7 @@ namespace Drupal\heartbeat8;
|
|
|
|
|
|
use Drupal\Core\Entity\EntityTypeManager;
|
|
|
use Drupal\Core\Entity\EntityTypeRepository;
|
|
|
+use Drupal\Core\Entity\Query\QueryFactory;
|
|
|
|
|
|
/**
|
|
|
* Class HeartbeatStreamServices.
|
|
@@ -15,31 +16,45 @@ class HeartbeatStreamServices {
|
|
|
/**
|
|
|
* Drupal\Core\Entity\EntityTypeManager definition.
|
|
|
*
|
|
|
- * @var Drupal\Core\Entity\EntityTypeManager
|
|
|
+ * @var EntityTypeManager
|
|
|
*/
|
|
|
- protected $entity_type_manager;
|
|
|
+ protected $entityTypeManager;
|
|
|
|
|
|
/**
|
|
|
* Drupal\Core\Entity\EntityTypeRepository definition.
|
|
|
*
|
|
|
- * @var Drupal\Core\Entity\EntityTypeRepository
|
|
|
+ * @var EntityTypeRepository
|
|
|
*/
|
|
|
- protected $entity_type_repository;
|
|
|
+ protected $entityTypeRepository;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Drupal\Core\Entity\Query\QueryFactory definition.
|
|
|
+ *
|
|
|
+ * @var \Drupal\Core\Entity\Query\QueryFactory
|
|
|
+ */
|
|
|
+ protected $entityQuery;
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* Constructor.
|
|
|
+ * @param EntityTypeManager $entityTypeManager
|
|
|
+ * @param EntityTypeRepository $entityTypeRepository
|
|
|
+ * @param QueryFactory $entityQuery
|
|
|
*/
|
|
|
- public function __construct(EntityTypeManager $entity_type_manager, EntityTypeRepository $entity_type_repository) {
|
|
|
- $this->entity_type_manager = $entity_type_manager;
|
|
|
- $this->entity_type_repository = $entity_type_repository;
|
|
|
+ public function __construct(EntityTypeManager $entityTypeManager, EntityTypeRepository $entityTypeRepository, QueryFactory $entityQuery) {
|
|
|
+ $this->entityTypeManager = $entityTypeManager;
|
|
|
+ $this->entityTypeRepository = $entityTypeRepository;
|
|
|
+ $this->entityQuery = $entityQuery;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Returns a loaded HeartbeatStream entity
|
|
|
* @param $id
|
|
|
* @return \Drupal\Core\Entity\EntityInterface|null
|
|
|
+ * @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
|
|
|
*/
|
|
|
public function getEntityById($id) {
|
|
|
- return $this->entity_type_manager->getStorage('heartbeat_stream')->load($id);
|
|
|
+ return $this->entityTypeManager->getStorage('heartbeat_stream')->load($id);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -48,9 +63,21 @@ class HeartbeatStreamServices {
|
|
|
* HeartbeatStream specified by ID
|
|
|
* @param $id
|
|
|
* @return mixed
|
|
|
+ * @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
|
|
|
*/
|
|
|
public function getTypesById($id) {
|
|
|
- return $this->entity_type_manager->getStorage('heartbeat_stream')->load($id)->get('types');
|
|
|
+ return $this->entityTypeManager->getStorage('heartbeat_stream')->load($id)->get('types');
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Returns an array of HeartbeatStream entities
|
|
|
+ * HeartbeatStream specified by ID
|
|
|
+ * @return mixed
|
|
|
+ */
|
|
|
+ public function loadAllEntities() {
|
|
|
+ $jigga = $this->entityQuery->get('heartbeat_stream');
|
|
|
+ $jiggais =' nada';
|
|
|
+ return $jigga;
|
|
|
}
|
|
|
|
|
|
|