IntColumnHandlerSQLite.php in Dynamic Entity Reference 8.2
File
src/Storage/IntColumnHandlerSQLite.php
View source
<?php
namespace Drupal\dynamic_entity_reference\Storage;
class IntColumnHandlerSQLite extends IntColumnHandler {
protected function createBody($column_int, $column) {
return "{$column_int} = CAST({$column} AS INTEGER)";
}
protected function createTrigger($trigger, $op, $prefixed_name, $body) {
$parts = explode('.', $prefixed_name);
$table_name = array_pop($parts);
$query = "\n CREATE TRIGGER {$trigger} AFTER {$op} ON {$prefixed_name}\n FOR EACH ROW\n BEGIN\n UPDATE {$table_name} SET {$body} WHERE ROWID=NEW.ROWID";
if (strpos($query, ';') !== FALSE) {
throw new \InvalidArgumentException('; is not supported in SQL strings. Use only one statement at a time.');
}
$this->connection
->query("{$query}; END", [], [
'allow_delimiter_in_query' => TRUE,
]);
}
}