Skip to content
This repository has been archived by the owner on Feb 23, 2020. It is now read-only.

Commit

Permalink
Cleaned up RNG entity model class.
Browse files Browse the repository at this point in the history
Fixed missing injected dependency for `rng.entity.model` service.
Removed unused imports in .module file.
  • Loading branch information
dpi committed Dec 30, 2016
1 parent a31d24a commit 560b688
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 17 deletions.
15 changes: 3 additions & 12 deletions rng.module
Expand Up @@ -3,19 +3,10 @@
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\Core\Access\AccessResult;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
use Drupal\courier\ChannelInterface;
use Drupal\courier\TemplateCollectionInterface;
use Drupal\rng\Entity\RuleSchedule;
use Drupal\rng\Entity\Registrant;
use Drupal\rng\EventTypeInterface;
use Drupal\rng\Exception\InvalidEventException;
use Drupal\courier\Entity\TemplateCollection;
use Drupal\rng\RuleInterface;
use Drupal\rng\RuleComponentInterface;
use Drupal\rng\Plugin\Action\CourierTemplateCollection;
use Drupal\Core\Render\Element;

/**
Expand Down Expand Up @@ -109,7 +100,7 @@ function rng_entity_operation(EntityInterface $entity) {
* Implements hook_entity_insert().
*/
function rng_entity_insert(EntityInterface $entity) {
/** @var \Drupal\rng\RngModel $rng_model */
/** @var \Drupal\rng\RngEntityModel $rng_model */
$rng_model = \Drupal::service('rng.entity.model');
$rng_model->hook_entity_postsave($entity);
}
Expand All @@ -118,7 +109,7 @@ function rng_entity_insert(EntityInterface $entity) {
* Implements hook_entity_update().
*/
function rng_entity_update(EntityInterface $entity) {
/** @var \Drupal\rng\RngModel $rng_model */
/** @var \Drupal\rng\RngEntityModel $rng_model */
$rng_model = \Drupal::service('rng.entity.model');
$rng_model->hook_entity_postsave($entity);
}
Expand All @@ -127,7 +118,7 @@ function rng_entity_update(EntityInterface $entity) {
* Implements hook_entity_predelete().
*/
function rng_entity_predelete(EntityInterface $entity) {
/** @var \Drupal\rng\RngModel $rng_model */
/** @var \Drupal\rng\RngEntityModel $rng_model */
$rng_model = \Drupal::service('rng.entity.model');
$rng_model->hook_entity_predelete($entity);
}
Expand Down
4 changes: 2 additions & 2 deletions rng.services.yml
Expand Up @@ -10,8 +10,8 @@ services:
class: Drupal\rng\RngEntityAccess
arguments: ['@rng.event_manager']
rng.entity.model:
class: Drupal\rng\RngModel
arguments: ['@rng.event_manager', '@plugin.manager.identity_channel']
class: Drupal\rng\RngEntityModel
arguments: ['@entity_type.manager', '@rng.event_manager', '@plugin.manager.identity_channel']
rng.registrant.factory:
class: Drupal\rng\RegistrantFactory
arguments: ['@entity_type.manager', '@rng.event_manager']
Expand Down
6 changes: 3 additions & 3 deletions src/RngModel.php → src/RngEntityModel.php
Expand Up @@ -4,14 +4,14 @@

use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\courier\Service\IdentityChannelManagerInterface;
use Drupal\rng\Entity\Registrant;
use Drupal\rng\Plugin\Action\CourierTemplateCollection;
use Drupal\courier\Service\IdentityChannelManagerInterface;

/**
* Enforces RNG model relationships.
*/
class RngModel {
class RngEntityModel {

/**
* Storage for registration entities.
Expand Down Expand Up @@ -56,7 +56,7 @@ class RngModel {
protected $identityChannelManager;

/**
* Constructs a new RegistrantFactory object.
* Constructs a new RngEntityModel object.
*
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager.
Expand Down

0 comments on commit 560b688

Please sign in to comment.