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

Typo3   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 174
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 4

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A cleanup() 0 9 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\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(
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.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.domain'=> array(
51
			'code'=>'customer.lists.domain',
52
			'internalcode'=>'t3feuli."domain"',
53
			'label'=>'Customer list domain',
54
			'type'=> 'string',
55
			'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_STR,
56
		),
57
		'customer.lists.typeid' => array(
58
			'code'=>'customer.lists.typeid',
59
			'internalcode'=>'t3feuli."typeid"',
60
			'label'=>'Customer list type ID',
61
			'type'=> 'integer',
62
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT,
63
			'public' => false,
64
		),
65
		'customer.lists.refid'=> array(
66
			'code'=>'customer.lists.refid',
67
			'internalcode'=>'t3feuli."refid"',
68
			'label'=>'Customer list reference ID',
69
			'type'=> 'string',
70
			'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_STR,
71
		),
72
		'customer.lists.datestart' => array(
73
			'code'=>'customer.lists.datestart',
74
			'internalcode'=>'t3feuli."start"',
75
			'label'=>'Customer list start date/time',
76
			'type'=> 'datetime',
77
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
78
		),
79
		'customer.lists.dateend' => array(
80
			'code'=>'customer.lists.dateend',
81
			'internalcode'=>'t3feuli."end"',
82
			'label'=>'Customer list end date/time',
83
			'type'=> 'datetime',
84
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
85
		),
86
		'customer.lists.config' => array(
87
			'code'=>'customer.lists.config',
88
			'internalcode'=>'t3feuli."config"',
89
			'label'=>'Customer list position',
90
			'type'=> 'string',
91
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
92
		),
93
		'customer.lists.position' => array(
94
			'code'=>'customer.lists.position',
95
			'internalcode'=>'t3feuli."pos"',
96
			'label'=>'Customer list position',
97
			'type'=> 'integer',
98
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT,
99
		),
100
		'customer.lists.status' => array(
101
			'code'=>'customer.lists.status',
102
			'internalcode'=>'t3feuli."status"',
103
			'label'=>'Customer list status',
104
			'type'=> 'integer',
105
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT,
106
		),
107
		'customer.lists.ctime'=> array(
108
			'code'=>'customer.lists.ctime',
109
			'internalcode'=>'t3feuli."ctime"',
110
			'label'=>'Customer list create date/time',
111
			'type'=> 'datetime',
112
			'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_STR,
113
		),
114
		'customer.lists.mtime'=> array(
115
			'code'=>'customer.lists.mtime',
116
			'internalcode'=>'t3feuli."mtime"',
117
			'label'=>'Customer list modification date/time',
118
			'type'=> 'datetime',
119
			'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_STR,
120
		),
121
		'customer.lists.editor'=> array(
122
			'code'=>'customer.lists.editor',
123
			'internalcode'=>'t3feuli."editor"',
124
			'label'=>'Customer list editor',
125
			'type'=> 'string',
126
			'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_STR,
127
		),
128
	);
129
130
131
	/**
132
	 * Removes old entries from the storage.
133
	 *
134
	 * @param array $siteids List of IDs for sites whose entries should be deleted
135
	 */
136
	public function cleanup( array $siteids )
137
	{
138
		$path = 'mshop/customer/manager/lists/submanagers';
139
		foreach( $this->getContext()->getConfig()->get( $path, ['type'] ) as $domain ) {
140
			$this->getObject()->getSubManager( $domain )->cleanup( $siteids );
141
		}
142
143
		$this->cleanupBase( $siteids, 'mshop/customer/manager/lists/typo3/delete' );
144
	}
145
146
147
	/**
148
	 * Returns the attributes that can be used for searching.
149
	 *
150
	 * @param boolean $withsub Return also attributes of sub-managers if true
151
	 * @return array Returns a list of attribtes implementing \Aimeos\MW\Criteria\Attribute\Iface
152
	 */
153
	public function getSearchAttributes( $withsub = true )
154
	{
155
		$path = 'mshop/customer/manager/lists/submanagers';
156
157
		return $this->getSearchAttributesBase( $this->searchConfig, $path, ['type'], $withsub );
158
	}
159
160
161
	/**
162
	 * Returns a new manager for customer extensions
163
	 *
164
	 * @param string $manager Name of the sub manager type in lower case
165
	 * @param string|null $name Name of the implementation, will be from configuration (or Default) if null
166
	 * @return mixed Manager for different extensions, e.g stock, tags, locations, etc.
167
	 */
168
	public function getSubManager( $manager, $name = null )
169
	{
170
		return $this->getSubManagerBase( 'customer', 'lists/' . $manager, ( $name === null ? 'Typo3' : $name ) );
171
	}
172
173
174
	/**
175
	 * Returns the config path for retrieving the configuration values.
176
	 *
177
	 * @return string Configuration path (mshop/customer/manager/lists/type/typo3/item/)
178
	 */
179
	protected function getConfigPath()
180
	{
181
		return 'mshop/customer/manager/lists/typo3/';
182
	}
183
184
185
	/**
186
	 * Returns the search configuration for searching items.
187
	 *
188
	 * @return array Associative list of search keys and search definitions
189
	 */
190
	protected function getSearchConfig()
191
	{
192
		return $this->searchConfig;
193
	}
194
}
195