‪TYPO3CMS  11.5
PDOStatementImplementation.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
20 use Doctrine\DBAL\Driver\PDO\Exception as PDOException;
21 
22 if (PHP_VERSION_ID >= 80000) {
23  trait PDOStatementImplementation
24  {
28  public function fetchAll($mode = null, ...‪$args)
29  {
30  try {
31  $records = parent::fetchAll($mode, ...‪$args);
32 
33  if ($records !== false) {
34  $records = array_map([$this, 'mapResourceToString'], $records);
35  }
36 
37  return $records;
38  } catch (\PDOException $exception) {
39  throw new PDOException($exception);
40  }
41  }
42  }
43 } else {
44  trait PDOStatementImplementation
45  {
49  public function fetchAll($fetchMode = null, $fetchArgument = null, $ctorArgs = null)
50  {
51  try {
52  $records = parent::fetchAll($fetchMode, $fetchArgument, $ctorArgs);
53 
54  if ($records !== false) {
55  $records = array_map([$this, 'mapResourceToString'], $records);
56  }
57 
58  return $records;
59  } catch (\PDOException $exception) {
60  throw new PDOException($exception);
61  }
62  }
63  }
64 }
‪TYPO3\CMS\Core\Database\Driver
Definition: PDOConnection.php:18
‪$args
‪$args
Definition: validateRstFiles.php:214