1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* @license LGPLv3, http://opensource.org/licenses/LGPL-3.0 |
5
|
|
|
* @copyright Aimeos (aimeos.org), 2015-2020 |
6
|
|
|
* @package MShop |
7
|
|
|
* @subpackage Customer |
8
|
|
|
*/ |
9
|
|
|
|
10
|
|
|
|
11
|
|
|
namespace Aimeos\MShop\Customer\Manager\Lists; |
12
|
|
|
|
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* Fos user bundle implementation of the customer list class. |
16
|
|
|
* |
17
|
|
|
* @package MShop |
18
|
|
|
* @subpackage Customer |
19
|
|
|
*/ |
20
|
|
|
class FosUser |
21
|
|
|
extends \Aimeos\MShop\Customer\Manager\Lists\Standard |
22
|
|
|
{ |
23
|
|
|
private $searchConfig = array( |
24
|
|
|
'customer.lists.id'=> array( |
25
|
|
|
'code' => 'customer.lists.id', |
26
|
|
|
'internalcode' => 'fosli."id"', |
27
|
|
|
'internaldeps' => ['LEFT JOIN "fos_user_list" AS fosli ON ( fos."id" = fosli."parentid" )'], |
28
|
|
|
'label' => 'Customer list ID', |
29
|
|
|
'type'=> 'integer', |
30
|
|
|
'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_INT, |
31
|
|
|
'public' => false, |
32
|
|
|
), |
33
|
|
|
'customer.lists.siteid'=> array( |
34
|
|
|
'code' => 'customer.lists.siteid', |
35
|
|
|
'internalcode' => 'fosli."siteid"', |
36
|
|
|
'label' => 'Customer list site ID', |
37
|
|
|
'type'=> 'string', |
38
|
|
|
'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
39
|
|
|
'public' => false, |
40
|
|
|
), |
41
|
|
|
'customer.lists.parentid'=> array( |
42
|
|
|
'code' => 'customer.lists.parentid', |
43
|
|
|
'internalcode' => 'fosli."parentid"', |
44
|
|
|
'label' => 'Customer list parent ID', |
45
|
|
|
'type'=> 'integer', |
46
|
|
|
'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_INT, |
47
|
|
|
'public' => false, |
48
|
|
|
), |
49
|
|
|
'customer.lists.key' => array( |
50
|
|
|
'code' => 'customer.lists.key', |
51
|
|
|
'internalcode' => 'fosli."key"', |
52
|
|
|
'label' => 'Unique key', |
53
|
|
|
'type' => 'string', |
54
|
|
|
'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
55
|
|
|
'public' => false, |
56
|
|
|
), |
57
|
|
|
'customer.lists.domain'=> array( |
58
|
|
|
'code' => 'customer.lists.domain', |
59
|
|
|
'internalcode' => 'fosli."domain"', |
60
|
|
|
'label' => 'Customer list domain', |
61
|
|
|
'type'=> 'string', |
62
|
|
|
'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
63
|
|
|
), |
64
|
|
|
'customer.lists.type' => array( |
65
|
|
|
'code' => 'customer.lists.type', |
66
|
|
|
'internalcode' => 'fosli."type"', |
67
|
|
|
'label' => 'Customer list type', |
68
|
|
|
'type'=> 'string', |
69
|
|
|
'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
70
|
|
|
), |
71
|
|
|
'customer.lists.refid'=> array( |
72
|
|
|
'code' => 'customer.lists.refid', |
73
|
|
|
'internalcode' => 'fosli."refid"', |
74
|
|
|
'label' => 'Customer list reference ID', |
75
|
|
|
'type'=> 'string', |
76
|
|
|
'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
77
|
|
|
), |
78
|
|
|
'customer.lists.datestart' => array( |
79
|
|
|
'code' => 'customer.lists.datestart', |
80
|
|
|
'internalcode' => 'fosli."start"', |
81
|
|
|
'label' => 'Customer list start date/time', |
82
|
|
|
'type'=> 'datetime', |
83
|
|
|
'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
84
|
|
|
), |
85
|
|
|
'customer.lists.dateend' => array( |
86
|
|
|
'code' => 'customer.lists.dateend', |
87
|
|
|
'internalcode' => 'fosli."end"', |
88
|
|
|
'label' => 'Customer list end date/time', |
89
|
|
|
'type'=> 'datetime', |
90
|
|
|
'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
91
|
|
|
), |
92
|
|
|
'customer.lists.config' => array( |
93
|
|
|
'code' => 'customer.lists.config', |
94
|
|
|
'internalcode' => 'fosli."config"', |
95
|
|
|
'label' => 'Customer list position', |
96
|
|
|
'type'=> 'string', |
97
|
|
|
'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
98
|
|
|
), |
99
|
|
|
'customer.lists.position' => array( |
100
|
|
|
'code' => 'customer.lists.position', |
101
|
|
|
'internalcode' => 'fosli."pos"', |
102
|
|
|
'label' => 'Customer list position', |
103
|
|
|
'type'=> 'integer', |
104
|
|
|
'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT, |
105
|
|
|
), |
106
|
|
|
'customer.lists.status' => array( |
107
|
|
|
'code' => 'customer.lists.status', |
108
|
|
|
'internalcode' => 'fosli."status"', |
109
|
|
|
'label' => 'Customer list status', |
110
|
|
|
'type'=> 'integer', |
111
|
|
|
'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT, |
112
|
|
|
), |
113
|
|
|
'customer.lists.ctime'=> array( |
114
|
|
|
'code' => 'customer.lists.ctime', |
115
|
|
|
'internalcode' => 'fosli."ctime"', |
116
|
|
|
'label' => 'Customer list create date/time', |
117
|
|
|
'type'=> 'datetime', |
118
|
|
|
'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
119
|
|
|
), |
120
|
|
|
'customer.lists.mtime'=> array( |
121
|
|
|
'code' => 'customer.lists.mtime', |
122
|
|
|
'internalcode' => 'fosli."mtime"', |
123
|
|
|
'label' => 'Customer list modification date/time', |
124
|
|
|
'type'=> 'datetime', |
125
|
|
|
'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
126
|
|
|
), |
127
|
|
|
'customer.lists.editor'=> array( |
128
|
|
|
'code' => 'customer.lists.editor', |
129
|
|
|
'internalcode' => 'fosli."editor"', |
130
|
|
|
'label' => 'Customer list editor', |
131
|
|
|
'type'=> 'string', |
132
|
|
|
'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
133
|
|
|
), |
134
|
|
|
); |
135
|
|
|
|
136
|
|
|
|
137
|
|
|
/** |
138
|
|
|
* Removes old entries from the storage. |
139
|
|
|
* |
140
|
|
|
* @param string[] $siteids List of IDs for sites whose entries should be deleted |
141
|
|
|
* @return \Aimeos\MShop\Common\Manager\Iface Same object for fluent interface |
142
|
|
|
*/ |
143
|
|
|
public function clear( array $siteids ) : \Aimeos\MShop\Common\Manager\Iface |
144
|
|
|
{ |
145
|
|
|
$path = 'mshop/customer/manager/lists/submanagers'; |
146
|
|
|
foreach( $this->getContext()->getConfig()->get( $path, ['type'] ) as $domain ) { |
147
|
|
|
$this->getObject()->getSubManager( $domain )->clear( $siteids ); |
148
|
|
|
} |
149
|
|
|
|
150
|
|
|
return $this->clearBase( $siteids, 'mshop/customer/manager/lists/fosuser/delete' ); |
151
|
|
|
} |
152
|
|
|
|
153
|
|
|
|
154
|
|
|
/** |
155
|
|
|
* Returns the list attributes that can be used for searching. |
156
|
|
|
* |
157
|
|
|
* @param bool $withsub Return also attributes of sub-managers if true |
158
|
|
|
* @return array List of attribute items implementing \Aimeos\MW\Criteria\Attribute\Iface |
159
|
|
|
*/ |
160
|
|
|
public function getSearchAttributes( bool $withsub = true ) : array |
161
|
|
|
{ |
162
|
|
|
$path = 'mshop/customer/manager/lists/submanagers'; |
163
|
|
|
|
164
|
|
|
return $this->getSearchAttributesBase( $this->searchConfig, $path, [], $withsub ); |
165
|
|
|
} |
166
|
|
|
|
167
|
|
|
|
168
|
|
|
/** |
169
|
|
|
* Returns a new manager for customer extensions |
170
|
|
|
* |
171
|
|
|
* @param string $manager Name of the sub manager type in lower case |
172
|
|
|
* @param string|null $name Name of the implementation, will be from configuration (or Default) if null |
173
|
|
|
* @return mixed Manager for different extensions, e.g stock, tags, locations, etc. |
174
|
|
|
*/ |
175
|
|
|
public function getSubManager( string $manager, string $name = null ) : \Aimeos\MShop\Common\Manager\Iface |
176
|
|
|
{ |
177
|
|
|
return $this->getSubManagerBase( 'customer', 'lists/' . $manager, ( $name === null ? 'FosUser' : $name ) ); |
178
|
|
|
} |
179
|
|
|
|
180
|
|
|
|
181
|
|
|
/** |
182
|
|
|
* Returns the config path for retrieving the configuration values. |
183
|
|
|
* |
184
|
|
|
* @return string Configuration path (mshop/customer/manager/lists/type/fosuser/) |
185
|
|
|
*/ |
186
|
|
|
protected function getConfigPath() : string |
187
|
|
|
{ |
188
|
|
|
return 'mshop/customer/manager/lists/fosuser/'; |
189
|
|
|
} |
190
|
|
|
|
191
|
|
|
|
192
|
|
|
/** |
193
|
|
|
* Returns the search configuration for searching items. |
194
|
|
|
* |
195
|
|
|
* @return array Associative list of search keys and search definitions |
196
|
|
|
*/ |
197
|
|
|
protected function getSearchConfig() : array |
198
|
|
|
{ |
199
|
|
|
return $this->searchConfig; |
200
|
|
|
} |
201
|
|
|
} |
202
|
|
|
|