You are here

protected function EntityUsage::isInt in Entity Usage 8.2

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

Check if a value is an integer, or an integer string.

Core doesn't support big integers (bigint) for entity reference fields. Therefore we consider integers with more than 10 digits (big integer) to be strings. @todo: Fix bigint support once fixed in core. More info on #2680571 and #2989033.

Parameters

int|string $value: The value to check.

Return value

bool TRUE if the value is a numeric integer or a string containing an integer, FALSE otherwise.

5 calls to EntityUsage::isInt()
EntityUsage::deleteBySourceEntity in src/EntityUsage.php
Delete all records for a given source entity.
EntityUsage::deleteByTargetEntity in src/EntityUsage.php
Delete all records for a given target entity.
EntityUsage::listSources in src/EntityUsage.php
Provide a list of all referencing source entities for a target entity.
EntityUsage::listTargets in src/EntityUsage.php
Provide a list of all referenced target entities for a source entity.
EntityUsage::registerUsage in src/EntityUsage.php
Register or update a usage record.

File

src/EntityUsage.php, line 332

Class

EntityUsage
Defines the entity usage base class.

Namespace

Drupal\entity_usage

Code

protected function isInt($value) {
  return (string) (int) $value === (string) $value && strlen($value) < 11;
}