class IntColumnHandlerMySQL in Dynamic Entity Reference 8.2
MySQL implementation of denormalizing into integer columns.
Hierarchy
- class \Drupal\dynamic_entity_reference\Storage\IntColumnHandler implements IntColumnHandlerInterface
- class \Drupal\dynamic_entity_reference\Storage\IntColumnHandlerMySQL
Expanded class hierarchy of IntColumnHandlerMySQL
1 string reference to 'IntColumnHandlerMySQL'
1 service uses IntColumnHandlerMySQL
File
- src/
Storage/ IntColumnHandlerMySQL.php, line 8
Namespace
Drupal\dynamic_entity_reference\StorageView source
class IntColumnHandlerMySQL extends IntColumnHandler {
/**
* {@inheritdoc}
*/
protected function createBody($column_int, $column) {
return "NEW.{$column_int} = IF(NEW.{$column} REGEXP '^[0-9]+\$', CAST(NEW.{$column} AS UNSIGNED), NULL)";
}
/**
* {@inheritdoc}
*/
protected function createTrigger($trigger, $op, $prefixed_name, $body) {
$this->connection
->query("CREATE TRIGGER {$trigger} BEFORE {$op} ON {$prefixed_name} FOR EACH ROW SET {$body}", [], [
'allow_square_brackets' => TRUE,
]);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
IntColumnHandler:: |
protected | property | The database connection. | |
IntColumnHandler:: |
public static | function | Checks whether all columns exist. | |
IntColumnHandler:: |
public | function |
Creates the _int columns and the triggers for them. Overrides IntColumnHandlerInterface:: |
|
IntColumnHandler:: |
public | function | Removes the trigger. | |
IntColumnHandler:: |
public | function | IntColumnHandler constructor. | |
IntColumnHandlerMySQL:: |
protected | function |
Creates the body of the trigger. Overrides IntColumnHandler:: |
|
IntColumnHandlerMySQL:: |
protected | function |
Actually creates the trigger. Overrides IntColumnHandler:: |