| 1: | <?php |
| 2: | |
| 3: | declare(strict_types=1); |
| 4: | |
| 5: | namespace Atk4\Data\Persistence\Sql\Sqlite; |
| 6: | |
| 7: | use Atk4\Data\Persistence\Sql\Connection as BaseConnection; |
| 8: | use Doctrine\DBAL\Configuration; |
| 9: | use Doctrine\DBAL\Driver\AbstractSQLiteDriver\Middleware\EnableForeignKeys; |
| 10: | |
| 11: | class Connection extends BaseConnection |
| 12: | { |
| 13: | protected string $expressionClass = Expression::class; |
| 14: | protected string $queryClass = Query::class; |
| 15: | |
| 16: | #[\Override] |
| 17: | protected static function createDbalConfiguration(): Configuration |
| 18: | { |
| 19: | $configuration = parent::createDbalConfiguration(); |
| 20: | |
| 21: | $configuration->setMiddlewares([...$configuration->getMiddlewares(), new EnableForeignKeys()]); |
| 22: | |
| 23: | return $configuration; |
| 24: | } |
| 25: | } |
| 26: | |