protected SqlContentEntityStorageSchema::isTableEmpty($table_name)
Checks whether a database table is non-existent or empty.
Empty tables can be dropped and recreated without data loss.
Parameters
string $table_name: The database table to check.
Return value
bool TRUE if the table is empty, FALSE otherwise.
File
- core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php, line 1926
Class
- SqlContentEntityStorageSchema
- Defines a schema handler that supports revisionable, translatable entities.
Namespace
Drupal\Core\Entity\Sql
Code
1 2 3 4 5 6 7 8 | protected function isTableEmpty( $table_name ) { return ! $this ->database->schema()->tableExists( $table_name ) || ! $this ->database->select( $table_name ) ->countQuery() ->range(0, 1) ->execute() ->fetchField(); } |
Please login to continue.