Ezpublish::getSearchAttributes()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 5
rs 10
1
<?php
2
3
/**
4
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2016-2020
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 string[] $siteids List of IDs for sites whose entries should be deleted
204
	 * @return \Aimeos\MShop\Common\Manager\Iface Same object for fluent interface
205
	 */
206
	public function clear( array $siteids ) : \Aimeos\MShop\Common\Manager\Iface
207
	{
208
		$path = 'mshop/customer/manager/address/submanagers';
209
		foreach( $this->getContext()->getConfig()->get( $path, [] ) as $domain ) {
210
			$this->getObject()->getSubManager( $domain )->clear( $siteids );
211
		}
212
213
		return $this->clearBase( $siteids, 'mshop/customer/manager/lists/ezpublish/delete' );
214
	}
215
216
217
	/**
218
	 * Returns the attributes that can be used for searching.
219
	 *
220
	 * @param bool $withsub Return also attributes of sub-managers if true
221
	 * @return array Returns a list of attribtes implementing \Aimeos\MW\Criteria\Attribute\Iface
222
	 */
223
	public function getSearchAttributes( bool $withsub = true ) : array
224
	{
225
		$path = 'mshop/customer/manager/address/submanagers';
226
227
		return $this->getSearchAttributesBase( $this->getSearchConfig(), $path, [], $withsub );
228
	}
229
230
231
	/**
232
	 * Returns a new manager for customer extensions
233
	 *
234
	 * @param string $manager Name of the sub manager type in lower case
235
	 * @param string|null $name Name of the implementation, will be from configuration (or Standard) if null
236
	 * @return mixed Manager for different extensions, e.g stock, tags, locations, etc.
237
	 */
238
	public function getSubManager( string $manager, string $name = null ) : \Aimeos\MShop\Common\Manager\Iface
239
	{
240
		return $this->getSubManagerBase( 'customer', 'address/' . $manager, ( $name === null ? 'Ezpublish' : $name ) );
241
	}
242
243
244
	/**
245
	 * Returns the config path for retrieving the configuration values.
246
	 *
247
	 * @return string Configuration path (mshop/customer/manager/address/ezpublish/)
248
	 */
249
	protected function getConfigPath() : string
250
	{
251
		return 'mshop/customer/manager/address/ezpublish/';
252
	}
253
254
255
	/**
256
	 * Returns the search configuration for searching items.
257
	 *
258
	 * @return array Associative list of search keys and search definitions
259
	 */
260
	protected function getSearchConfig() : array
261
	{
262
		return $this->searchConfig;
263
	}
264
}
265