|
@@ -21,7 +21,7 @@ discard block |
|
|
block discarded – undo |
|
21
|
21
|
*/ |
|
22
|
22
|
public function getPreDependencies() |
|
23
|
23
|
{ |
|
24
|
|
- return array( 'TablesAddLaravelTestData' ); |
|
|
24
|
+ return array('TablesAddLaravelTestData'); |
|
25
|
25
|
} |
|
26
|
26
|
|
|
27
|
27
|
|
|
@@ -31,36 +31,36 @@ discard block |
|
|
block discarded – undo |
|
31
|
31
|
protected function process() |
|
32
|
32
|
{ |
|
33
|
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 ) ); |
|
|
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
|
36
|
} |
|
37
|
37
|
|
|
38
|
|
- $this->msg( 'Adding Laravel customer test data', 0 ); |
|
39
|
|
- $this->additional->setEditor( 'ai-laravel:unittest' ); |
|
|
38
|
+ $this->msg('Adding Laravel customer test data', 0); |
|
|
39
|
+ $this->additional->setEditor('ai-laravel:unittest'); |
|
40
|
40
|
|
|
41
|
41
|
$parentIds = array(); |
|
42
|
42
|
$ds = DIRECTORY_SEPARATOR; |
|
43
|
|
- $path = __DIR__ . $ds . 'data' . $ds . 'customer.php'; |
|
|
43
|
+ $path = __DIR__.$ds.'data'.$ds.'customer.php'; |
|
44
|
44
|
|
|
45
|
|
- if( ( $testdata = include( $path ) ) == false ){ |
|
46
|
|
- throw new \Aimeos\MShop\Exception( sprintf( 'No file "%1$s" found for customer domain', $path ) ); |
|
|
45
|
+ if (($testdata = include($path)) == false) { |
|
|
46
|
+ throw new \Aimeos\MShop\Exception(sprintf('No file "%1$s" found for customer domain', $path)); |
|
47
|
47
|
} |
|
48
|
48
|
|
|
49
|
49
|
|
|
50
|
|
- $customerManager = \Aimeos\MShop\Customer\Manager\Factory::createManager( $this->additional, 'Laravel' ); |
|
51
|
|
- $customerAddressManager = $customerManager->getSubManager( 'address', 'Laravel' ); |
|
|
50
|
+ $customerManager = \Aimeos\MShop\Customer\Manager\Factory::createManager($this->additional, 'Laravel'); |
|
|
51
|
+ $customerAddressManager = $customerManager->getSubManager('address', 'Laravel'); |
|
52
|
52
|
|
|
53
|
|
- $this->cleanupCustomerData( $customerManager, $customerAddressManager ); |
|
|
53
|
+ $this->cleanupCustomerData($customerManager, $customerAddressManager); |
|
54
|
54
|
|
|
55
|
55
|
$this->conn->begin(); |
|
56
|
56
|
|
|
57
|
|
- $parentIds = $this->addCustomerData( $testdata, $customerManager, $customerAddressManager->createItem() ); |
|
58
|
|
- $this->addCustomerAddressData( $testdata, $customerAddressManager, $parentIds ); |
|
|
57
|
+ $parentIds = $this->addCustomerData($testdata, $customerManager, $customerAddressManager->createItem()); |
|
|
58
|
+ $this->addCustomerAddressData($testdata, $customerAddressManager, $parentIds); |
|
59
|
59
|
|
|
60
|
60
|
$this->conn->commit(); |
|
61
|
61
|
|
|
62
|
62
|
|
|
63
|
|
- $this->status( 'done' ); |
|
|
63
|
+ $this->status('done'); |
|
64
|
64
|
} |
|
65
|
65
|
|
|
66
|
66
|
|
|
@@ -70,17 +70,17 @@ discard block |
|
|
block discarded – undo |
|
70
|
70
|
* @param \Aimeos\MShop\Common\Manager\Iface $customerManager Customer manager |
|
71
|
71
|
* @param \Aimeos\MShop\Common\Manager\Iface $customerAddressManager Customer address manager |
|
72
|
72
|
*/ |
|
73
|
|
- protected function cleanupCustomerData( \Aimeos\MShop\Common\Manager\Iface $customerManager, \Aimeos\MShop\Common\Manager\Iface $customerAddressManager ) |
|
|
73
|
+ protected function cleanupCustomerData(\Aimeos\MShop\Common\Manager\Iface $customerManager, \Aimeos\MShop\Common\Manager\Iface $customerAddressManager) |
|
74
|
74
|
{ |
|
75
|
75
|
$search = $customerManager->createSearch(); |
|
76
|
|
- $search->setConditions( $search->compare( '=~', 'customer.code', 'unitCustomer' ) ); |
|
77
|
|
- $customerItems = $customerManager->searchItems( $search ); |
|
|
76
|
+ $search->setConditions($search->compare('=~', 'customer.code', 'unitCustomer')); |
|
|
77
|
+ $customerItems = $customerManager->searchItems($search); |
|
78
|
78
|
|
|
79
|
79
|
$search = $customerAddressManager->createSearch(); |
|
80
|
|
- $search->setConditions( $search->compare( '=~', 'customer.address.email', 'unitCustomer' ) ); |
|
81
|
|
- $addressItems = $customerAddressManager->searchItems( $search ); |
|
|
80
|
+ $search->setConditions($search->compare('=~', 'customer.address.email', 'unitCustomer')); |
|
|
81
|
+ $addressItems = $customerAddressManager->searchItems($search); |
|
82
|
82
|
|
|
83
|
|
- $customerAddressManager->deleteItems( array_keys( $addressItems ) ); |
|
84
|
|
- $customerManager->deleteItems( array_keys( $customerItems ) ); |
|
|
83
|
+ $customerAddressManager->deleteItems(array_keys($addressItems)); |
|
|
84
|
+ $customerManager->deleteItems(array_keys($customerItems)); |
|
85
|
85
|
} |
|
86
|
86
|
} |