Completed
Push — master ( 865fa3...b232ae )
by Aimeos
01:26
created

Typo3   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 265
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 4

Importance

Changes 0
Metric Value
wmc 7
lcom 2
cbo 4
dl 0
loc 265
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A cleanup() 0 10 2
A getSearchAttributes() 0 6 1
A getSubManager() 0 4 2
A getConfigPath() 0 4 1
A getSearchConfig() 0 4 1
1
<?php
2
3
/**
4
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
5
 * @copyright Metaways Infosystems GmbH, 2013
6
 * @copyright Aimeos (aimeos.org), 2014-2017
7
 * @package MShop
8
 * @subpackage Customer
9
 */
10
11
12
namespace Aimeos\MShop\Customer\Manager\Address;
13
14
15
/**
16
 * TYPO3 implementation of the customer address class.
17
 *
18
 * @package MShop
19
 * @subpackage Customer
20
 */
21
class Typo3
22
	extends \Aimeos\MShop\Customer\Manager\Address\Standard
23
{
24
	private $searchConfig = array(
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
25
		'customer.address.id' => array(
26
			'label' => 'Customer address ID',
27
			'code' => 'customer.address.id',
28
			'internalcode' => 't3feuad."id"',
29
			'internaldeps' => array( 'LEFT JOIN "fe_users_address" AS t3feuad ON ( t3feu."uid" = t3feuad."parentid" )' ),
30
			'type' => 'integer',
31
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT,
32
			'public' => false,
33
		),
34
		// customer.siteid is only for informational purpuse, not for filtering
35
		'customer.address.parentid' => array(
36
			'label' => 'Customer address parent ID',
37
			'code' => 'customer.address.parentid',
38
			'internalcode' => 't3feuad."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' => 't3feuad."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' => 't3feuad."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' => 't3feuad."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' => 't3feuad."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' => 't3feuad."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' => 't3feuad."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' => 't3feuad."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' => 't3feuad."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' => 't3feuad."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' => 't3feuad."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' => 't3feuad."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' => 't3feuad."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' => 't3feuad."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' => 't3feuad."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' => 't3feuad."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' => 't3feuad."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' => 't3feuad."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' => 't3feuad."website"',
166
			'type' => 'string',
167
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
168
		),
169
		'customer.address.longitude' => array(
170
			'label' => 'Customer address longitude',
171
			'code' => 'customer.address.longitude',
172
			'internalcode' => 't3feuad."longitude"',
173
			'type' => 'string',
174
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
175
		),
176
		'customer.address.latitude' => array(
177
			'label' => 'Customer address latitude',
178
			'code' => 'customer.address.latitude',
179
			'internalcode' => 't3feuad."latitude"',
180
			'type' => 'string',
181
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
182
		),
183
		'customer.address.flag' => array(
184
			'label' => 'Customer address flag',
185
			'code' => 'customer.address.flag',
186
			'internalcode' => 't3feuad."flag"',
187
			'type' => 'integer',
188
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT,
189
		),
190
		'customer.address.position' => array(
191
			'code' => 'customer.address.position',
192
			'internalcode' => 't3feuad."pos"',
193
			'label' => 'Customer address position',
194
			'type' => 'integer',
195
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT,
196
		),
197
		'customer.address.ctime'=> array(
198
			'code'=>'customer.address.ctime',
199
			'internalcode'=>'t3feuad."ctime"',
200
			'label'=>'Customer address create date/time',
201
			'type'=> 'datetime',
202
			'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_STR,
203
		),
204
		'customer.address.mtime'=> array(
205
			'code'=>'customer.address.mtime',
206
			'internalcode'=>'t3feuad."mtime"',
207
			'label'=>'Customer address modification date/time',
208
			'type'=> 'datetime',
209
			'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_STR,
210
		),
211
		'customer.address.editor'=> array(
212
			'code'=>'customer.address.editor',
213
			'internalcode'=>'t3feuad."editor"',
214
			'label'=>'Customer address editor',
215
			'type'=> 'string',
216
			'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_STR,
217
		),
218
	);
219
220
221
	/**
222
	 * Removes old entries from the storage.
223
	 *
224
	 * @param array $siteids List of IDs for sites whose entries should be deleted
225
	 */
226
	public function cleanup( array $siteids )
227
	{
228
		$path = 'mshop/customer/manager/address/submanagers';
229
		foreach( $this->getContext()->getConfig()->get( $path, [] ) as $domain ) {
230
			$this->getObject()->getSubManager( $domain )->cleanup( $siteids );
231
		}
232
233
		$this->cleanupBase( $siteids, 'mshop/customer/manager/address/typo3/delete' );
234
235
	}
236
237
238
	/**
239
	 * Returns the list attributes that can be used for searching.
240
	 *
241
	 * @param boolean $withsub Return also attributes of sub-managers if true
242
	 * @return array List of attribute items implementing \Aimeos\MW\Criteria\Attribute\Iface
243
	 */
244
	public function getSearchAttributes( $withsub = true )
245
	{
246
		$path = 'mshop/customer/manager/address/submanagers';
247
248
		return $this->getSearchAttributesBase( $this->searchConfig, $path, [], $withsub );
249
	}
250
251
252
	/**
253
	 * Returns a new manager for customer extensions
254
	 *
255
	 * @param string $manager Name of the sub manager type in lower case
256
	 * @param string|null $name Name of the implementation, will be from configuration (or Default) if null
257
	 * @return mixed Manager for different extensions, e.g stock, tags, locations, etc.
258
	 */
259
	public function getSubManager( $manager, $name = null )
260
	{
261
		return $this->getSubManagerBase( 'customer', 'address/' . $manager, ( $name === null ? 'Typo3' : $name ) );
262
	}
263
264
265
	/**
266
	 * Returns the config path for retrieving the configuration values.
267
	 *
268
	 * @return string Configuration path (mshop/customer/manager/address/typo3/item/)
269
	 */
270
	protected function getConfigPath()
271
	{
272
		return 'mshop/customer/manager/address/typo3/';
273
	}
274
275
276
	/**
277
	 * Returns the search configuration for searching items.
278
	 *
279
	 * @return array Associative list of search keys and search definitions
280
	 */
281
	protected function getSearchConfig()
282
	{
283
		return $this->searchConfig;
284
	}
285
}
286