Support doctrine/dbal 3

This commit is contained in:
David Molineus
2022-02-21 20:11:56 +01:00
parent 87bd720d6e
commit 852b926252
4 changed files with 18 additions and 22 deletions

View File

@@ -147,9 +147,9 @@ class ControlDcaListener extends AbstractListener
$statement = $this->connection->prepare($query);
$statement->bindValue('cid', $dataContainer->id);
$statement->execute();
$result = $statement->executeQuery();
return $statement->fetchAll();
return $result->fetchAllAssociative();
}
/**
@@ -167,9 +167,9 @@ class ControlDcaListener extends AbstractListener
$query = 'SELECT * FROM tl_leaflet_control_layer WHERE cid=:cid order BY sorting';
$statement = $this->connection->prepare($query);
$statement->bindValue('cid', $dataContainer->id);
$statement->execute();
$result = $statement->executeQuery();
while ($row = $statement->fetch()) {
while ($row = $result->fetchAssociative()) {
$values[$row['lid']] = $row;
}

View File

@@ -361,25 +361,25 @@ class LayerDcaListener extends AbstractListener
if ($undoId) {
$statement = $this->connection->prepare('SELECT * FROM tl_undo WHERE id=:id LIMIT 0,1');
$statement->bindValue('id', $undoId);
$statement->execute();
$result = $statement->executeQuery();
$undo = $statement->fetch();
$undo = $result->fetchAssociative();
$statement = $this->connection->prepare('SELECT * FROM tl_leaflet_map_layer WHERE lid=:lid');
$statement->bindValue('lid', $dataContainer->id);
$statement->execute();
$result = $statement->executeQuery();
$undo['data'] = StringUtil::deserialize($undo['data'], true);
while ($row = $statement->fetch()) {
while ($row = $result->fetchAssociative()) {
$undo['data']['tl_leaflet_map_layer'][] = $row;
}
$statement = $this->connection->prepare('SELECT * FROM tl_leaflet_control_layer WHERE lid=:lid');
$statement->bindValue('lid', $dataContainer->id);
$statement->execute();
$result = $statement->executeQuery();
$undo['data']['tl_leaflet_control_layer'] = $statement->fetchAll();
$undo['data']['tl_leaflet_control_layer'] = $result->fetchAllAssociative();
$this->connection->update('tl_undo', ['data' => $undo['data']], ['id' => $undo['id']]);
}

View File

@@ -24,7 +24,6 @@ use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager;
use Netzmacht\Contao\Toolkit\Dca\Listener\AbstractListener;
use Netzmacht\Contao\Toolkit\Dca\Manager;
use Netzmacht\Contao\Toolkit\Dca\Options\OptionsBuilder;
use PDO;
use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Component\Translation\TranslatorInterface as Translator;
@@ -136,12 +135,9 @@ class MapDcaListener extends AbstractListener
{
$statement = $this->connection->prepare('SELECT lid FROM tl_leaflet_map_layer WHERE mid=:mid ORDER BY sorting');
$statement->bindValue('mid', $dataContainer->id);
$result = $statement->executeQuery();
if ($statement->execute()) {
return $statement->fetchAll(PDO::FETCH_COLUMN, 0);
}
return [];
return $result->fetchFirstColumn();
}
/**
@@ -159,9 +155,9 @@ class MapDcaListener extends AbstractListener
$statement = $this->connection->prepare('SELECT * FROM tl_leaflet_map_layer WHERE mid=:mid order BY sorting');
$statement->bindValue('mid', $dataContainer->id);
$statement->execute();
$result = $statement->executeQuery();
while ($row = $statement->fetch()) {
while ($row = $result->fetchAssociative()) {
$values[$row['lid']] = $row;
}
@@ -239,9 +235,9 @@ class MapDcaListener extends AbstractListener
{
$statement = $this->connection->prepare('SELECT * FROM tl_leaflet_map_layer WHERE mid=:mid order BY sorting');
$statement->bindValue('mid', $dataContainer->id);
$statement->execute();
$result = $statement->executeQuery();
while ($row = $statement->fetch(PDO::FETCH_ASSOC)) {
while ($row = $result->fetchAssociative()) {
unset($row['id']);
$row['tstamp'] = time();
$row['mid'] = $insertId;

View File

@@ -145,9 +145,9 @@ class MarkerDcaListener
$statement = $this->connection->prepare($query);
$statement->bindValue('id', $dataContainer->id);
$statement->execute();
$result = $statement->executeQuery();
if ($row = $statement->fetch()) {
if ($row = $result->fetchAssociative()) {
$buffer = $row['latitude'];
if ($buffer && $row['longitude']) {