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

  1. 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\ServiceAnnotation\Hook;

/**
 * @Hook("sqlCompileCommands")
 */
class SqlCompileCommandsListener
{
    public function __invoke(array $sql): array
    {
        // Modify the array of SQL statements

        return $sql;
    }
}

References