protected function IntColumnHandlerPostgreSQL::createTrigger in Dynamic Entity Reference 8.2
Creates the trigger.
Parameters
string $table: The name of the table.
string $column: The name of the target_id column.
string $column_int: The name of the target_id_int column.
1 call to IntColumnHandlerPostgreSQL::createTrigger()
- IntColumnHandlerPostgreSQL::create in src/
Storage/ IntColumnHandlerPostgreSQL.php - Creates the _int columns and the triggers for them.
File
- src/
Storage/ IntColumnHandlerPostgreSQL.php, line 103
Class
- IntColumnHandlerPostgreSQL
- PostgreSQL implementation of denormalizing into integer columns.
Namespace
Drupal\dynamic_entity_reference\StorageCode
protected function createTrigger($table, $column, $column_int) {
$function_name = $this
->getFunctionName($table, $column_int);
$prefixed_table = $this
->getPrefixedTable($table);
// It is much easier to just drop and recreate than figuring it out whether
// it exists.
$this->connection
->query("DROP TRIGGER IF EXISTS {$column_int} ON {$prefixed_table}");
$this->connection
->query("\n CREATE TRIGGER {$column_int}\n BEFORE INSERT OR UPDATE\n ON {$prefixed_table}\n FOR EACH ROW\n EXECUTE PROCEDURE {$function_name}();\n ");
}