You are here

protected function SqlContentEntityStorageSchema::hasNullFieldPropertyData in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php \Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema::hasNullFieldPropertyData()
  2. 10 core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php \Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema::hasNullFieldPropertyData()

Checks whether a field property has NULL values.

Parameters

string $table_name: The name of the table to inspect.

string $column_name: The name of the column holding the field property data.

Return value

bool TRUE if NULL data is found, FALSE otherwise.

1 call to SqlContentEntityStorageSchema::hasNullFieldPropertyData()
SqlContentEntityStorageSchema::updateSharedTableSchema in core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php
Updates the schema for a field stored in a shared table.

File

core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php, line 2061

Class

SqlContentEntityStorageSchema
Defines a schema handler that supports revisionable, translatable entities.

Namespace

Drupal\Core\Entity\Sql

Code

protected function hasNullFieldPropertyData($table_name, $column_name) {
  $query = $this->database
    ->select($table_name, 't')
    ->fields('t', [
    $column_name,
  ])
    ->range(0, 1);
  $query
    ->isNull('t.' . $column_name);
  $result = $query
    ->execute()
    ->fetchAssoc();
  return (bool) $result;
}