public function RngEntityModel::hook_entity_postsave in RNG - Events and Registrations 8
Same name and namespace in other branches
- 8.2 src/RngEntityModel.php \Drupal\rng\RngEntityModel::hook_entity_postsave()
- 3.x src/RngEntityModel.php \Drupal\rng\RngEntityModel::hook_entity_postsave()
React to Drupal `hook_entity_insert` or `hook_entity_update` hooks.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The entity object for the entity that is already saved.
boolean $update: Whether this entity is new.
See also
_rng_entity_postsave();
File
- src/
RngEntityModel.php, line 96
Class
- RngEntityModel
- Enforces RNG model relationships.
Namespace
Drupal\rngCode
public function hook_entity_postsave(EntityInterface $entity, $update = TRUE) {
if ($entity instanceof RuleInterface) {
$this
->postSaveRngRule($entity);
}
if ($entity instanceof RegistrationInterface) {
$operation_record = new RngOperationRecord();
$operation = $update ? 'update' : 'insert';
$operation_record
->setOperation($operation)
->setEntityTypeId($entity
->getEntityTypeId())
->setEntityId($entity
->id());
$this->operationRecords[] = $operation_record;
}
}