1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* @license LGPLv3, http://opensource.org/licenses/LGPL-3.0 |
5
|
|
|
* @copyright Aimeos (aimeos.org), 2014-2017 |
6
|
|
|
*/ |
7
|
|
|
|
8
|
|
|
|
9
|
|
|
namespace Aimeos\MW\Setup\Task; |
10
|
|
|
|
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* Adds FOS user customer test data. |
14
|
|
|
*/ |
15
|
|
|
class CustomerAddFosUserTestData extends \Aimeos\MW\Setup\Task\CustomerAddTestData |
16
|
|
|
{ |
17
|
|
|
/** |
18
|
|
|
* Returns the list of task names which this task depends on. |
19
|
|
|
* |
20
|
|
|
* @return string[] List of task names |
21
|
|
|
*/ |
22
|
|
|
public function getPreDependencies() |
23
|
|
|
{ |
24
|
|
|
return array( 'TablesCreateFosUser' ); |
25
|
|
|
} |
26
|
|
|
|
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* Adds attribute test data. |
30
|
|
|
*/ |
31
|
|
|
public function migrate() |
32
|
|
|
{ |
33
|
|
|
$iface = '\\Aimeos\\MShop\\Context\\Item\\Iface'; |
34
|
|
|
if( !( $this->additional instanceof $iface ) ) { |
35
|
|
|
throw new \Aimeos\MW\Setup\Exception( sprintf( 'Additionally provided object is not of type "%1$s"', $iface ) ); |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
$this->msg( 'Adding Fos user bundle customer test data', 0 ); |
39
|
|
|
|
40
|
|
|
$parentIds = []; |
41
|
|
|
$ds = DIRECTORY_SEPARATOR; |
42
|
|
|
$this->additional->setEditor( 'ai-fosuser:unittest' ); |
43
|
|
|
$path = __DIR__ . $ds . 'data' . $ds . 'customer.php'; |
44
|
|
|
|
45
|
|
|
if( ( $testdata = include( $path ) ) === false ){ |
46
|
|
|
throw new \Aimeos\MShop\Exception( sprintf( 'No file "%1$s" found for customer domain', $path ) ); |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
|
50
|
|
|
$customerManager = \Aimeos\MShop\Customer\Manager\Factory::createManager( $this->additional, 'FosUser' ); |
51
|
|
|
$customerAddressManager = $customerManager->getSubManager( 'address', 'FosUser' ); |
52
|
|
|
|
53
|
|
|
$search = $customerManager->createSearch(); |
54
|
|
|
$search->setConditions( $search->compare( '==', 'customer.code', array( 'UTC001', 'UTC002', 'UTC003' ) ) ); |
55
|
|
|
$items = $customerManager->searchItems( $search ); |
56
|
|
|
|
57
|
|
|
$this->conn->begin(); |
|
|
|
|
58
|
|
|
|
59
|
|
|
$customerManager->deleteItems( array_keys( $items ) ); |
60
|
|
|
$parentIds = $this->addCustomerData( $testdata, $customerManager, $customerAddressManager->createItem() ); |
61
|
|
|
$this->addCustomerAddressData( $testdata, $customerAddressManager, $parentIds ); |
62
|
|
|
|
63
|
|
|
$this->conn->commit(); |
|
|
|
|
64
|
|
|
|
65
|
|
|
|
66
|
|
|
$this->status( 'done' ); |
67
|
|
|
} |
68
|
|
|
} |
69
|
|
|
|
This property has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead.