sqlCompileCommands
The sqlCompileCommands
hook is triggered when compiling the database update
commands. It passes the array of changes and expects the same as return value.
Parameters
array
$sql
Array of changes that should be applied to the database.
Return Values
Return the array of changes that should be applied to the database.
Example
// src/EventListener/SqlCompileCommandsListener.php
namespace App\EventListener;
use Contao\CoreBundle\DependencyInjection\Attribute\AsHook;
#[AsHook('sqlCompileCommands')]
class SqlCompileCommandsListener
{
public function __invoke(array $sql): array
{
// Modify the array of SQL statements
return $sql;
}
}