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 Laravel |
21
|
|
|
extends \Aimeos\MShop\Common\Manager\Property\Base |
|
|
|
|
22
|
|
|
implements \Aimeos\MShop\Customer\Manager\Property\Iface |
|
|
|
|
23
|
|
|
{ |
24
|
|
|
private $searchConfig = array( |
|
|
|
|
25
|
|
|
'customer.property.id' => array( |
26
|
|
|
'code' => 'customer.property.id', |
27
|
|
|
'internalcode' => 'lvupr."id"', |
28
|
|
|
'internaldeps'=>array( 'LEFT JOIN "users_property" AS lvupr ON ( lvupr."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' => 'lvupr."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' => 'lvupr."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' => 'lvupr."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' => 'lvupr."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' => 'lvupr."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' => 'lvupr."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' => 'lvupr."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' => 'lvupr."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
|
|
View Code Duplication |
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/laravel/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 ? 'Laravel' : $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/laravel/'; |
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
|
|
|
|