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