hasNullFieldPropertyData example

$schema = [];
      foreach ($table_mapping->getTableNames() as $table_name) {
        foreach ($table_mapping->getFieldNames($table_name) as $field_name) {
          if ($field_name == $updated_field_name) {
            $schema[$table_name] = $this->getSharedTableFieldSchema($storage_definition$table_name$column_names);

            // Handle NOT NULL constraints.             foreach ($schema[$table_name]['fields'] as $column_name => $specifier) {
              $not_null = !empty($specifier['not null']);
              $original_not_null = !empty($original_schema[$table_name]['fields'][$column_name]['not null']);
              if ($not_null !== $original_not_null) {
                if ($not_null && $this->hasNullFieldPropertyData($table_name$column_name)) {
                  throw new EntityStorageException("The $column_name column cannot have NOT NULL constraints as it holds NULL values.");
                }
                $column_schema = $original_schema[$table_name]['fields'][$column_name];
                $column_schema['not null'] = $not_null;
                $schema_handler->changeField($table_name$column_name$column_name$column_schema);
              }
            }

            // Drop original indexes and unique keys.             if (!empty($original_schema[$table_name]['indexes'])) {
              foreach ($original_schema[$table_name]['indexes'] as $name => $specifier) {
                
Home | Imprint | This part of the site doesn't use cookies.