Pārlūkot izejas kodu

replace deprecated doctrine methods

Olivier Massot 1 gadu atpakaļ
vecāks
revīzija
c18019b9e3

+ 8 - 12
ot_admin/Classes/Controller/SiteController.php

@@ -573,19 +573,17 @@ class SiteController extends ActionController
             $queryBuilder->insert('sys_filemounts')
                 ->values([
                     'title' => 'Documents',
-                    'path' => rtrim($uploadRelPath, '/') . '/',
-                    'base' => 1
+                    'path' => rtrim($uploadRelPath, '/') . '/'
                 ])
-                ->execute();
+                ->executeStatement();
 
             $queryBuilder = $this->connectionPool->getQueryBuilderForTable('sys_filemounts');
             $queryBuilder->insert('sys_filemounts')
                 ->values([
                     'title' => 'Forms_' . $organizationId,
-                    'path' => rtrim($formsRelPath, '/') . '/',
-                    'base' => 1
+                    'path' => rtrim($formsRelPath, '/') . '/'
                 ])
-                ->execute();
+                ->executeStatement();
 
             // Create the BE Editors group
             // -- NB: this user will then be auto-updated by the ot_connect extension --
@@ -856,7 +854,7 @@ class SiteController extends ActionController
                 ->from('sys_filemounts')
                 ->where("path LIKE '%user_upload/" . $organizationId . "/%'")
                 ->orWhere("path LIKE '%form_definitions/" . $organizationId . "/%'");
-            $statement = $queryBuilder->execute();
+            $statement = $queryBuilder->executeQuery();
             $rows = $statement->fetchAllAssociative();
             foreach ($rows as $row) {
                 $this->delete('sys_filemounts', 'uid', $row['uid'], $hard);
@@ -900,15 +898,15 @@ class SiteController extends ActionController
                             $subdir = $dir . $subdir;
                             if (!is_dir($subdir)) {
                                 throw new RuntimeException(
-                                    'The directory ' . $dir . ' contains non-directory files' .
-                                    ', this humble script prefers not to take care of them automatically. Abort.');
+                                    'The directory ' . $dir . ' contains directories' .
+                                    ', please delete them manually. Abort.');
                             }
                             if (is_readable($subdir)) {
                                 foreach (scandir($subdir) as $filename) {
                                     if ($filename !== '.' && $filename !== '..') {
                                         throw new RuntimeException(
                                             'The directory ' . $subdir . ' is not empty, ' .
-                                            'this humble script prefers not to take care of them automatically. Abort.');
+                                            'please delete it manually. Abort.');
                                     }
                                 }
                             }
@@ -2006,7 +2004,6 @@ class SiteController extends ActionController
             'pid' => $pid,
             'perms_groupid' => 3,
             'perms_user' => 27,
-            'cruser_id' => 1,
             'dokType' => self::DOK_PAGE,
             'title' => $title,
             'slug' => $slug,
@@ -2073,7 +2070,6 @@ class SiteController extends ActionController
     {
         $defaultValues = [
             'pid' => $pid,
-            'cruser_id' => 1,
             'CType' => $cType,
             'colPos' => $colPos,
             'bodyText' => $bodyText

+ 20 - 10
ot_core/Classes/Website/OtWebsiteRepository.php

@@ -46,8 +46,8 @@ class OtWebsiteRepository
         if ($withRestrictions) {
             $q->where($q->expr()->eq('deleted', 0));
         }
-        return $q->execute()
-                 ->fetchAll();
+        return $q->executeQuery()
+                 ->fetchAllAssociative();
     }
 
     /**
@@ -65,7 +65,9 @@ class OtWebsiteRepository
         if ($withRestrictions) {
             $q->andWhere($q->expr()->eq('deleted', 0));
         }
-        $website = $q->execute()->fetch();
+        $website = $q
+            ->executeQuery()
+            ->fetchAssociative();
 
         if (!isset($website['uid'])) {
             throw new NoSuchWebsiteException('No website found with uid ' . $uid);
@@ -89,7 +91,9 @@ class OtWebsiteRepository
         if ($withRestrictions) {
             $q->andWhere($q->expr()->eq('deleted', 0));
         }
-        $website = $q->execute()->fetch();
+        $website = $q
+            ->executeQuery()
+            ->fetchAssociative();
 
         if (!isset($website['uid'])) {
             throw new NoSuchWebsiteException('No website found for organization ' . $organizationId);
@@ -116,7 +120,10 @@ class OtWebsiteRepository
         if ($withRestrictions) {
             $q->andWhere($q->expr()->eq('w.deleted', 0));
         }
-        $website = $q->execute()->fetch();
+        $website = $q
+            ->executeQuery()
+            ->fetchAssociative();
+
         if (!isset($website['uid'])) {
             throw new NoSuchWebsiteException('No website found for page ' . $pageUid);
         }
@@ -135,8 +142,8 @@ class OtWebsiteRepository
             ->select('*')
             ->from('ot_websites')
             ->where($queryBuilder->expr()->eq('config_identifier', $queryBuilder->expr()->literal($identifier)))
-            ->execute()
-            ->fetch();
+            ->executeQuery()
+            ->fetchAssociative();
         if (!isset($website['uid'])) {
             throw new NoSuchWebsiteException('No website found for identifier ' . $identifier);
         }
@@ -164,7 +171,7 @@ class OtWebsiteRepository
         if ($withRestrictions) {
             $q->andWhere($q->expr()->eq('deleted', 0));
         }
-        $rootUid = $q->executeQuery()->fetchFirstColumn()[0];
+        $rootUid = $q->executeQuery()->fetchOne();
         if (!($rootUid > 0)) {
             throw new NoSuchRecordException('No root page found for website ' . $websiteUid);
         }
@@ -195,7 +202,10 @@ class OtWebsiteRepository
         if ($withRestrictions) {
             $q->andWhere($q->expr()->eq('w.deleted', 0));
         }
-        $rootUid = $q->execute()->fetchColumn(0);
+        $rootUid = $q
+            ->executeQuery()
+            ->fetchOne();
+
         if (!$rootUid) {
             throw new NoSuchWebsiteException("No website found for organization " . $organizationId);
         }
@@ -404,7 +414,7 @@ class OtWebsiteRepository
             ->where($q->expr()->eq('ot_website_uid', $otWebsite['uid']))
             ->andWhere($q->expr()->eq('slug', $q->expr()->literal($tail)))
             ->executeQuery()
-            ->fetchFirstColumn()[0];
+            ->fetchOne();
     }
 
     /**