You are here

public function EntityUsageInterface::registerUsage in Entity Usage 8.2

Same name and namespace in other branches
  1. 8.4 src/EntityUsageInterface.php \Drupal\entity_usage\EntityUsageInterface::registerUsage()
  2. 8.3 src/EntityUsageInterface.php \Drupal\entity_usage\EntityUsageInterface::registerUsage()

Register or update a usage record.

If called with $count >= 1, the record matching the other parameters will be updated (or created if it doesn't exist). If called with $count <= 0, the record will be deleted.

Note that this method will honor the settings defined on the configuration page, hence potentially ignoring the register if the settings for the called combination are to not track this usage. Also, the hook hook_entity_usage_block_tracking() will be invoked, so other modules will have an opportunity to block this record before it is written to DB.

Parameters

int|string $target_id: The target entity ID.

string $target_type: The target entity type.

int|string $source_id: The source entity ID.

string $source_type: The source entity type.

string $source_langcode: The source entity language code.

string $source_vid: The source entity revision ID.

string $method: The method used to relate source entity with the target entity. Normally the plugin id.

string $field_name: The name of the field in the source entity using the target entity.

int $count: (optional) The number of references to add to the object. Defaults to 1.

1 method overrides EntityUsageInterface::registerUsage()
EntityUsage::registerUsage in src/EntityUsage.php
Register or update a usage record.

File

src/EntityUsageInterface.php, line 45

Class

EntityUsageInterface
Entity usage interface.

Namespace

Drupal\entity_usage

Code

public function registerUsage($target_id, $target_type, $source_id, $source_type, $source_langcode, $source_vid, $method, $field_name, $count = 1);