protected function 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;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Entity!Sql!SqlContentEntityStorageSchema.php/function/SqlContentEntityStorageSchema::hasNullFieldPropertyData/8.1.x