Completed
Push — master ( 7c1ebe...deb645 )
by Aimeos
05:11
created

Typo3   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 170
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 4

Importance

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

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A cleanup() 0 9 2
A getResourceType() 0 6 1
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 Aimeos (aimeos.org), 2018
6
 * @package MShop
7
 * @subpackage Customer
8
 */
9
10
11
namespace Aimeos\MShop\Customer\Manager\Property;
12
13
14
/**
15
 * Default property manager implementation.
16
 *
17
 * @package MShop
18
 * @subpackage Customer
19
 */
20
class Typo3
21
	extends \Aimeos\MShop\Common\Manager\Property\Base
22
	implements \Aimeos\MShop\Customer\Manager\Property\Iface
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.property.id' => array(
26
			'code' => 'customer.property.id',
27
			'internalcode' => 't3feupr."id"',
28
			'internaldeps'=>array( 'LEFT JOIN "fe_users_property" AS t3feupr ON ( t3feupr."parentid" = fos."id" )' ),
29
			'label' => 'Property ID',
30
			'type' => 'integer',
31
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT,
32
			'public' => false,
33
		),
34
		'customer.property.parentid' => array(
35
			'code' => 'customer.property.parentid',
36
			'internalcode' => 't3feupr."parentid"',
37
			'label' => 'Property parent ID',
38
			'type' => 'integer',
39
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT,
40
			'public' => false,
41
		),
42
		'customer.property.siteid' => array(
43
			'code' => 'customer.property.siteid',
44
			'internalcode' => 't3feupr."siteid"',
45
			'label' => 'Property site ID',
46
			'type' => 'integer',
47
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT,
48
			'public' => false,
49
		),
50
		'customer.property.typeid' => array(
51
			'code' => 'customer.property.typeid',
52
			'internalcode' => 't3feupr."typeid"',
53
			'label' => 'Property type ID',
54
			'type' => 'integer',
55
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT,
56
			'public' => false,
57
		),
58
		'customer.property.value' => array(
59
			'code' => 'customer.property.value',
60
			'internalcode' => 't3feupr."value"',
61
			'label' => 'Property value',
62
			'type' => 'string',
63
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
64
		),
65
		'customer.property.languageid' => array(
66
			'code' => 'customer.property.languageid',
67
			'internalcode' => 't3feupr."langid"',
68
			'label' => 'Property language ID',
69
			'type' => 'string',
70
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
71
		),
72
		'customer.property.ctime' => array(
73
			'code' => 'customer.property.ctime',
74
			'internalcode' => 't3feupr."ctime"',
75
			'label' => 'Property create date/time',
76
			'type' => 'datetime',
77
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
78
			'public' => false,
79
		),
80
		'customer.property.mtime' => array(
81
			'code' => 'customer.property.mtime',
82
			'internalcode' => 't3feupr."mtime"',
83
			'label' => 'Property modify date',
84
			'type' => 'datetime',
85
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
86
			'public' => false,
87
		),
88
		'customer.property.editor' => array(
89
			'code' => 'customer.property.editor',
90
			'internalcode' => 't3feupr."editor"',
91
			'label' => 'Property editor',
92
			'type' => 'string',
93
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
94
			'public' => false,
95
		),
96
	);
97
98
99
	/**
100
	 * Initializes the object.
101
	 *
102
	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object
103
	 */
104
	public function __construct( \Aimeos\MShop\Context\Item\Iface $context )
105
	{
106
		parent::__construct( $context );
107
		$this->setResourceName( 'db-customer' );
108
	}
109
110
111
	/**
112
	 * Removes old entries from the storage.
113
	 *
114
	 * @param integer[] $siteids List of IDs for sites whose entries should be deleted
115
	 */
116
	public function cleanup( array $siteids )
117
	{
118
		$path = 'mshop/customer/manager/property/submanagers';
119
		foreach( $this->getContext()->getConfig()->get( $path, [] ) as $domain ) {
120
			$this->getObject()->getSubManager( $domain )->cleanup( $siteids );
121
		}
122
123
		$this->cleanupBase( $siteids, 'mshop/customer/manager/property/typo3/delete' );
124
	}
125
126
127
	/**
128
	 * Returns the available manager types
129
	 *
130
	 * @param boolean $withsub Return also the resource type of sub-managers if true
131
	 * @return array Type of the manager and submanagers, subtypes are separated by slashes
132
	 */
133
	public function getResourceType( $withsub = true )
134
	{
135
		$path = 'mshop/customer/manager/property/submanagers';
136
137
		return $this->getResourceTypeBase( 'customer/property', $path, array( 'type' ), $withsub );
138
	}
139
140
141
	/**
142
	 * Returns the attributes that can be used for searching.
143
	 *
144
	 * @param boolean $withsub Return also attributes of sub-managers if true
145
	 * @return array Returns a list of attribtes implementing \Aimeos\MW\Criteria\Attribute\Iface
146
	 */
147
	public function getSearchAttributes( $withsub = true )
148
	{
149
		$path = 'mshop/customer/manager/property/submanagers';
150
151
		return $this->getSearchAttributesBase( $this->searchConfig, $path, array( 'type' ), $withsub );
152
	}
153
154
155
	/**
156
	 * Returns a new manager for customer extensions
157
	 *
158
	 * @param string $manager Name of the sub manager type in lower case
159
	 * @param string|null $name Name of the implementation, will be from
160
	 * configuration (or Default) if null
161
	 * @return \Aimeos\MShop\Common\Manager\Iface Manager for different extensions, e.g property types, property lists etc.
162
	 */
163
	public function getSubManager( $manager, $name = null )
164
	{
165
		return $this->getSubManagerBase( 'customer', 'property/' . $manager, ( $name === null ? 'Typo3' : $name ) );
166
	}
167
168
169
	/**
170
	 * Returns the config path for retrieving the configuration values.
171
	 *
172
	 * @return string Configuration path
173
	 */
174
	protected function getConfigPath()
175
	{
176
		return 'mshop/customer/manager/property/typo3/';
177
	}
178
179
180
	/**
181
	 * Returns the search configuration for searching items.
182
	 *
183
	 * @return array Associative list of search keys and search definitions
184
	 */
185
	protected function getSearchConfig()
186
	{
187
		return $this->searchConfig;
188
	}
189
}
190