Passed
Push — master ( 32b43c...00ff20 )
by Aimeos
01:45
created

Typo3::clear()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 4
c 0
b 0
f 0
dl 0
loc 8
rs 10
cc 2
nc 2
nop 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-2018
7
 * @package MShop
8
 * @subpackage Customer
9
 */
10
11
12
namespace Aimeos\MShop\Customer\Manager\Lists;
13
14
15
/**
16
 * TYPO3 implementation of the customer list class.
17
 *
18
 * @package MShop
19
 * @subpackage Customer
20
 */
21
class Typo3
22
	extends \Aimeos\MShop\Customer\Manager\Lists\Standard
23
{
24
	private $searchConfig = array(
25
		'customer.lists.id'=> array(
26
			'code'=>'customer.lists.id',
27
			'internalcode'=>'t3feuli."id"',
28
			'internaldeps' => array( 'LEFT JOIN "fe_users_list" AS t3feuli ON ( t3feu."uid" = t3feuli."parentid" )' ),
29
			'label'=>'Customer list ID',
30
			'type'=> 'integer',
31
			'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_INT,
32
			'public' => false,
33
		),
34
		'customer.lists.siteid'=> array(
35
			'code'=>'customer.lists.siteid',
36
			'internalcode'=>'t3feuli."siteid"',
37
			'label'=>'Customer list site ID',
38
			'type'=> 'integer',
39
			'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_INT,
40
			'public' => false,
41
		),
42
		'customer.lists.parentid'=> array(
43
			'code'=>'customer.lists.parentid',
44
			'internalcode'=>'t3feuli."parentid"',
45
			'label'=>'Customer list parent ID',
46
			'type'=> 'integer',
47
			'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_INT,
48
			'public' => false,
49
		),
50
		'customer.lists.key' => array(
51
			'code' => 'customer.lists.key',
52
			'internalcode' => 't3feuli."key"',
53
			'label' => 'Unique key',
54
			'type' => 'string',
55
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
56
			'public' => false,
57
		),
58
		'customer.lists.domain'=> array(
59
			'code'=>'customer.lists.domain',
60
			'internalcode'=>'t3feuli."domain"',
61
			'label'=>'Customer list domain',
62
			'type'=> 'string',
63
			'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_STR,
64
		),
65
		'customer.lists.type' => array(
66
			'code'=>'customer.lists.type',
67
			'internalcode'=>'t3feuli."type"',
68
			'label'=>'Customer list type',
69
			'type'=> 'string',
70
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
71
		),
72
		'customer.lists.refid'=> array(
73
			'code'=>'customer.lists.refid',
74
			'internalcode'=>'t3feuli."refid"',
75
			'label'=>'Customer list reference ID',
76
			'type'=> 'string',
77
			'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_STR,
78
		),
79
		'customer.lists.datestart' => array(
80
			'code'=>'customer.lists.datestart',
81
			'internalcode'=>'t3feuli."start"',
82
			'label'=>'Customer list start date/time',
83
			'type'=> 'datetime',
84
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
85
		),
86
		'customer.lists.dateend' => array(
87
			'code'=>'customer.lists.dateend',
88
			'internalcode'=>'t3feuli."end"',
89
			'label'=>'Customer list end date/time',
90
			'type'=> 'datetime',
91
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
92
		),
93
		'customer.lists.config' => array(
94
			'code'=>'customer.lists.config',
95
			'internalcode'=>'t3feuli."config"',
96
			'label'=>'Customer list position',
97
			'type'=> 'string',
98
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
99
		),
100
		'customer.lists.position' => array(
101
			'code'=>'customer.lists.position',
102
			'internalcode'=>'t3feuli."pos"',
103
			'label'=>'Customer list position',
104
			'type'=> 'integer',
105
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT,
106
		),
107
		'customer.lists.status' => array(
108
			'code'=>'customer.lists.status',
109
			'internalcode'=>'t3feuli."status"',
110
			'label'=>'Customer list status',
111
			'type'=> 'integer',
112
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT,
113
		),
114
		'customer.lists.ctime'=> array(
115
			'code'=>'customer.lists.ctime',
116
			'internalcode'=>'t3feuli."ctime"',
117
			'label'=>'Customer list create date/time',
118
			'type'=> 'datetime',
119
			'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_STR,
120
		),
121
		'customer.lists.mtime'=> array(
122
			'code'=>'customer.lists.mtime',
123
			'internalcode'=>'t3feuli."mtime"',
124
			'label'=>'Customer list modification date/time',
125
			'type'=> 'datetime',
126
			'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_STR,
127
		),
128
		'customer.lists.editor'=> array(
129
			'code'=>'customer.lists.editor',
130
			'internalcode'=>'t3feuli."editor"',
131
			'label'=>'Customer list editor',
132
			'type'=> 'string',
133
			'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_STR,
134
		),
135
	);
136
137
138
	/**
139
	 * Removes old entries from the storage.
140
	 *
141
	 * @param array $siteids List of IDs for sites whose entries should be deleted
142
	 */
143
	public function clear( array $siteids )
144
	{
145
		$path = 'mshop/customer/manager/lists/submanagers';
146
		foreach( $this->getContext()->getConfig()->get( $path, ['type'] ) as $domain ) {
147
			$this->getObject()->getSubManager( $domain )->clear( $siteids );
148
		}
149
150
		$this->cleanupBase( $siteids, 'mshop/customer/manager/lists/typo3/delete' );
151
	}
152
153
154
	/**
155
	 * Returns the attributes that can be used for searching.
156
	 *
157
	 * @param boolean $withsub Return also attributes of sub-managers if true
158
	 * @return array Returns a list of attribtes implementing \Aimeos\MW\Criteria\Attribute\Iface
159
	 */
160
	public function getSearchAttributes( $withsub = true )
161
	{
162
		$path = 'mshop/customer/manager/lists/submanagers';
163
164
		return $this->getSearchAttributesBase( $this->searchConfig, $path, [], $withsub );
165
	}
166
167
168
	/**
169
	 * Returns a new manager for customer extensions
170
	 *
171
	 * @param string $manager Name of the sub manager type in lower case
172
	 * @param string|null $name Name of the implementation, will be from configuration (or Default) if null
173
	 * @return mixed Manager for different extensions, e.g stock, tags, locations, etc.
174
	 */
175
	public function getSubManager( $manager, $name = null )
176
	{
177
		return $this->getSubManagerBase( 'customer', 'lists/' . $manager, ( $name === null ? 'Typo3' : $name ) );
178
	}
179
180
181
	/**
182
	 * Returns the config path for retrieving the configuration values.
183
	 *
184
	 * @return string Configuration path (mshop/customer/manager/lists/type/typo3/item/)
185
	 */
186
	protected function getConfigPath()
187
	{
188
		return 'mshop/customer/manager/lists/typo3/';
189
	}
190
191
192
	/**
193
	 * Returns the search configuration for searching items.
194
	 *
195
	 * @return array Associative list of search keys and search definitions
196
	 */
197
	protected function getSearchConfig()
198
	{
199
		return $this->searchConfig;
200
	}
201
}
202