The sqlGetFromDB
hook is triggered when parsing the current database
definition. It passes the generated SQL definitions and expects the same
as return value.
array $sql
The compiled SQL definitions.
Return $sql
after adding your custom definitions.
// src/EventListener/SqlGetFromDBListener.php
namespace App\EventListener;
use Contao\CoreBundle\DependencyInjection\Attribute\AsHook;
#[AsHook('sqlGetFromDB')]
class SqlGetFromDBListener
{
public function __invoke(array $sql): array
{
// Modify the array of SQL statements
return $sql;
}
}