Skip to content

Commit

Permalink
Unlock Doctrine 3.x for Contao 4.13+ (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
fritzmg committed Apr 11, 2022
1 parent 8e303b4 commit 151acf6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -32,7 +32,7 @@
"symfony/dependency-injection": "^4.4 || ^5.0",
"symfony/event-dispatcher": "^4.4 || ^5.0",
"symfony/http-kernel": "^4.4 || ^5.0",
"doctrine/dbal": "^2.11",
"doctrine/dbal": "^2.11 || ^3.0",
"geoip2/geoip2": "~2.0"
},
"require-dev": {
Expand Down
6 changes: 3 additions & 3 deletions src/EventListener/DcaLoaderListener.php
Expand Up @@ -108,16 +108,16 @@ private function addFieldsToDCA(string $table): void

private function addHeaderInformation(string $table): void
{
$previous = $GLOBALS['TL_DCA'][$table]['list']['sorting']['header_callback'];
$previous = $GLOBALS['TL_DCA'][$table]['list']['sorting']['header_callback'] ?? null;

$GLOBALS['TL_DCA'][$table]['list']['sorting']['header_callback'] = function (array $header) use ($previous, $table): array {
$act = (string) Input::get('act');
$ptable = $GLOBALS['TL_DCA'][$table]['config']['ptable'];

if ('' === $act || 'select' === $act || ('paste' === $act && 'create' === Input::get('mode'))) {
$parent = $this->connection->fetchAssoc("SELECT * FROM $ptable WHERE id=?", [(int) Input::get('id')]);
$parent = $this->connection->fetchAssociative("SELECT * FROM $ptable WHERE id=?", [(int) Input::get('id')]);
} elseif ('paste' === $act) {
$parent = $this->connection->fetchAssoc("SELECT * FROM $ptable WHERE id=(SELECT pid FROM $table WHERE id=?)", [(int) Input::get('id')]);
$parent = $this->connection->fetchAssociative("SELECT * FROM $ptable WHERE id=(SELECT pid FROM $table WHERE id=?)", [(int) Input::get('id')]);
}

if (!$parent) {
Expand Down

0 comments on commit 151acf6

Please sign in to comment.