1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* File containing the MigrationHandler class. |
5
|
|
|
* |
6
|
|
|
* @copyright Copyright (C) eZ Systems AS. All rights reserved. |
7
|
|
|
* @license For full copyright and license information view LICENSE file distributed with this source code. |
8
|
|
|
*/ |
9
|
|
|
namespace eZ\Bundle\EzPublishIOBundle\Migration; |
10
|
|
|
|
11
|
|
|
use eZ\Bundle\EzPublishIOBundle\ApiLoader\HandlerFactory; |
12
|
|
|
|
13
|
|
|
abstract class MigrationHandler implements MigrationHandlerInterface |
14
|
|
|
{ |
15
|
|
|
/** @var \eZ\Bundle\EzPublishIOBundle\ApiLoader\HandlerFactory */ |
16
|
|
|
private $metadataHandlerFactory; |
17
|
|
|
|
18
|
|
|
/** @var \eZ\Bundle\EzPublishIOBundle\ApiLoader\HandlerFactory */ |
19
|
|
|
private $binarydataHandlerFactory; |
20
|
|
|
|
21
|
|
|
/** @var \eZ\Publish\Core\IO\IOMetadataHandler */ |
22
|
|
|
protected $fromMetadataHandler; |
23
|
|
|
|
24
|
|
|
/** @var \eZ\Publish\Core\IO\IOBinarydataHandler */ |
25
|
|
|
protected $fromBinarydataHandler; |
26
|
|
|
|
27
|
|
|
/** @var \eZ\Publish\Core\IO\IOMetadataHandler */ |
28
|
|
|
protected $toMetadataHandler; |
29
|
|
|
|
30
|
|
|
/** @var \eZ\Publish\Core\IO\IOBinarydataHandler */ |
31
|
|
|
protected $toBinarydataHandler; |
32
|
|
|
|
33
|
|
|
public function __construct(HandlerFactory $metadataHandlerFactory, HandlerFactory $binarydataHandlerFactory) |
34
|
|
|
{ |
35
|
|
|
$this->metadataHandlerFactory = $metadataHandlerFactory; |
36
|
|
|
$this->binarydataHandlerFactory = $binarydataHandlerFactory; |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
public function setIODataHandlersByIdentifiers( |
40
|
|
|
$fromMetadataHandlerIdentifier, |
41
|
|
|
$fromBinarydataHandlerIdentifier, |
42
|
|
|
$toMetadataHandlerIdentifier, |
43
|
|
|
$toBinarydataHandlerIdentifier |
44
|
|
|
) { |
45
|
|
|
$this->fromMetadataHandler = $this->metadataHandlerFactory->getConfiguredHandler($fromMetadataHandlerIdentifier); |
46
|
|
|
$this->fromBinarydataHandler = $this->binarydataHandlerFactory->getConfiguredHandler($fromBinarydataHandlerIdentifier); |
47
|
|
|
$this->toMetadataHandler = $this->metadataHandlerFactory->getConfiguredHandler($toMetadataHandlerIdentifier); |
48
|
|
|
$this->toBinarydataHandler = $this->binarydataHandlerFactory->getConfiguredHandler($toBinarydataHandlerIdentifier); |
49
|
|
|
|
50
|
|
|
return $this; |
51
|
|
|
} |
52
|
|
|
} |
53
|
|
|
|