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

MigrationHandler.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Bundle\EzPublishIOBundle\Migration;
8
9 use eZ\Bundle\EzPublishIOBundle\ApiLoader\HandlerFactory;
10 use Psr\Log\LoggerInterface;
11
15 abstract class MigrationHandler implements MigrationHandlerInterface
16 {
18 private $metadataHandlerFactory;
19
21 private $binarydataHandlerFactory;
22
24 private $logger;
25
27 protected $fromMetadataHandler;
28
30 protected $fromBinarydataHandler;
31
33 protected $toMetadataHandler;
34
36 protected $toBinarydataHandler;
37
38 public function __construct(
39 HandlerFactory $metadataHandlerFactory,
40 HandlerFactory $binarydataHandlerFactory,
41 LoggerInterface $logger = null
42 ) {
43 $this->metadataHandlerFactory = $metadataHandlerFactory;
44 $this->binarydataHandlerFactory = $binarydataHandlerFactory;
45 $this->logger = $logger;
46 }
47
48 public function setIODataHandlersByIdentifiers(
49 $fromMetadataHandlerIdentifier,
50 $fromBinarydataHandlerIdentifier,
51 $toMetadataHandlerIdentifier,
52 $toBinarydataHandlerIdentifier
53 ) {
54 $this->fromMetadataHandler = $this->metadataHandlerFactory->getConfiguredHandler($fromMetadataHandlerIdentifier);
55 $this->fromBinarydataHandler = $this->binarydataHandlerFactory->getConfiguredHandler($fromBinarydataHandlerIdentifier);
56 $this->toMetadataHandler = $this->metadataHandlerFactory->getConfiguredHandler($toMetadataHandlerIdentifier);
57 $this->toBinarydataHandler = $this->binarydataHandlerFactory->getConfiguredHandler($toBinarydataHandlerIdentifier);
58
59 return $this;
60 }
61
62 final protected function logError($message)
63 {
64 if (isset($this->logger)) {
65 $this->logger->error($message);
66 }
67 }
68
69 final protected function logInfo($message)
70 {
71 if (isset($this->logger)) {
72 $this->logger->info($message);
73 }
74 }
75
76 final protected function logMissingFile($id)
77 {
78 $this->logInfo("File with id $id not found");
79 }
80 }
eZ\Bundle\EzPublishIOBundle\ApiLoader\HandlerFactory
Factory of IO handlers, given an alias.
Definition: HandlerFactory.php:17
eZ\Bundle\EzPublishIOBundle\Migration\MigrationHandler
The migration handler sets up from/to IO data handlers, and provides logging, for file migrators and ...
Definition: MigrationHandler.php:16
eZ\Bundle\EzPublishIOBundle\Migration\MigrationHandler\$fromBinarydataHandler
$fromBinarydataHandler
Definition: MigrationHandler.php:30
eZ\Bundle\EzPublishIOBundle\Migration\MigrationHandler\$binarydataHandlerFactory
$binarydataHandlerFactory
Definition: MigrationHandler.php:21
eZ\Bundle\EzPublishIOBundle\Migration\MigrationHandler\$toBinarydataHandler
$toBinarydataHandler
Definition: MigrationHandler.php:36
eZ\Bundle\EzPublishIOBundle\Migration\MigrationHandler\$metadataHandlerFactory
$metadataHandlerFactory
Definition: MigrationHandler.php:18
eZ\Bundle\EzPublishIOBundle\Migration\MigrationHandler\logError
logError($message)
Definition: MigrationHandler.php:62
eZ\Bundle\EzPublishIOBundle\Migration\MigrationHandler\$fromMetadataHandler
$fromMetadataHandler
Definition: MigrationHandler.php:27
eZ\Bundle\EzPublishIOBundle\Migration\MigrationHandler\__construct
__construct(HandlerFactory $metadataHandlerFactory, HandlerFactory $binarydataHandlerFactory, LoggerInterface $logger=null)
Definition: MigrationHandler.php:38
eZ\Bundle\EzPublishIOBundle\Migration\MigrationHandler\$toMetadataHandler
$toMetadataHandler
Definition: MigrationHandler.php:33
eZ\Bundle\EzPublishIOBundle\Migration\MigrationHandler\logMissingFile
logMissingFile($id)
Definition: MigrationHandler.php:76
eZ\Bundle\EzPublishIOBundle\Migration\MigrationHandler\logInfo
logInfo($message)
Definition: MigrationHandler.php:69
eZ\Bundle\EzPublishIOBundle\Migration\MigrationHandler\setIODataHandlersByIdentifiers
setIODataHandlersByIdentifiers( $fromMetadataHandlerIdentifier, $fromBinarydataHandlerIdentifier, $toMetadataHandlerIdentifier, $toBinarydataHandlerIdentifier)
Set the from/to handlers based on identifiers.
Definition: MigrationHandler.php:48
eZ\Bundle\EzPublishIOBundle\Migration\MigrationHandler\$logger
$logger
Definition: MigrationHandler.php:24
eZ\Bundle\EzPublishIOBundle\Migration\MigrationHandlerInterface
Definition: MigrationHandlerInterface.php:10
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.