17
17
use Contao \CoreBundle \Twig \Loader \ContaoFilesystemLoaderWarmer ;
18
18
use Doctrine \DBAL \Connection ;
19
19
use Doctrine \DBAL \Exception ;
20
- use Doctrine \DBAL \FetchMode ;
21
20
use Richardhj \ContaoThemeFramework \Configuration \ThemeManifestConfiguration ;
22
21
use Richardhj \ContaoThemeFramework \Configuration \YamlLoader ;
23
22
use Symfony \Component \Config \Definition \Processor ;
@@ -75,7 +74,7 @@ public function shouldRun(): bool
75
74
$ persistedHash = $ this ->connection
76
75
->executeQuery ('SELECT manifestHash FROM tl_theme WHERE alias=:alias ' , [
77
76
'alias ' => $ manifest ->getRelativePath (),
78
- ])->fetchColumn ();
77
+ ])->fetchOne ();
79
78
80
79
if ($ persistedHash !== $ manifestHash ) {
81
80
return true ;
@@ -122,7 +121,7 @@ private function persistManifest(string $themeName, array $manifest, string $man
122
121
{
123
122
$ row = $ this ->connection
124
123
->executeQuery ('SELECT id, manifestHash FROM tl_theme WHERE alias=:alias ' , ['alias ' => $ themeName ])
125
- ->fetch (FetchMode:: ASSOCIATIVE );
124
+ ->fetchAssociative ( );
126
125
127
126
// Prevent array-access error when theme not found
128
127
$ row = false === $ row ? [] : $ row ;
@@ -202,12 +201,12 @@ private function persistLayouts($layouts, int $themeId)
202
201
foreach ($ layouts as $ layoutName => $ layout ) {
203
202
$ layoutId = $ this ->connection
204
203
->executeQuery ('SELECT id FROM tl_layout WHERE pid=:pid AND alias=:alias ' , ['pid ' => $ themeId , 'alias ' => $ layoutName ])
205
- ->fetch (FetchMode:: NUMERIC )[ 0 ] ?? null ;
204
+ ->fetchOne () ;
206
205
207
206
$ data = array_merge (['framework ' => '' ], $ layout );
208
207
$ data = array_merge ($ data , ['alias ' => $ layoutName , 'pid ' => $ themeId , 'tstamp ' => time ()]);
209
208
210
- if (null === $ layoutId ) {
209
+ if (false === $ layoutId ) {
211
210
// For new layouts, enable the article module in the main column
212
211
$ data = array_merge (['modules ' => serialize ([['mod ' => '0 ' , 'col ' => 'main ' , 'enable ' => '1 ' ]])], $ data );
213
212
@@ -232,15 +231,16 @@ private function persistImageSizes(array $imageSizes, int $themeId): void
232
231
foreach ($ imageSizes as $ imageSizeName => $ imageSize ) {
233
232
$ imageSizeId = $ this ->connection
234
233
->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 () ;
236
235
237
236
$ items = $ imageSize ['items ' ];
238
237
unset($ imageSize ['items ' ]);
239
238
240
239
$ data = array_merge ($ imageSize , ['alias ' => $ imageSizeName , 'name ' => $ imageSizeName , 'pid ' => $ themeId , 'tstamp ' => time ()]);
241
240
242
- if (null === $ imageSizeId ) {
241
+ if (false === $ imageSizeId ) {
243
242
$ this ->connection ->insert ('tl_image_size ' , $ data );
243
+ $ imageSizeId = $ this ->connection ->lastInsertId ();
244
244
} else {
245
245
$ this ->connection ->update ('tl_image_size ' , $ data , ['id ' => $ imageSizeId ]);
246
246
}
0 commit comments