|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* @license LGPLv3, http://opensource.org/licenses/LGPL-3.0 |
|
5
|
|
|
* @copyright Aimeos (aimeos.org), 2025 |
|
6
|
|
|
* @package Controller |
|
7
|
|
|
* @subpackage Common |
|
8
|
|
|
*/ |
|
9
|
|
|
|
|
10
|
|
|
|
|
11
|
|
|
namespace Aimeos\Controller\Jobs\Common\Customer\Import\Csv\Processor\Address; |
|
12
|
|
|
|
|
13
|
|
|
|
|
14
|
|
|
/** |
|
15
|
|
|
* Address processor for CSV imports |
|
16
|
|
|
* |
|
17
|
|
|
* @package Controller |
|
18
|
|
|
* @subpackage Common |
|
19
|
|
|
*/ |
|
20
|
|
|
class Standard |
|
21
|
|
|
extends \Aimeos\Controller\Jobs\Common\Customer\Import\Csv\Processor\Base |
|
22
|
|
|
implements \Aimeos\Controller\Jobs\Common\Customer\Import\Csv\Processor\Iface |
|
23
|
|
|
{ |
|
24
|
|
|
/** controller/jobs/customer/import/csv/processor/address/name |
|
25
|
|
|
* Name of the address processor implementation |
|
26
|
|
|
* |
|
27
|
|
|
* Use "Myname" if your class is named "\Aimeos\Controller\Jobs\Common\Customer\Import\Csv\Processor\Address\Myname". |
|
28
|
|
|
* The name is case-sensitive and you should avoid camel case names like "MyName". |
|
29
|
|
|
* |
|
30
|
|
|
* @param string Last part of the processor class name |
|
31
|
|
|
* @since 2025.10 |
|
32
|
|
|
*/ |
|
33
|
|
|
|
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* Saves the customer related data to the storage |
|
37
|
|
|
* |
|
38
|
|
|
* @param \Aimeos\MShop\Customer\Item\Iface $customer Customer item with associated items |
|
39
|
|
|
* @param array $data List of CSV fields with position as key and data as value |
|
40
|
|
|
* @return array List of data which hasn't been imported |
|
41
|
|
|
*/ |
|
42
|
|
|
public function process( \Aimeos\MShop\Customer\Item\Iface $customer, array $data ) : array |
|
43
|
|
|
{ |
|
44
|
|
|
$context = $this->context(); |
|
45
|
|
|
$manager = \Aimeos\MShop::create( $context, 'customer' ); |
|
46
|
|
|
|
|
47
|
|
|
$pos = 0; |
|
48
|
|
|
$map = $this->getMappedChunk( $data, $this->getMapping() ); |
|
49
|
|
|
$addresses = $customer->getAddressItems(); |
|
50
|
|
|
|
|
51
|
|
|
foreach( $map as $entry ) |
|
52
|
|
|
{ |
|
53
|
|
|
$key = $addresses->firstKey(); |
|
54
|
|
|
$address = $addresses->pull( $key ) ?? $manager->createAddressItem(); |
|
|
|
|
|
|
55
|
|
|
$address->setPosition( $pos++ )->fromArray( $entry ); |
|
56
|
|
|
|
|
57
|
|
|
$customer->addAddressItem( $address, $key ); |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
$customer->deleteAddressItems( $addresses ); |
|
61
|
|
|
|
|
62
|
|
|
return $this->object()->process( $customer, $data ); |
|
63
|
|
|
} |
|
64
|
|
|
} |
|
65
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.