Skip to content

Commit 5be7f88

Browse files
committed
Remove deprecations from dbal
1 parent 6aed3f8 commit 5be7f88

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/Migration/ThemeMigration.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
use Contao\CoreBundle\Twig\Loader\ContaoFilesystemLoaderWarmer;
1818
use Doctrine\DBAL\Connection;
1919
use Doctrine\DBAL\Exception;
20-
use Doctrine\DBAL\FetchMode;
2120
use Richardhj\ContaoThemeFramework\Configuration\ThemeManifestConfiguration;
2221
use Richardhj\ContaoThemeFramework\Configuration\YamlLoader;
2322
use Symfony\Component\Config\Definition\Processor;
@@ -75,7 +74,7 @@ public function shouldRun(): bool
7574
$persistedHash = $this->connection
7675
->executeQuery('SELECT manifestHash FROM tl_theme WHERE alias=:alias', [
7776
'alias' => $manifest->getRelativePath(),
78-
])->fetchColumn();
77+
])->fetchOne();
7978

8079
if ($persistedHash !== $manifestHash) {
8180
return true;
@@ -122,7 +121,7 @@ private function persistManifest(string $themeName, array $manifest, string $man
122121
{
123122
$row = $this->connection
124123
->executeQuery('SELECT id, manifestHash FROM tl_theme WHERE alias=:alias', ['alias' => $themeName])
125-
->fetch(FetchMode::ASSOCIATIVE);
124+
->fetchAssociative();
126125

127126
// Prevent array-access error when theme not found
128127
$row = false === $row ? [] : $row;
@@ -202,12 +201,12 @@ private function persistLayouts($layouts, int $themeId)
202201
foreach ($layouts as $layoutName => $layout) {
203202
$layoutId = $this->connection
204203
->executeQuery('SELECT id FROM tl_layout WHERE pid=:pid AND alias=:alias', ['pid' => $themeId, 'alias' => $layoutName])
205-
->fetch(FetchMode::NUMERIC)[0] ?? null;
204+
->fetchOne();
206205

207206
$data = array_merge(['framework' => ''], $layout);
208207
$data = array_merge($data, ['alias' => $layoutName, 'pid' => $themeId, 'tstamp' => time()]);
209208

210-
if (null === $layoutId) {
209+
if (false === $layoutId) {
211210
// For new layouts, enable the article module in the main column
212211
$data = array_merge(['modules' => serialize([['mod' => '0', 'col' => 'main', 'enable' => '1']])], $data);
213212

@@ -232,15 +231,16 @@ private function persistImageSizes(array $imageSizes, int $themeId): void
232231
foreach ($imageSizes as $imageSizeName => $imageSize) {
233232
$imageSizeId = $this->connection
234233
->executeQuery('SELECT id FROM tl_image_size WHERE pid=:pid AND alias=:alias', ['pid' => $themeId, 'alias' => $imageSizeName])
235-
->fetch(FetchMode::NUMERIC)[0] ?? null;
234+
->fetchOne();
236235

237236
$items = $imageSize['items'];
238237
unset($imageSize['items']);
239238

240239
$data = array_merge($imageSize, ['alias' => $imageSizeName, 'name' => $imageSizeName, 'pid' => $themeId, 'tstamp' => time()]);
241240

242-
if (null === $imageSizeId) {
241+
if (false === $imageSizeId) {
243242
$this->connection->insert('tl_image_size', $data);
243+
$imageSizeId = $this->connection->lastInsertId();
244244
} else {
245245
$this->connection->update('tl_image_size', $data, ['id' => $imageSizeId]);
246246
}

0 commit comments

Comments
 (0)