Passed
Push — master ( e69905...3fa5e0 )
by Aimeos
01:51
created

Ezpublish   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 242
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 160
c 2
b 0
f 0
dl 0
loc 242
rs 10
wmc 7

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getSearchConfig() 0 3 1
A getSubManager() 0 3 2
A getConfigPath() 0 3 1
A getSearchAttributes() 0 5 1
A clear() 0 8 2
1
<?php
2
3
/**
4
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2016-2018
6
 * @package MShop
7
 * @subpackage Customer
8
 */
9
10
11
namespace Aimeos\MShop\Customer\Manager\Address;
12
13
14
/**
15
 * ezPublish implementation of the customer address class.
16
 *
17
 * @package MShop
18
 * @subpackage Customer
19
 */
20
class Ezpublish
21
	extends \Aimeos\MShop\Customer\Manager\Address\Standard
22
	implements \Aimeos\MShop\Customer\Manager\Address\Iface
23
{
24
	private $searchConfig = array(
25
		'customer.address.id' => array(
26
			'label' => 'Customer address ID',
27
			'code' => 'customer.address.id',
28
			'internalcode' => 'ezuad."id"',
29
			'internaldeps' => array( 'LEFT JOIN "ezuser_address" AS ezuad ON ( ezu."contentobject_id" = ezuad."parentid" )' ),
30
			'type' => 'integer',
31
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT,
32
			'public' => false,
33
		),
34
		// site ID is not available
35
		'customer.address.refid' => array(
36
			'label' => 'Customer address parent ID',
37
			'code' => 'customer.address.parentid',
38
			'internalcode' => 'ezuad."parentid"',
39
			'type' => 'integer',
40
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
41
			'public' => false,
42
		),
43
		'customer.address.company'=> array(
44
			'label' => 'Customer address company',
45
			'code' => 'customer.address.company',
46
			'internalcode' => 'ezuad."company"',
47
			'type' => 'string',
48
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
49
		),
50
		'customer.address.vatid'=> array(
51
			'label' => 'Customer address VAT ID',
52
			'code' => 'customer.address.vatid',
53
			'internalcode' => 'ezuad."vatid"',
54
			'type' => 'string',
55
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
56
		),
57
		'customer.address.salutation' => array(
58
			'label' => 'Customer address salutation',
59
			'code' => 'customer.address.salutation',
60
			'internalcode' => 'ezuad."salutation"',
61
			'type' => 'integer',
62
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
63
		),
64
		'customer.address.title' => array(
65
			'label' => 'Customer address title',
66
			'code' => 'customer.address.title',
67
			'internalcode' => 'ezuad."title"',
68
			'type' => 'string',
69
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
70
		),
71
		'customer.address.firstname' => array(
72
			'label' => 'Customer address firstname',
73
			'code' => 'customer.address.firstname',
74
			'internalcode' => 'ezuad."firstname"',
75
			'type' => 'string',
76
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
77
		),
78
		'customer.address.lastname' => array(
79
			'label' => 'Customer address lastname',
80
			'code' => 'customer.address.lastname',
81
			'internalcode' => 'ezuad."lastname"',
82
			'type' => 'string',
83
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
84
		),
85
		'customer.address.address1' => array(
86
			'label' => 'Customer address address part one',
87
			'code' => 'customer.address.address1',
88
			'internalcode' => 'ezuad."address1"',
89
			'type' => 'string',
90
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
91
		),
92
		'customer.address.address2' => array(
93
			'label' => 'Customer address address part two',
94
			'code' => 'customer.address.address2',
95
			'internalcode' => 'ezuad."address2"',
96
			'type' => 'string',
97
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
98
		),
99
		'customer.address.address3' => array(
100
			'label' => 'Customer address address part three',
101
			'code' => 'customer.address.address3',
102
			'internalcode' => 'ezuad."address3"',
103
			'type' => 'string',
104
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
105
		),
106
		'customer.address.postal' => array(
107
			'label' => 'Customer address postal',
108
			'code' => 'customer.address.postal',
109
			'internalcode' => 'ezuad."postal"',
110
			'type' => 'string',
111
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
112
		),
113
		'customer.address.city' => array(
114
			'label' => 'Customer address city',
115
			'code' => 'customer.address.city',
116
			'internalcode' => 'ezuad."city"',
117
			'type' => 'string',
118
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
119
		),
120
		'customer.address.state' => array(
121
			'label' => 'Customer address state',
122
			'code' => 'customer.address.state',
123
			'internalcode' => 'ezuad."state"',
124
			'type' => 'string',
125
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
126
		),
127
		'customer.address.languageid' => array(
128
			'label' => 'Customer address language',
129
			'code' => 'customer.address.languageid',
130
			'internalcode' => 'ezuad."langid"',
131
			'type' => 'string',
132
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
133
		),
134
		'customer.address.countryid' => array(
135
			'label' => 'Customer address country',
136
			'code' => 'customer.address.countryid',
137
			'internalcode' => 'ezuad."countryid"',
138
			'type' => 'string',
139
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
140
		),
141
		'customer.address.telephone' => array(
142
			'label' => 'Customer address telephone',
143
			'code' => 'customer.address.telephone',
144
			'internalcode' => 'ezuad."telephone"',
145
			'type' => 'string',
146
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
147
		),
148
		'customer.address.email' => array(
149
			'label' => 'Customer address email',
150
			'code' => 'customer.address.email',
151
			'internalcode' => 'ezuad."email"',
152
			'type' => 'string',
153
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
154
		),
155
		'customer.address.telefax' => array(
156
			'label' => 'Customer address telefax',
157
			'code' => 'customer.address.telefax',
158
			'internalcode' => 'ezuad."telefax"',
159
			'type' => 'string',
160
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
161
		),
162
		'customer.address.website' => array(
163
			'label' => 'Customer address website',
164
			'code' => 'customer.address.website',
165
			'internalcode' => 'ezuad."website"',
166
			'type' => 'string',
167
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
168
		),
169
		'customer.address.position' => array(
170
			'label' => 'Customer address position',
171
			'code' => 'customer.address.position',
172
			'internalcode' => 'ezuad."pos"',
173
			'type' => 'integer',
174
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT,
175
		),
176
		'customer.address.ctime'=> array(
177
			'label'=>'Customer address create date/time',
178
			'code'=>'customer.address.ctime',
179
			'internalcode'=>'ezuad."ctime"',
180
			'type'=> 'datetime',
181
			'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_STR,
182
		),
183
		'customer.address.mtime'=> array(
184
			'label'=>'Customer address modification date/time',
185
			'code'=>'customer.address.mtime',
186
			'internalcode'=>'ezuad."mtime"',
187
			'type'=> 'datetime',
188
			'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_STR,
189
		),
190
		'customer.address.editor'=> array(
191
			'label'=>'Customer address editor',
192
			'code'=>'customer.address.editor',
193
			'internalcode'=>'ezuad."editor"',
194
			'type'=> 'string',
195
			'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_STR,
196
		),
197
	);
198
199
200
	/**
201
	 * Removes old entries from the storage.
202
	 *
203
	 * @param array $siteids List of IDs for sites whose entries should be deleted
204
	 */
205
	public function clear( array $siteids )
206
	{
207
		$path = 'mshop/customer/manager/address/submanagers';
208
		foreach( $this->getContext()->getConfig()->get( $path, [] ) as $domain ) {
209
			$this->getObject()->getSubManager( $domain )->clear( $siteids );
210
		}
211
212
		$this->cleanupBase( $siteids, 'mshop/customer/manager/lists/ezpublish/delete' );
213
	}
214
215
216
	/**
217
	 * Returns the attributes that can be used for searching.
218
	 *
219
	 * @param boolean $withsub Return also attributes of sub-managers if true
220
	 * @return array Returns a list of attribtes implementing \Aimeos\MW\Criteria\Attribute\Iface
221
	 */
222
	public function getSearchAttributes( $withsub = true )
223
	{
224
		$path = 'mshop/customer/manager/address/submanagers';
225
226
		return $this->getSearchAttributesBase( $this->getSearchConfig(), $path, [], $withsub );
227
	}
228
229
230
	/**
231
	 * Returns a new manager for customer extensions
232
	 *
233
	 * @param string $manager Name of the sub manager type in lower case
234
	 * @param string|null $name Name of the implementation, will be from configuration (or Default) if null
235
	 * @return mixed Manager for different extensions, e.g stock, tags, locations, etc.
236
	 */
237
	public function getSubManager( $manager, $name = null )
238
	{
239
		return $this->getSubManagerBase( 'customer', 'address/' . $manager, ( $name === null ? 'Ezpublish' : $name ) );
240
	}
241
242
243
	/**
244
	 * Returns the config path for retrieving the configuration values.
245
	 *
246
	 * @return string Configuration path (mshop/customer/manager/address/ezpublish/)
247
	 */
248
	protected function getConfigPath()
249
	{
250
		return 'mshop/customer/manager/address/ezpublish/';
251
	}
252
253
254
	/**
255
	 * Returns the search configuration for searching items.
256
	 *
257
	 * @return array Associative list of search keys and search definitions
258
	 */
259
	protected function getSearchConfig()
260
	{
261
		return $this->searchConfig;
262
	}
263
}
264