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

Typo3::getSearchAttributes()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 2
c 2
b 0
f 0
dl 0
loc 5
rs 10
cc 1
nc 1
nop 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\Customer\Manager\Property\Standard
22
{
23
	private $searchConfig = array(
24
		'customer.property.id' => array(
25
			'code' => 'customer.property.id',
26
			'internalcode' => 't3feupr."id"',
27
			'internaldeps'=>array( 'LEFT JOIN "fe_users_property" AS t3feupr ON ( t3feupr."parentid" = t3feu."uid" )' ),
28
			'label' => 'Property ID',
29
			'type' => 'integer',
30
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT,
31
			'public' => false,
32
		),
33
		'customer.property.parentid' => array(
34
			'code' => 'customer.property.parentid',
35
			'internalcode' => 't3feupr."parentid"',
36
			'label' => 'Property parent ID',
37
			'type' => 'integer',
38
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT,
39
			'public' => false,
40
		),
41
		'customer.property.siteid' => array(
42
			'code' => 'customer.property.siteid',
43
			'internalcode' => 't3feupr."siteid"',
44
			'label' => 'Property site ID',
45
			'type' => 'integer',
46
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT,
47
			'public' => false,
48
		),
49
		'customer.property.type' => array(
50
			'code' => 'customer.property.type',
51
			'internalcode' => 't3feupr."type"',
52
			'label' => 'Property type',
53
			'type' => 'string',
54
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
55
		),
56
		'customer.property.value' => array(
57
			'code' => 'customer.property.value',
58
			'internalcode' => 't3feupr."value"',
59
			'label' => 'Property value',
60
			'type' => 'string',
61
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
62
		),
63
		'customer.property.languageid' => array(
64
			'code' => 'customer.property.languageid',
65
			'internalcode' => 't3feupr."langid"',
66
			'label' => 'Property language ID',
67
			'type' => 'string',
68
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
69
		),
70
		'customer.property.ctime' => array(
71
			'code' => 'customer.property.ctime',
72
			'internalcode' => 't3feupr."ctime"',
73
			'label' => 'Property create date/time',
74
			'type' => 'datetime',
75
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
76
			'public' => false,
77
		),
78
		'customer.property.mtime' => array(
79
			'code' => 'customer.property.mtime',
80
			'internalcode' => 't3feupr."mtime"',
81
			'label' => 'Property modify date',
82
			'type' => 'datetime',
83
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
84
			'public' => false,
85
		),
86
		'customer.property.editor' => array(
87
			'code' => 'customer.property.editor',
88
			'internalcode' => 't3feupr."editor"',
89
			'label' => 'Property editor',
90
			'type' => 'string',
91
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
92
			'public' => false,
93
		),
94
	);
95
96
97
	/**
98
	 * Removes old entries from the storage.
99
	 *
100
	 * @param integer[] $siteids List of IDs for sites whose entries should be deleted
101
	 */
102
	public function clear( array $siteids )
103
	{
104
		$path = 'mshop/customer/manager/property/submanagers';
105
		foreach( $this->getContext()->getConfig()->get( $path, ['type'] ) as $domain ) {
106
			$this->getObject()->getSubManager( $domain )->clear( $siteids );
107
		}
108
109
		$this->cleanupBase( $siteids, 'mshop/customer/manager/property/typo3/delete' );
110
	}
111
112
113
	/**
114
	 * Returns the attributes that can be used for searching.
115
	 *
116
	 * @param boolean $withsub Return also attributes of sub-managers if true
117
	 * @return array Returns a list of attribtes implementing \Aimeos\MW\Criteria\Attribute\Iface
118
	 */
119
	public function getSearchAttributes( $withsub = true )
120
	{
121
		$path = 'mshop/customer/manager/property/submanagers';
122
123
		return $this->getSearchAttributesBase( $this->searchConfig, $path, [], $withsub );
124
	}
125
126
127
	/**
128
	 * Returns a new manager for customer extensions
129
	 *
130
	 * @param string $manager Name of the sub manager type in lower case
131
	 * @param string|null $name Name of the implementation, will be from
132
	 * configuration (or Default) if null
133
	 * @return \Aimeos\MShop\Common\Manager\Iface Manager for different extensions, e.g property types, property lists etc.
134
	 */
135
	public function getSubManager( $manager, $name = null )
136
	{
137
		return $this->getSubManagerBase( 'customer', 'property/' . $manager, ( $name === null ? 'Typo3' : $name ) );
138
	}
139
140
141
	/**
142
	 * Returns the config path for retrieving the configuration values.
143
	 *
144
	 * @return string Configuration path
145
	 */
146
	protected function getConfigPath()
147
	{
148
		return 'mshop/customer/manager/property/typo3/';
149
	}
150
151
152
	/**
153
	 * Returns the search configuration for searching items.
154
	 *
155
	 * @return array Associative list of search keys and search definitions
156
	 */
157
	protected function getSearchConfig()
158
	{
159
		return $this->searchConfig;
160
	}
161
}
162