Exponential 5.x Kernel 7.5.40 Exponential New Stack (Symfony-based) Kernel — PHP Class Reference

LegacyStorageFileRowReader.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Bundle\EzPublishIOBundle\Migration\FileLister\FileRowReader;
8
9 use eZ\Bundle\EzPublishIOBundle\Migration\FileLister\FileRowReaderInterface;
10 use eZ\Publish\Core\Persistence\Database\DatabaseHandler;
11
12 abstract class LegacyStorageFileRowReader implements FileRowReaderInterface
13 {
15 private $dbHandler;
16
18 private $statement;
19
23 public function __construct(DatabaseHandler $dbHandler)
24 {
25 $this->dbHandler = $dbHandler;
26 }
27
28 final public function init()
29 {
30 $selectQuery = $this->dbHandler->createSelectQuery();
31 $selectQuery->select('filename, mime_type')->from($this->dbHandler->quoteTable($this->getStorageTable()));
32 $this->statement = $selectQuery->prepare();
33 $this->statement->execute();
34 }
35
41 abstract protected function getStorageTable();
42
43 final public function getRow()
44 {
45 $row = $this->statement->fetch();
46
47 return $this->prependMimeToPath($row['filename'], $row['mime_type']);
48 }
49
50 final public function getCount()
51 {
52 return $this->statement->rowCount();
53 }
54
63 private function prependMimeToPath($path, $mimeType)
64 {
65 return substr($mimeType, 0, strpos($mimeType, '/')) . '/' . $path;
66 }
67 }
eZ\Bundle\EzPublishIOBundle\Migration\FileLister\FileRowReader\LegacyStorageFileRowReader
Definition: LegacyStorageFileRowReader.php:13
eZ\Bundle\EzPublishIOBundle\Migration\FileLister\FileRowReader\LegacyStorageFileRowReader\$dbHandler
$dbHandler
Definition: LegacyStorageFileRowReader.php:15
eZ\Bundle\EzPublishIOBundle\Migration\FileLister\FileRowReader\LegacyStorageFileRowReader\init
init()
Initializes the reader.
Definition: LegacyStorageFileRowReader.php:28
eZ\Bundle\EzPublishIOBundle\Migration\FileLister\FileRowReader\LegacyStorageFileRowReader\$statement
$statement
Definition: LegacyStorageFileRowReader.php:18
eZ\Bundle\EzPublishIOBundle\Migration\FileLister\FileRowReader\LegacyStorageFileRowReader\prependMimeToPath
prependMimeToPath($path, $mimeType)
Prepends $path with the first part of the given $mimeType.
Definition: LegacyStorageFileRowReader.php:63
eZ\Bundle\EzPublishIOBundle\Migration\FileLister\FileRowReader\LegacyStorageFileRowReader\getStorageTable
getStorageTable()
Returns the table name to store data in.
eZ\Bundle\EzPublishIOBundle\Migration\FileLister\FileRowReader\LegacyStorageFileRowReader\getRow
getRow()
Returns the next row from the data source.
Definition: LegacyStorageFileRowReader.php:43
eZ\Bundle\EzPublishIOBundle\Migration\FileLister\FileRowReader\LegacyStorageFileRowReader\__construct
__construct(DatabaseHandler $dbHandler)
Definition: LegacyStorageFileRowReader.php:23
eZ\Bundle\EzPublishIOBundle\Migration\FileLister\FileRowReader\LegacyStorageFileRowReader\getCount
getCount()
Returns the total row count.
Definition: LegacyStorageFileRowReader.php:50
eZ\Bundle\EzPublishIOBundle\Migration\FileLister\FileRowReaderInterface
Reads files from a data source.
Definition: FileRowReaderInterface.php:13
eZ\Publish\Core\Persistence\Database\DatabaseHandler
Interface for relational database abstractions supported by eZ.
Definition: DatabaseHandler.php:18
eZ\Bundle\EzPublishIOBundle\Migration\FileLister\FileRowReader
Definition: LegacyStorageBinaryFileRowReader.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.