SqlContentEntityStorageSchema::hasNullFieldPropertyData

protected SqlContentEntityStorageSchema::hasNullFieldPropertyData($table_name, $column_name)

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.

File

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

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;
}
doc_Drupal
2016-10-29 09:43:40
Comments
Leave a Comment

Please login to continue.