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