@@ -18,424 +18,424 @@ |
||
18 | 18 | * @subpackage Customer |
19 | 19 | */ |
20 | 20 | class Ezpublish |
21 | - extends \Aimeos\MShop\Customer\Manager\Standard |
|
21 | + extends \Aimeos\MShop\Customer\Manager\Standard |
|
22 | 22 | { |
23 | - private $searchConfig = array( |
|
24 | - 'customer.id' => array( |
|
25 | - 'label' => 'Customer ID', |
|
26 | - 'code' => 'customer.id', |
|
27 | - 'internalcode' => 'ezu."contentobject_id"', |
|
28 | - 'type' => 'integer', |
|
29 | - 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT |
|
30 | - ), |
|
31 | - // customer.siteid is not available |
|
32 | - 'customer.label' => array( |
|
33 | - 'label' => 'Customer label', |
|
34 | - 'code' => 'customer.label', |
|
35 | - 'internalcode' => 'ezu."login"', |
|
36 | - 'type' => 'string', |
|
37 | - 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR |
|
38 | - ), |
|
39 | - 'customer.code' => array( |
|
40 | - 'label' => 'Customer username', |
|
41 | - 'code' => 'customer.code', |
|
42 | - 'internalcode' => 'ezu."login_normalized"', |
|
43 | - 'type' => 'string', |
|
44 | - 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR |
|
45 | - ), |
|
46 | - 'customer.salutation' => array( |
|
47 | - 'label' => 'Customer salutation', |
|
48 | - 'code' => 'customer.salutation', |
|
49 | - 'internalcode' => 'ezu."salutation"', |
|
50 | - 'type' => 'string', |
|
51 | - 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
52 | - ), |
|
53 | - 'customer.company'=> array( |
|
54 | - 'label' => 'Customer company', |
|
55 | - 'code' => 'customer.company', |
|
56 | - 'internalcode' => 'ezu."company"', |
|
57 | - 'type' => 'string', |
|
58 | - 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
59 | - ), |
|
60 | - 'customer.vatid'=> array( |
|
61 | - 'label' => 'Customer VAT ID', |
|
62 | - 'code' => 'customer.vatid', |
|
63 | - 'internalcode' => 'ezu."vatid"', |
|
64 | - 'type' => 'string', |
|
65 | - 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
66 | - ), |
|
67 | - 'customer.title' => array( |
|
68 | - 'label' => 'Customer title', |
|
69 | - 'code' => 'customer.title', |
|
70 | - 'internalcode' => 'ezu."title"', |
|
71 | - 'type' => 'string', |
|
72 | - 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
73 | - ), |
|
74 | - 'customer.firstname' => array( |
|
75 | - 'label' => 'Customer firstname', |
|
76 | - 'code' => 'customer.firstname', |
|
77 | - 'internalcode' => 'ezu."firstname"', |
|
78 | - 'type' => 'string', |
|
79 | - 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
80 | - ), |
|
81 | - 'customer.lastname' => array( |
|
82 | - 'label' => 'Customer lastname', |
|
83 | - 'code' => 'customer.lastname', |
|
84 | - 'internalcode' => 'ezu."lastname"', |
|
85 | - 'type' => 'string', |
|
86 | - 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
87 | - ), |
|
88 | - 'customer.address1' => array( |
|
89 | - 'label' => 'Customer address part one', |
|
90 | - 'code' => 'customer.address1', |
|
91 | - 'internalcode' => 'ezu."address1"', |
|
92 | - 'type' => 'string', |
|
93 | - 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
94 | - ), |
|
95 | - 'customer.address2' => array( |
|
96 | - 'label' => 'Customer address part two', |
|
97 | - 'code' => 'customer.address2', |
|
98 | - 'internalcode' => 'ezu."address2"', |
|
99 | - 'type' => 'string', |
|
100 | - 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
101 | - ), |
|
102 | - 'customer.address3' => array( |
|
103 | - 'label' => 'Customer address part three', |
|
104 | - 'code' => 'customer.address3', |
|
105 | - 'internalcode' => 'ezu."address3"', |
|
106 | - 'type' => 'string', |
|
107 | - 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
108 | - ), |
|
109 | - 'customer.postal' => array( |
|
110 | - 'label' => 'Customer postal', |
|
111 | - 'code' => 'customer.postal', |
|
112 | - 'internalcode' => 'ezu."postal"', |
|
113 | - 'type' => 'string', |
|
114 | - 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
115 | - ), |
|
116 | - 'customer.city' => array( |
|
117 | - 'label' => 'Customer city', |
|
118 | - 'code' => 'customer.city', |
|
119 | - 'internalcode' => 'ezu."city"', |
|
120 | - 'type' => 'string', |
|
121 | - 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
122 | - ), |
|
123 | - 'customer.state' => array( |
|
124 | - 'label' => 'Customer state', |
|
125 | - 'code' => 'customer.state', |
|
126 | - 'internalcode' => 'ezu."state"', |
|
127 | - 'type' => 'string', |
|
128 | - 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
129 | - ), |
|
130 | - 'customer.languageid' => array( |
|
131 | - 'label' => 'Customer language', |
|
132 | - 'code' => 'customer.languageid', |
|
133 | - 'internalcode' => 'ezu."langid"', |
|
134 | - 'type' => 'string', |
|
135 | - 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
136 | - ), |
|
137 | - 'customer.countryid' => array( |
|
138 | - 'label' => 'Customer country', |
|
139 | - 'code' => 'customer.countryid', |
|
140 | - 'internalcode' => 'ezu."countryid"', |
|
141 | - 'type' => 'string', |
|
142 | - 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
143 | - ), |
|
144 | - 'customer.telephone' => array( |
|
145 | - 'label' => 'Customer telephone', |
|
146 | - 'code' => 'customer.telephone', |
|
147 | - 'internalcode' => 'ezu."telephone"', |
|
148 | - 'type' => 'string', |
|
149 | - 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
150 | - ), |
|
151 | - 'customer.email' => array( |
|
152 | - 'label' => 'Customer email', |
|
153 | - 'code' => 'customer.email', |
|
154 | - 'internalcode' => 'ezu."email"', |
|
155 | - 'type' => 'string', |
|
156 | - 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
157 | - ), |
|
158 | - 'customer.telefax' => array( |
|
159 | - 'label' => 'Customer telefax', |
|
160 | - 'code' => 'customer.telefax', |
|
161 | - 'internalcode' => 'ezu."telefax"', |
|
162 | - 'type' => 'string', |
|
163 | - 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
164 | - ), |
|
165 | - 'customer.website' => array( |
|
166 | - 'label' => 'Customer website', |
|
167 | - 'code' => 'customer.website', |
|
168 | - 'internalcode' => 'ezu."website"', |
|
169 | - 'type' => 'string', |
|
170 | - 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
171 | - ), |
|
172 | - 'customer.birthday' => array( |
|
173 | - 'label' => 'Customer birthday', |
|
174 | - 'code' => 'customer.birthday', |
|
175 | - 'internalcode' => 'ezu."birthday"', |
|
176 | - 'type' => 'string', |
|
177 | - 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
178 | - ), |
|
179 | - 'customer.password'=> array( |
|
180 | - 'label' => 'Customer password', |
|
181 | - 'code' => 'customer.password', |
|
182 | - 'internalcode' => 'ezu."password_hash"', |
|
183 | - 'type' => 'string', |
|
184 | - 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
185 | - ), |
|
186 | - 'customer.status'=> array( |
|
187 | - 'label' => 'Customer status', |
|
188 | - 'code' => 'customer.status', |
|
189 | - 'internalcode' => 'ezs."is_enabled"', |
|
190 | - 'type' => 'integer', |
|
191 | - 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT |
|
192 | - ), |
|
193 | - 'customer.dateverified'=> array( |
|
194 | - 'label' => 'Customer verification date', |
|
195 | - 'code' => 'customer.dateverified', |
|
196 | - 'internalcode' => 'ezu."vdate"', |
|
197 | - 'type' => 'date', |
|
198 | - 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
199 | - ), |
|
200 | - 'customer.ctime'=> array( |
|
201 | - 'label' => 'Customer creation time', |
|
202 | - 'code' => 'customer.ctime', |
|
203 | - 'internalcode' => 'ezu."ctime"', |
|
204 | - 'type' => 'datetime', |
|
205 | - 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
206 | - ), |
|
207 | - 'customer.mtime'=> array( |
|
208 | - 'label' => 'Customer modification time', |
|
209 | - 'code' => 'customer.mtime', |
|
210 | - 'internalcode' => 'ezu."mtime"', |
|
211 | - 'type' => 'datetime', |
|
212 | - 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
213 | - ), |
|
214 | - 'customer.editor'=> array( |
|
215 | - 'label'=>'Customer editor', |
|
216 | - 'code'=>'customer.editor', |
|
217 | - 'internalcode' => 'ezu."editor"', |
|
218 | - 'type'=> 'string', |
|
219 | - 'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
220 | - ), |
|
221 | - ); |
|
222 | - |
|
223 | - private $addressManager; |
|
224 | - |
|
225 | - |
|
226 | - /** |
|
227 | - * Removes old entries from the storage. |
|
228 | - * |
|
229 | - * @param array $siteids List of IDs for sites whose entries should be deleted |
|
230 | - */ |
|
231 | - public function cleanup( array $siteids ) |
|
232 | - { |
|
233 | - $path = 'mshop/customer/manager/submanagers'; |
|
234 | - foreach( $this->getContext()->getConfig()->get( $path, array( 'address', 'lists' ) ) as $domain ) { |
|
235 | - $this->getSubManager( $domain )->cleanup( $siteids ); |
|
236 | - } |
|
237 | - } |
|
238 | - |
|
239 | - |
|
240 | - /** |
|
241 | - * Removes multiple items specified by ids in the array. |
|
242 | - * |
|
243 | - * @param array $ids List of IDs |
|
244 | - */ |
|
245 | - public function deleteItems( array $ids ) |
|
246 | - { |
|
247 | - $path = 'mshop/customer/manager/ezpublish/delete'; |
|
248 | - $this->deleteItemsBase( $ids, $path, false, 'contentobject_id' ); |
|
249 | - } |
|
250 | - |
|
251 | - |
|
252 | - /** |
|
253 | - * Returns the list attributes that can be used for searching. |
|
254 | - * |
|
255 | - * @param boolean $withsub Return also attributes of sub-managers if true |
|
256 | - * @return array List of attribute items implementing \Aimeos\MW\Criteria\Attribute\Iface |
|
257 | - */ |
|
258 | - public function getSearchAttributes( $withsub = true ) |
|
259 | - { |
|
260 | - $path = 'mshop/customer/manager/submanagers'; |
|
261 | - |
|
262 | - return $this->getSearchAttributesBase( $this->searchConfig, $path, array( 'address', 'lists' ), $withsub ); |
|
263 | - } |
|
264 | - |
|
265 | - |
|
266 | - /** |
|
267 | - * Instantiates a new customer item object. |
|
268 | - * |
|
269 | - * @return \Aimeos\MShop\Customer\Item\Iface New customer item object |
|
270 | - */ |
|
271 | - public function createItem() |
|
272 | - { |
|
273 | - return $this->createItemBase(); |
|
274 | - } |
|
275 | - |
|
276 | - |
|
277 | - /** |
|
278 | - * Saves a customer item object. |
|
279 | - * |
|
280 | - * @param \Aimeos\MShop\Customer\Item\Iface $item Customer item object |
|
281 | - * @param boolean $fetch True if the new ID should be returned in the item |
|
282 | - */ |
|
283 | - public function saveItem( \Aimeos\MShop\Common\Item\Iface $item, $fetch = true ) |
|
284 | - { |
|
285 | - $iface = '\\Aimeos\\MShop\\Customer\\Item\\Iface'; |
|
286 | - if( !( $item instanceof $iface ) ) { |
|
287 | - throw new \Aimeos\MShop\Customer\Exception( sprintf( 'Object is not of required type "%1$s"', $iface ) ); |
|
288 | - } |
|
289 | - |
|
290 | - if( !$item->isModified() ) { return; } |
|
291 | - |
|
292 | - $context = $this->getContext(); |
|
293 | - |
|
294 | - $class = '\Aimeos\MShop\Context\Item\Ezpublish'; |
|
295 | - if( !is_a( $context, $class ) ) { |
|
296 | - throw new \Aimeos\MShop\Customer\Exception( sprintf( 'Object is not of required type "%1$s"', $class ) ); |
|
297 | - } |
|
298 | - |
|
299 | - if( $item->getId() === null ) |
|
300 | - { |
|
301 | - $fcn = $context->getEzUser(); |
|
302 | - $contentId = $fcn( $item->getCode(), $item->getPaymentAddress()->getEmail(), $item->getPassword() ); |
|
303 | - $item->setId( $contentId ); |
|
304 | - } |
|
305 | - |
|
306 | - $dbm = $context->getDatabaseManager(); |
|
307 | - $dbname = $this->getResourceName(); |
|
308 | - $conn = $dbm->acquire( $dbname ); |
|
309 | - |
|
310 | - try |
|
311 | - { |
|
312 | - $date = date( 'Y-m-d H:i:s' ); |
|
313 | - $ctime = ( $item->getTimeCreated() ? $item->getTimeCreated() : $date ); |
|
314 | - $billingAddress = $item->getPaymentAddress(); |
|
315 | - |
|
316 | - $path = 'mshop/customer/manager/ezpublish/update'; |
|
317 | - $stmt = $this->getCachedStatement( $conn, $path ); |
|
318 | - |
|
319 | - $stmt->bind( 1, $item->getCode() ); // login normalized |
|
320 | - $stmt->bind( 2, $item->getCode() ); // login |
|
321 | - $stmt->bind( 3, $billingAddress->getCompany() ); |
|
322 | - $stmt->bind( 4, $billingAddress->getVatID() ); |
|
323 | - $stmt->bind( 5, $billingAddress->getSalutation() ); |
|
324 | - $stmt->bind( 6, $billingAddress->getTitle() ); |
|
325 | - $stmt->bind( 7, $billingAddress->getFirstname() ); |
|
326 | - $stmt->bind( 8, $billingAddress->getLastname() ); |
|
327 | - $stmt->bind( 9, $billingAddress->getAddress1() ); |
|
328 | - $stmt->bind( 10, $billingAddress->getAddress2() ); |
|
329 | - $stmt->bind( 11, $billingAddress->getAddress3() ); |
|
330 | - $stmt->bind( 12, $billingAddress->getPostal() ); |
|
331 | - $stmt->bind( 13, $billingAddress->getCity() ); |
|
332 | - $stmt->bind( 14, $billingAddress->getState() ); |
|
333 | - $stmt->bind( 15, $billingAddress->getCountryId() ); |
|
334 | - $stmt->bind( 16, $billingAddress->getLanguageId() ); |
|
335 | - $stmt->bind( 17, $billingAddress->getTelephone() ); |
|
336 | - $stmt->bind( 18, $billingAddress->getEmail() ); |
|
337 | - $stmt->bind( 19, $billingAddress->getTelefax() ); |
|
338 | - $stmt->bind( 20, $billingAddress->getWebsite() ); |
|
339 | - $stmt->bind( 21, $item->getBirthday() ); |
|
340 | - $stmt->bind( 22, $item->getStatus(), \Aimeos\MW\DB\Statement\Base::PARAM_INT ); |
|
341 | - $stmt->bind( 23, $item->getDateVerified() ); |
|
342 | - $stmt->bind( 24, $item->getPassword() ); |
|
343 | - $stmt->bind( 25, $date ); // Modification time |
|
344 | - $stmt->bind( 26, $context->getEditor() ); |
|
345 | - $stmt->bind( 27, $ctime ); // Creation time |
|
346 | - $stmt->bind( 28, $item->getId(), \Aimeos\MW\DB\Statement\Base::PARAM_INT ); |
|
347 | - |
|
348 | - $stmt->execute()->finish(); |
|
349 | - |
|
350 | - |
|
351 | - $path = 'mshop/customer/manager/ezpublish/update-status'; |
|
352 | - $stmt = $this->getCachedStatement( $conn, $path ); |
|
353 | - |
|
354 | - $stmt->bind( 1, $item->getStatus(), \Aimeos\MW\DB\Statement\Base::PARAM_INT ); |
|
355 | - $stmt->bind( 2, $item->getId(), \Aimeos\MW\DB\Statement\Base::PARAM_INT ); |
|
356 | - |
|
357 | - $stmt->execute()->finish(); |
|
358 | - |
|
359 | - |
|
360 | - $dbm->release( $conn, $dbname ); |
|
361 | - } |
|
362 | - catch( \Exception $e ) |
|
363 | - { |
|
364 | - $dbm->release( $conn, $dbname ); |
|
365 | - throw $e; |
|
366 | - } |
|
367 | - } |
|
368 | - |
|
369 | - |
|
370 | - /** |
|
371 | - * Returns the item objects matched by the given search criteria. |
|
372 | - * |
|
373 | - * @param \Aimeos\MW\Criteria\Iface $search Search criteria object |
|
374 | - * @param integer &$total Number of items that are available in total |
|
375 | - * @return array List of items implementing \Aimeos\MShop\Customer\Item\Iface |
|
376 | - * @throws \Aimeos\MShop\Customer\Exception If creating items failed |
|
377 | - */ |
|
378 | - public function searchItems( \Aimeos\MW\Criteria\Iface $search, array $ref = array(), &$total = null ) |
|
379 | - { |
|
380 | - $dbm = $this->getContext()->getDatabaseManager(); |
|
381 | - $dbname = $this->getResourceName(); |
|
382 | - $conn = $dbm->acquire( $dbname ); |
|
383 | - $map = array(); |
|
384 | - |
|
385 | - try |
|
386 | - { |
|
387 | - $level = \Aimeos\MShop\Locale\Manager\Base::SITE_ALL; |
|
388 | - $cfgPathSearch = 'mshop/customer/manager/ezpublish/search'; |
|
389 | - $cfgPathCount = 'mshop/customer/manager/ezpublish/count'; |
|
390 | - $required = array( 'customer' ); |
|
391 | - |
|
392 | - $results = $this->searchItemsBase( $conn, $search, $cfgPathSearch, $cfgPathCount, $required, $total, $level ); |
|
393 | - while( ( $row = $results->fetch() ) !== false ) { |
|
394 | - $map[ $row['customer.id'] ] = $row; |
|
395 | - } |
|
396 | - |
|
397 | - $dbm->release( $conn, $dbname ); |
|
398 | - } |
|
399 | - catch( \Exception $e ) |
|
400 | - { |
|
401 | - $dbm->release( $conn, $dbname ); |
|
402 | - throw $e; |
|
403 | - } |
|
404 | - |
|
405 | - return $this->buildItems( $map, $ref, 'customer' ); |
|
406 | - } |
|
407 | - |
|
408 | - |
|
409 | - /** |
|
410 | - * Returns a new manager for customer extensions |
|
411 | - * |
|
412 | - * @param string $manager Name of the sub manager type in lower case |
|
413 | - * @param string|null $name Name of the implementation, will be from configuration (or Default) if null |
|
414 | - * @return mixed Manager for different extensions, e.g stock, tags, locations, etc. |
|
415 | - */ |
|
416 | - public function getSubManager( $manager, $name = null ) |
|
417 | - { |
|
418 | - return $this->getSubManagerBase( 'customer', $manager, ( $name === null ? 'Ezpublish' : $name ) ); |
|
419 | - } |
|
420 | - |
|
421 | - |
|
422 | - /** |
|
423 | - * Creates a new customer item. |
|
424 | - * |
|
425 | - * @param array $values List of attributes for customer item |
|
426 | - * @param array $listItems List items associated to the customer item |
|
427 | - * @param array $refItems Items referenced by the customer item via the list items |
|
428 | - * @return \Aimeos\MShop\Customer\Item\Iface New customer item |
|
429 | - */ |
|
430 | - protected function createItemBase( array $values = array(), array $listItems = array(), array $refItems = array() ) |
|
431 | - { |
|
432 | - if( !isset( $this->addressManager ) ) { |
|
433 | - $this->addressManager = $this->getSubManager( 'address' ); |
|
434 | - } |
|
435 | - |
|
436 | - $helper = $this->getPasswordHelper(); |
|
437 | - $address = $this->addressManager->createItem(); |
|
438 | - |
|
439 | - return new \Aimeos\MShop\Customer\Item\Standard( $address, $values, $listItems, $refItems, null, $helper ); |
|
440 | - } |
|
23 | + private $searchConfig = array( |
|
24 | + 'customer.id' => array( |
|
25 | + 'label' => 'Customer ID', |
|
26 | + 'code' => 'customer.id', |
|
27 | + 'internalcode' => 'ezu."contentobject_id"', |
|
28 | + 'type' => 'integer', |
|
29 | + 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT |
|
30 | + ), |
|
31 | + // customer.siteid is not available |
|
32 | + 'customer.label' => array( |
|
33 | + 'label' => 'Customer label', |
|
34 | + 'code' => 'customer.label', |
|
35 | + 'internalcode' => 'ezu."login"', |
|
36 | + 'type' => 'string', |
|
37 | + 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR |
|
38 | + ), |
|
39 | + 'customer.code' => array( |
|
40 | + 'label' => 'Customer username', |
|
41 | + 'code' => 'customer.code', |
|
42 | + 'internalcode' => 'ezu."login_normalized"', |
|
43 | + 'type' => 'string', |
|
44 | + 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR |
|
45 | + ), |
|
46 | + 'customer.salutation' => array( |
|
47 | + 'label' => 'Customer salutation', |
|
48 | + 'code' => 'customer.salutation', |
|
49 | + 'internalcode' => 'ezu."salutation"', |
|
50 | + 'type' => 'string', |
|
51 | + 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
52 | + ), |
|
53 | + 'customer.company'=> array( |
|
54 | + 'label' => 'Customer company', |
|
55 | + 'code' => 'customer.company', |
|
56 | + 'internalcode' => 'ezu."company"', |
|
57 | + 'type' => 'string', |
|
58 | + 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
59 | + ), |
|
60 | + 'customer.vatid'=> array( |
|
61 | + 'label' => 'Customer VAT ID', |
|
62 | + 'code' => 'customer.vatid', |
|
63 | + 'internalcode' => 'ezu."vatid"', |
|
64 | + 'type' => 'string', |
|
65 | + 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
66 | + ), |
|
67 | + 'customer.title' => array( |
|
68 | + 'label' => 'Customer title', |
|
69 | + 'code' => 'customer.title', |
|
70 | + 'internalcode' => 'ezu."title"', |
|
71 | + 'type' => 'string', |
|
72 | + 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
73 | + ), |
|
74 | + 'customer.firstname' => array( |
|
75 | + 'label' => 'Customer firstname', |
|
76 | + 'code' => 'customer.firstname', |
|
77 | + 'internalcode' => 'ezu."firstname"', |
|
78 | + 'type' => 'string', |
|
79 | + 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
80 | + ), |
|
81 | + 'customer.lastname' => array( |
|
82 | + 'label' => 'Customer lastname', |
|
83 | + 'code' => 'customer.lastname', |
|
84 | + 'internalcode' => 'ezu."lastname"', |
|
85 | + 'type' => 'string', |
|
86 | + 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
87 | + ), |
|
88 | + 'customer.address1' => array( |
|
89 | + 'label' => 'Customer address part one', |
|
90 | + 'code' => 'customer.address1', |
|
91 | + 'internalcode' => 'ezu."address1"', |
|
92 | + 'type' => 'string', |
|
93 | + 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
94 | + ), |
|
95 | + 'customer.address2' => array( |
|
96 | + 'label' => 'Customer address part two', |
|
97 | + 'code' => 'customer.address2', |
|
98 | + 'internalcode' => 'ezu."address2"', |
|
99 | + 'type' => 'string', |
|
100 | + 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
101 | + ), |
|
102 | + 'customer.address3' => array( |
|
103 | + 'label' => 'Customer address part three', |
|
104 | + 'code' => 'customer.address3', |
|
105 | + 'internalcode' => 'ezu."address3"', |
|
106 | + 'type' => 'string', |
|
107 | + 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
108 | + ), |
|
109 | + 'customer.postal' => array( |
|
110 | + 'label' => 'Customer postal', |
|
111 | + 'code' => 'customer.postal', |
|
112 | + 'internalcode' => 'ezu."postal"', |
|
113 | + 'type' => 'string', |
|
114 | + 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
115 | + ), |
|
116 | + 'customer.city' => array( |
|
117 | + 'label' => 'Customer city', |
|
118 | + 'code' => 'customer.city', |
|
119 | + 'internalcode' => 'ezu."city"', |
|
120 | + 'type' => 'string', |
|
121 | + 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
122 | + ), |
|
123 | + 'customer.state' => array( |
|
124 | + 'label' => 'Customer state', |
|
125 | + 'code' => 'customer.state', |
|
126 | + 'internalcode' => 'ezu."state"', |
|
127 | + 'type' => 'string', |
|
128 | + 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
129 | + ), |
|
130 | + 'customer.languageid' => array( |
|
131 | + 'label' => 'Customer language', |
|
132 | + 'code' => 'customer.languageid', |
|
133 | + 'internalcode' => 'ezu."langid"', |
|
134 | + 'type' => 'string', |
|
135 | + 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
136 | + ), |
|
137 | + 'customer.countryid' => array( |
|
138 | + 'label' => 'Customer country', |
|
139 | + 'code' => 'customer.countryid', |
|
140 | + 'internalcode' => 'ezu."countryid"', |
|
141 | + 'type' => 'string', |
|
142 | + 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
143 | + ), |
|
144 | + 'customer.telephone' => array( |
|
145 | + 'label' => 'Customer telephone', |
|
146 | + 'code' => 'customer.telephone', |
|
147 | + 'internalcode' => 'ezu."telephone"', |
|
148 | + 'type' => 'string', |
|
149 | + 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
150 | + ), |
|
151 | + 'customer.email' => array( |
|
152 | + 'label' => 'Customer email', |
|
153 | + 'code' => 'customer.email', |
|
154 | + 'internalcode' => 'ezu."email"', |
|
155 | + 'type' => 'string', |
|
156 | + 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
157 | + ), |
|
158 | + 'customer.telefax' => array( |
|
159 | + 'label' => 'Customer telefax', |
|
160 | + 'code' => 'customer.telefax', |
|
161 | + 'internalcode' => 'ezu."telefax"', |
|
162 | + 'type' => 'string', |
|
163 | + 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
164 | + ), |
|
165 | + 'customer.website' => array( |
|
166 | + 'label' => 'Customer website', |
|
167 | + 'code' => 'customer.website', |
|
168 | + 'internalcode' => 'ezu."website"', |
|
169 | + 'type' => 'string', |
|
170 | + 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
171 | + ), |
|
172 | + 'customer.birthday' => array( |
|
173 | + 'label' => 'Customer birthday', |
|
174 | + 'code' => 'customer.birthday', |
|
175 | + 'internalcode' => 'ezu."birthday"', |
|
176 | + 'type' => 'string', |
|
177 | + 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
178 | + ), |
|
179 | + 'customer.password'=> array( |
|
180 | + 'label' => 'Customer password', |
|
181 | + 'code' => 'customer.password', |
|
182 | + 'internalcode' => 'ezu."password_hash"', |
|
183 | + 'type' => 'string', |
|
184 | + 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
185 | + ), |
|
186 | + 'customer.status'=> array( |
|
187 | + 'label' => 'Customer status', |
|
188 | + 'code' => 'customer.status', |
|
189 | + 'internalcode' => 'ezs."is_enabled"', |
|
190 | + 'type' => 'integer', |
|
191 | + 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT |
|
192 | + ), |
|
193 | + 'customer.dateverified'=> array( |
|
194 | + 'label' => 'Customer verification date', |
|
195 | + 'code' => 'customer.dateverified', |
|
196 | + 'internalcode' => 'ezu."vdate"', |
|
197 | + 'type' => 'date', |
|
198 | + 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
199 | + ), |
|
200 | + 'customer.ctime'=> array( |
|
201 | + 'label' => 'Customer creation time', |
|
202 | + 'code' => 'customer.ctime', |
|
203 | + 'internalcode' => 'ezu."ctime"', |
|
204 | + 'type' => 'datetime', |
|
205 | + 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
206 | + ), |
|
207 | + 'customer.mtime'=> array( |
|
208 | + 'label' => 'Customer modification time', |
|
209 | + 'code' => 'customer.mtime', |
|
210 | + 'internalcode' => 'ezu."mtime"', |
|
211 | + 'type' => 'datetime', |
|
212 | + 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
213 | + ), |
|
214 | + 'customer.editor'=> array( |
|
215 | + 'label'=>'Customer editor', |
|
216 | + 'code'=>'customer.editor', |
|
217 | + 'internalcode' => 'ezu."editor"', |
|
218 | + 'type'=> 'string', |
|
219 | + 'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
220 | + ), |
|
221 | + ); |
|
222 | + |
|
223 | + private $addressManager; |
|
224 | + |
|
225 | + |
|
226 | + /** |
|
227 | + * Removes old entries from the storage. |
|
228 | + * |
|
229 | + * @param array $siteids List of IDs for sites whose entries should be deleted |
|
230 | + */ |
|
231 | + public function cleanup( array $siteids ) |
|
232 | + { |
|
233 | + $path = 'mshop/customer/manager/submanagers'; |
|
234 | + foreach( $this->getContext()->getConfig()->get( $path, array( 'address', 'lists' ) ) as $domain ) { |
|
235 | + $this->getSubManager( $domain )->cleanup( $siteids ); |
|
236 | + } |
|
237 | + } |
|
238 | + |
|
239 | + |
|
240 | + /** |
|
241 | + * Removes multiple items specified by ids in the array. |
|
242 | + * |
|
243 | + * @param array $ids List of IDs |
|
244 | + */ |
|
245 | + public function deleteItems( array $ids ) |
|
246 | + { |
|
247 | + $path = 'mshop/customer/manager/ezpublish/delete'; |
|
248 | + $this->deleteItemsBase( $ids, $path, false, 'contentobject_id' ); |
|
249 | + } |
|
250 | + |
|
251 | + |
|
252 | + /** |
|
253 | + * Returns the list attributes that can be used for searching. |
|
254 | + * |
|
255 | + * @param boolean $withsub Return also attributes of sub-managers if true |
|
256 | + * @return array List of attribute items implementing \Aimeos\MW\Criteria\Attribute\Iface |
|
257 | + */ |
|
258 | + public function getSearchAttributes( $withsub = true ) |
|
259 | + { |
|
260 | + $path = 'mshop/customer/manager/submanagers'; |
|
261 | + |
|
262 | + return $this->getSearchAttributesBase( $this->searchConfig, $path, array( 'address', 'lists' ), $withsub ); |
|
263 | + } |
|
264 | + |
|
265 | + |
|
266 | + /** |
|
267 | + * Instantiates a new customer item object. |
|
268 | + * |
|
269 | + * @return \Aimeos\MShop\Customer\Item\Iface New customer item object |
|
270 | + */ |
|
271 | + public function createItem() |
|
272 | + { |
|
273 | + return $this->createItemBase(); |
|
274 | + } |
|
275 | + |
|
276 | + |
|
277 | + /** |
|
278 | + * Saves a customer item object. |
|
279 | + * |
|
280 | + * @param \Aimeos\MShop\Customer\Item\Iface $item Customer item object |
|
281 | + * @param boolean $fetch True if the new ID should be returned in the item |
|
282 | + */ |
|
283 | + public function saveItem( \Aimeos\MShop\Common\Item\Iface $item, $fetch = true ) |
|
284 | + { |
|
285 | + $iface = '\\Aimeos\\MShop\\Customer\\Item\\Iface'; |
|
286 | + if( !( $item instanceof $iface ) ) { |
|
287 | + throw new \Aimeos\MShop\Customer\Exception( sprintf( 'Object is not of required type "%1$s"', $iface ) ); |
|
288 | + } |
|
289 | + |
|
290 | + if( !$item->isModified() ) { return; } |
|
291 | + |
|
292 | + $context = $this->getContext(); |
|
293 | + |
|
294 | + $class = '\Aimeos\MShop\Context\Item\Ezpublish'; |
|
295 | + if( !is_a( $context, $class ) ) { |
|
296 | + throw new \Aimeos\MShop\Customer\Exception( sprintf( 'Object is not of required type "%1$s"', $class ) ); |
|
297 | + } |
|
298 | + |
|
299 | + if( $item->getId() === null ) |
|
300 | + { |
|
301 | + $fcn = $context->getEzUser(); |
|
302 | + $contentId = $fcn( $item->getCode(), $item->getPaymentAddress()->getEmail(), $item->getPassword() ); |
|
303 | + $item->setId( $contentId ); |
|
304 | + } |
|
305 | + |
|
306 | + $dbm = $context->getDatabaseManager(); |
|
307 | + $dbname = $this->getResourceName(); |
|
308 | + $conn = $dbm->acquire( $dbname ); |
|
309 | + |
|
310 | + try |
|
311 | + { |
|
312 | + $date = date( 'Y-m-d H:i:s' ); |
|
313 | + $ctime = ( $item->getTimeCreated() ? $item->getTimeCreated() : $date ); |
|
314 | + $billingAddress = $item->getPaymentAddress(); |
|
315 | + |
|
316 | + $path = 'mshop/customer/manager/ezpublish/update'; |
|
317 | + $stmt = $this->getCachedStatement( $conn, $path ); |
|
318 | + |
|
319 | + $stmt->bind( 1, $item->getCode() ); // login normalized |
|
320 | + $stmt->bind( 2, $item->getCode() ); // login |
|
321 | + $stmt->bind( 3, $billingAddress->getCompany() ); |
|
322 | + $stmt->bind( 4, $billingAddress->getVatID() ); |
|
323 | + $stmt->bind( 5, $billingAddress->getSalutation() ); |
|
324 | + $stmt->bind( 6, $billingAddress->getTitle() ); |
|
325 | + $stmt->bind( 7, $billingAddress->getFirstname() ); |
|
326 | + $stmt->bind( 8, $billingAddress->getLastname() ); |
|
327 | + $stmt->bind( 9, $billingAddress->getAddress1() ); |
|
328 | + $stmt->bind( 10, $billingAddress->getAddress2() ); |
|
329 | + $stmt->bind( 11, $billingAddress->getAddress3() ); |
|
330 | + $stmt->bind( 12, $billingAddress->getPostal() ); |
|
331 | + $stmt->bind( 13, $billingAddress->getCity() ); |
|
332 | + $stmt->bind( 14, $billingAddress->getState() ); |
|
333 | + $stmt->bind( 15, $billingAddress->getCountryId() ); |
|
334 | + $stmt->bind( 16, $billingAddress->getLanguageId() ); |
|
335 | + $stmt->bind( 17, $billingAddress->getTelephone() ); |
|
336 | + $stmt->bind( 18, $billingAddress->getEmail() ); |
|
337 | + $stmt->bind( 19, $billingAddress->getTelefax() ); |
|
338 | + $stmt->bind( 20, $billingAddress->getWebsite() ); |
|
339 | + $stmt->bind( 21, $item->getBirthday() ); |
|
340 | + $stmt->bind( 22, $item->getStatus(), \Aimeos\MW\DB\Statement\Base::PARAM_INT ); |
|
341 | + $stmt->bind( 23, $item->getDateVerified() ); |
|
342 | + $stmt->bind( 24, $item->getPassword() ); |
|
343 | + $stmt->bind( 25, $date ); // Modification time |
|
344 | + $stmt->bind( 26, $context->getEditor() ); |
|
345 | + $stmt->bind( 27, $ctime ); // Creation time |
|
346 | + $stmt->bind( 28, $item->getId(), \Aimeos\MW\DB\Statement\Base::PARAM_INT ); |
|
347 | + |
|
348 | + $stmt->execute()->finish(); |
|
349 | + |
|
350 | + |
|
351 | + $path = 'mshop/customer/manager/ezpublish/update-status'; |
|
352 | + $stmt = $this->getCachedStatement( $conn, $path ); |
|
353 | + |
|
354 | + $stmt->bind( 1, $item->getStatus(), \Aimeos\MW\DB\Statement\Base::PARAM_INT ); |
|
355 | + $stmt->bind( 2, $item->getId(), \Aimeos\MW\DB\Statement\Base::PARAM_INT ); |
|
356 | + |
|
357 | + $stmt->execute()->finish(); |
|
358 | + |
|
359 | + |
|
360 | + $dbm->release( $conn, $dbname ); |
|
361 | + } |
|
362 | + catch( \Exception $e ) |
|
363 | + { |
|
364 | + $dbm->release( $conn, $dbname ); |
|
365 | + throw $e; |
|
366 | + } |
|
367 | + } |
|
368 | + |
|
369 | + |
|
370 | + /** |
|
371 | + * Returns the item objects matched by the given search criteria. |
|
372 | + * |
|
373 | + * @param \Aimeos\MW\Criteria\Iface $search Search criteria object |
|
374 | + * @param integer &$total Number of items that are available in total |
|
375 | + * @return array List of items implementing \Aimeos\MShop\Customer\Item\Iface |
|
376 | + * @throws \Aimeos\MShop\Customer\Exception If creating items failed |
|
377 | + */ |
|
378 | + public function searchItems( \Aimeos\MW\Criteria\Iface $search, array $ref = array(), &$total = null ) |
|
379 | + { |
|
380 | + $dbm = $this->getContext()->getDatabaseManager(); |
|
381 | + $dbname = $this->getResourceName(); |
|
382 | + $conn = $dbm->acquire( $dbname ); |
|
383 | + $map = array(); |
|
384 | + |
|
385 | + try |
|
386 | + { |
|
387 | + $level = \Aimeos\MShop\Locale\Manager\Base::SITE_ALL; |
|
388 | + $cfgPathSearch = 'mshop/customer/manager/ezpublish/search'; |
|
389 | + $cfgPathCount = 'mshop/customer/manager/ezpublish/count'; |
|
390 | + $required = array( 'customer' ); |
|
391 | + |
|
392 | + $results = $this->searchItemsBase( $conn, $search, $cfgPathSearch, $cfgPathCount, $required, $total, $level ); |
|
393 | + while( ( $row = $results->fetch() ) !== false ) { |
|
394 | + $map[ $row['customer.id'] ] = $row; |
|
395 | + } |
|
396 | + |
|
397 | + $dbm->release( $conn, $dbname ); |
|
398 | + } |
|
399 | + catch( \Exception $e ) |
|
400 | + { |
|
401 | + $dbm->release( $conn, $dbname ); |
|
402 | + throw $e; |
|
403 | + } |
|
404 | + |
|
405 | + return $this->buildItems( $map, $ref, 'customer' ); |
|
406 | + } |
|
407 | + |
|
408 | + |
|
409 | + /** |
|
410 | + * Returns a new manager for customer extensions |
|
411 | + * |
|
412 | + * @param string $manager Name of the sub manager type in lower case |
|
413 | + * @param string|null $name Name of the implementation, will be from configuration (or Default) if null |
|
414 | + * @return mixed Manager for different extensions, e.g stock, tags, locations, etc. |
|
415 | + */ |
|
416 | + public function getSubManager( $manager, $name = null ) |
|
417 | + { |
|
418 | + return $this->getSubManagerBase( 'customer', $manager, ( $name === null ? 'Ezpublish' : $name ) ); |
|
419 | + } |
|
420 | + |
|
421 | + |
|
422 | + /** |
|
423 | + * Creates a new customer item. |
|
424 | + * |
|
425 | + * @param array $values List of attributes for customer item |
|
426 | + * @param array $listItems List items associated to the customer item |
|
427 | + * @param array $refItems Items referenced by the customer item via the list items |
|
428 | + * @return \Aimeos\MShop\Customer\Item\Iface New customer item |
|
429 | + */ |
|
430 | + protected function createItemBase( array $values = array(), array $listItems = array(), array $refItems = array() ) |
|
431 | + { |
|
432 | + if( !isset( $this->addressManager ) ) { |
|
433 | + $this->addressManager = $this->getSubManager( 'address' ); |
|
434 | + } |
|
435 | + |
|
436 | + $helper = $this->getPasswordHelper(); |
|
437 | + $address = $this->addressManager->createItem(); |
|
438 | + |
|
439 | + return new \Aimeos\MShop\Customer\Item\Standard( $address, $values, $listItems, $refItems, null, $helper ); |
|
440 | + } |
|
441 | 441 | } |
@@ -228,11 +228,11 @@ discard block |
||
228 | 228 | * |
229 | 229 | * @param array $siteids List of IDs for sites whose entries should be deleted |
230 | 230 | */ |
231 | - public function cleanup( array $siteids ) |
|
231 | + public function cleanup(array $siteids) |
|
232 | 232 | { |
233 | 233 | $path = 'mshop/customer/manager/submanagers'; |
234 | - foreach( $this->getContext()->getConfig()->get( $path, array( 'address', 'lists' ) ) as $domain ) { |
|
235 | - $this->getSubManager( $domain )->cleanup( $siteids ); |
|
234 | + foreach ($this->getContext()->getConfig()->get($path, array('address', 'lists')) as $domain) { |
|
235 | + $this->getSubManager($domain)->cleanup($siteids); |
|
236 | 236 | } |
237 | 237 | } |
238 | 238 | |
@@ -242,10 +242,10 @@ discard block |
||
242 | 242 | * |
243 | 243 | * @param array $ids List of IDs |
244 | 244 | */ |
245 | - public function deleteItems( array $ids ) |
|
245 | + public function deleteItems(array $ids) |
|
246 | 246 | { |
247 | 247 | $path = 'mshop/customer/manager/ezpublish/delete'; |
248 | - $this->deleteItemsBase( $ids, $path, false, 'contentobject_id' ); |
|
248 | + $this->deleteItemsBase($ids, $path, false, 'contentobject_id'); |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | |
@@ -255,11 +255,11 @@ discard block |
||
255 | 255 | * @param boolean $withsub Return also attributes of sub-managers if true |
256 | 256 | * @return array List of attribute items implementing \Aimeos\MW\Criteria\Attribute\Iface |
257 | 257 | */ |
258 | - public function getSearchAttributes( $withsub = true ) |
|
258 | + public function getSearchAttributes($withsub = true) |
|
259 | 259 | { |
260 | 260 | $path = 'mshop/customer/manager/submanagers'; |
261 | 261 | |
262 | - return $this->getSearchAttributesBase( $this->searchConfig, $path, array( 'address', 'lists' ), $withsub ); |
|
262 | + return $this->getSearchAttributesBase($this->searchConfig, $path, array('address', 'lists'), $withsub); |
|
263 | 263 | } |
264 | 264 | |
265 | 265 | |
@@ -280,88 +280,88 @@ discard block |
||
280 | 280 | * @param \Aimeos\MShop\Customer\Item\Iface $item Customer item object |
281 | 281 | * @param boolean $fetch True if the new ID should be returned in the item |
282 | 282 | */ |
283 | - public function saveItem( \Aimeos\MShop\Common\Item\Iface $item, $fetch = true ) |
|
283 | + public function saveItem(\Aimeos\MShop\Common\Item\Iface $item, $fetch = true) |
|
284 | 284 | { |
285 | 285 | $iface = '\\Aimeos\\MShop\\Customer\\Item\\Iface'; |
286 | - if( !( $item instanceof $iface ) ) { |
|
287 | - throw new \Aimeos\MShop\Customer\Exception( sprintf( 'Object is not of required type "%1$s"', $iface ) ); |
|
286 | + if (!($item instanceof $iface)) { |
|
287 | + throw new \Aimeos\MShop\Customer\Exception(sprintf('Object is not of required type "%1$s"', $iface)); |
|
288 | 288 | } |
289 | 289 | |
290 | - if( !$item->isModified() ) { return; } |
|
290 | + if (!$item->isModified()) { return; } |
|
291 | 291 | |
292 | 292 | $context = $this->getContext(); |
293 | 293 | |
294 | 294 | $class = '\Aimeos\MShop\Context\Item\Ezpublish'; |
295 | - if( !is_a( $context, $class ) ) { |
|
296 | - throw new \Aimeos\MShop\Customer\Exception( sprintf( 'Object is not of required type "%1$s"', $class ) ); |
|
295 | + if (!is_a($context, $class)) { |
|
296 | + throw new \Aimeos\MShop\Customer\Exception(sprintf('Object is not of required type "%1$s"', $class)); |
|
297 | 297 | } |
298 | 298 | |
299 | - if( $item->getId() === null ) |
|
299 | + if ($item->getId() === null) |
|
300 | 300 | { |
301 | 301 | $fcn = $context->getEzUser(); |
302 | - $contentId = $fcn( $item->getCode(), $item->getPaymentAddress()->getEmail(), $item->getPassword() ); |
|
303 | - $item->setId( $contentId ); |
|
302 | + $contentId = $fcn($item->getCode(), $item->getPaymentAddress()->getEmail(), $item->getPassword()); |
|
303 | + $item->setId($contentId); |
|
304 | 304 | } |
305 | 305 | |
306 | 306 | $dbm = $context->getDatabaseManager(); |
307 | 307 | $dbname = $this->getResourceName(); |
308 | - $conn = $dbm->acquire( $dbname ); |
|
308 | + $conn = $dbm->acquire($dbname); |
|
309 | 309 | |
310 | 310 | try |
311 | 311 | { |
312 | - $date = date( 'Y-m-d H:i:s' ); |
|
313 | - $ctime = ( $item->getTimeCreated() ? $item->getTimeCreated() : $date ); |
|
312 | + $date = date('Y-m-d H:i:s'); |
|
313 | + $ctime = ($item->getTimeCreated() ? $item->getTimeCreated() : $date); |
|
314 | 314 | $billingAddress = $item->getPaymentAddress(); |
315 | 315 | |
316 | 316 | $path = 'mshop/customer/manager/ezpublish/update'; |
317 | - $stmt = $this->getCachedStatement( $conn, $path ); |
|
318 | - |
|
319 | - $stmt->bind( 1, $item->getCode() ); // login normalized |
|
320 | - $stmt->bind( 2, $item->getCode() ); // login |
|
321 | - $stmt->bind( 3, $billingAddress->getCompany() ); |
|
322 | - $stmt->bind( 4, $billingAddress->getVatID() ); |
|
323 | - $stmt->bind( 5, $billingAddress->getSalutation() ); |
|
324 | - $stmt->bind( 6, $billingAddress->getTitle() ); |
|
325 | - $stmt->bind( 7, $billingAddress->getFirstname() ); |
|
326 | - $stmt->bind( 8, $billingAddress->getLastname() ); |
|
327 | - $stmt->bind( 9, $billingAddress->getAddress1() ); |
|
328 | - $stmt->bind( 10, $billingAddress->getAddress2() ); |
|
329 | - $stmt->bind( 11, $billingAddress->getAddress3() ); |
|
330 | - $stmt->bind( 12, $billingAddress->getPostal() ); |
|
331 | - $stmt->bind( 13, $billingAddress->getCity() ); |
|
332 | - $stmt->bind( 14, $billingAddress->getState() ); |
|
333 | - $stmt->bind( 15, $billingAddress->getCountryId() ); |
|
334 | - $stmt->bind( 16, $billingAddress->getLanguageId() ); |
|
335 | - $stmt->bind( 17, $billingAddress->getTelephone() ); |
|
336 | - $stmt->bind( 18, $billingAddress->getEmail() ); |
|
337 | - $stmt->bind( 19, $billingAddress->getTelefax() ); |
|
338 | - $stmt->bind( 20, $billingAddress->getWebsite() ); |
|
339 | - $stmt->bind( 21, $item->getBirthday() ); |
|
340 | - $stmt->bind( 22, $item->getStatus(), \Aimeos\MW\DB\Statement\Base::PARAM_INT ); |
|
341 | - $stmt->bind( 23, $item->getDateVerified() ); |
|
342 | - $stmt->bind( 24, $item->getPassword() ); |
|
343 | - $stmt->bind( 25, $date ); // Modification time |
|
344 | - $stmt->bind( 26, $context->getEditor() ); |
|
345 | - $stmt->bind( 27, $ctime ); // Creation time |
|
346 | - $stmt->bind( 28, $item->getId(), \Aimeos\MW\DB\Statement\Base::PARAM_INT ); |
|
317 | + $stmt = $this->getCachedStatement($conn, $path); |
|
318 | + |
|
319 | + $stmt->bind(1, $item->getCode()); // login normalized |
|
320 | + $stmt->bind(2, $item->getCode()); // login |
|
321 | + $stmt->bind(3, $billingAddress->getCompany()); |
|
322 | + $stmt->bind(4, $billingAddress->getVatID()); |
|
323 | + $stmt->bind(5, $billingAddress->getSalutation()); |
|
324 | + $stmt->bind(6, $billingAddress->getTitle()); |
|
325 | + $stmt->bind(7, $billingAddress->getFirstname()); |
|
326 | + $stmt->bind(8, $billingAddress->getLastname()); |
|
327 | + $stmt->bind(9, $billingAddress->getAddress1()); |
|
328 | + $stmt->bind(10, $billingAddress->getAddress2()); |
|
329 | + $stmt->bind(11, $billingAddress->getAddress3()); |
|
330 | + $stmt->bind(12, $billingAddress->getPostal()); |
|
331 | + $stmt->bind(13, $billingAddress->getCity()); |
|
332 | + $stmt->bind(14, $billingAddress->getState()); |
|
333 | + $stmt->bind(15, $billingAddress->getCountryId()); |
|
334 | + $stmt->bind(16, $billingAddress->getLanguageId()); |
|
335 | + $stmt->bind(17, $billingAddress->getTelephone()); |
|
336 | + $stmt->bind(18, $billingAddress->getEmail()); |
|
337 | + $stmt->bind(19, $billingAddress->getTelefax()); |
|
338 | + $stmt->bind(20, $billingAddress->getWebsite()); |
|
339 | + $stmt->bind(21, $item->getBirthday()); |
|
340 | + $stmt->bind(22, $item->getStatus(), \Aimeos\MW\DB\Statement\Base::PARAM_INT); |
|
341 | + $stmt->bind(23, $item->getDateVerified()); |
|
342 | + $stmt->bind(24, $item->getPassword()); |
|
343 | + $stmt->bind(25, $date); // Modification time |
|
344 | + $stmt->bind(26, $context->getEditor()); |
|
345 | + $stmt->bind(27, $ctime); // Creation time |
|
346 | + $stmt->bind(28, $item->getId(), \Aimeos\MW\DB\Statement\Base::PARAM_INT); |
|
347 | 347 | |
348 | 348 | $stmt->execute()->finish(); |
349 | 349 | |
350 | 350 | |
351 | 351 | $path = 'mshop/customer/manager/ezpublish/update-status'; |
352 | - $stmt = $this->getCachedStatement( $conn, $path ); |
|
352 | + $stmt = $this->getCachedStatement($conn, $path); |
|
353 | 353 | |
354 | - $stmt->bind( 1, $item->getStatus(), \Aimeos\MW\DB\Statement\Base::PARAM_INT ); |
|
355 | - $stmt->bind( 2, $item->getId(), \Aimeos\MW\DB\Statement\Base::PARAM_INT ); |
|
354 | + $stmt->bind(1, $item->getStatus(), \Aimeos\MW\DB\Statement\Base::PARAM_INT); |
|
355 | + $stmt->bind(2, $item->getId(), \Aimeos\MW\DB\Statement\Base::PARAM_INT); |
|
356 | 356 | |
357 | 357 | $stmt->execute()->finish(); |
358 | 358 | |
359 | 359 | |
360 | - $dbm->release( $conn, $dbname ); |
|
360 | + $dbm->release($conn, $dbname); |
|
361 | 361 | } |
362 | - catch( \Exception $e ) |
|
362 | + catch (\Exception $e) |
|
363 | 363 | { |
364 | - $dbm->release( $conn, $dbname ); |
|
364 | + $dbm->release($conn, $dbname); |
|
365 | 365 | throw $e; |
366 | 366 | } |
367 | 367 | } |
@@ -375,11 +375,11 @@ discard block |
||
375 | 375 | * @return array List of items implementing \Aimeos\MShop\Customer\Item\Iface |
376 | 376 | * @throws \Aimeos\MShop\Customer\Exception If creating items failed |
377 | 377 | */ |
378 | - public function searchItems( \Aimeos\MW\Criteria\Iface $search, array $ref = array(), &$total = null ) |
|
378 | + public function searchItems(\Aimeos\MW\Criteria\Iface $search, array $ref = array(), &$total = null) |
|
379 | 379 | { |
380 | 380 | $dbm = $this->getContext()->getDatabaseManager(); |
381 | 381 | $dbname = $this->getResourceName(); |
382 | - $conn = $dbm->acquire( $dbname ); |
|
382 | + $conn = $dbm->acquire($dbname); |
|
383 | 383 | $map = array(); |
384 | 384 | |
385 | 385 | try |
@@ -387,22 +387,22 @@ discard block |
||
387 | 387 | $level = \Aimeos\MShop\Locale\Manager\Base::SITE_ALL; |
388 | 388 | $cfgPathSearch = 'mshop/customer/manager/ezpublish/search'; |
389 | 389 | $cfgPathCount = 'mshop/customer/manager/ezpublish/count'; |
390 | - $required = array( 'customer' ); |
|
390 | + $required = array('customer'); |
|
391 | 391 | |
392 | - $results = $this->searchItemsBase( $conn, $search, $cfgPathSearch, $cfgPathCount, $required, $total, $level ); |
|
393 | - while( ( $row = $results->fetch() ) !== false ) { |
|
394 | - $map[ $row['customer.id'] ] = $row; |
|
392 | + $results = $this->searchItemsBase($conn, $search, $cfgPathSearch, $cfgPathCount, $required, $total, $level); |
|
393 | + while (($row = $results->fetch()) !== false) { |
|
394 | + $map[$row['customer.id']] = $row; |
|
395 | 395 | } |
396 | 396 | |
397 | - $dbm->release( $conn, $dbname ); |
|
397 | + $dbm->release($conn, $dbname); |
|
398 | 398 | } |
399 | - catch( \Exception $e ) |
|
399 | + catch (\Exception $e) |
|
400 | 400 | { |
401 | - $dbm->release( $conn, $dbname ); |
|
401 | + $dbm->release($conn, $dbname); |
|
402 | 402 | throw $e; |
403 | 403 | } |
404 | 404 | |
405 | - return $this->buildItems( $map, $ref, 'customer' ); |
|
405 | + return $this->buildItems($map, $ref, 'customer'); |
|
406 | 406 | } |
407 | 407 | |
408 | 408 | |
@@ -413,9 +413,9 @@ discard block |
||
413 | 413 | * @param string|null $name Name of the implementation, will be from configuration (or Default) if null |
414 | 414 | * @return mixed Manager for different extensions, e.g stock, tags, locations, etc. |
415 | 415 | */ |
416 | - public function getSubManager( $manager, $name = null ) |
|
416 | + public function getSubManager($manager, $name = null) |
|
417 | 417 | { |
418 | - return $this->getSubManagerBase( 'customer', $manager, ( $name === null ? 'Ezpublish' : $name ) ); |
|
418 | + return $this->getSubManagerBase('customer', $manager, ($name === null ? 'Ezpublish' : $name)); |
|
419 | 419 | } |
420 | 420 | |
421 | 421 | |
@@ -427,15 +427,15 @@ discard block |
||
427 | 427 | * @param array $refItems Items referenced by the customer item via the list items |
428 | 428 | * @return \Aimeos\MShop\Customer\Item\Iface New customer item |
429 | 429 | */ |
430 | - protected function createItemBase( array $values = array(), array $listItems = array(), array $refItems = array() ) |
|
430 | + protected function createItemBase(array $values = array(), array $listItems = array(), array $refItems = array()) |
|
431 | 431 | { |
432 | - if( !isset( $this->addressManager ) ) { |
|
433 | - $this->addressManager = $this->getSubManager( 'address' ); |
|
432 | + if (!isset($this->addressManager)) { |
|
433 | + $this->addressManager = $this->getSubManager('address'); |
|
434 | 434 | } |
435 | 435 | |
436 | 436 | $helper = $this->getPasswordHelper(); |
437 | 437 | $address = $this->addressManager->createItem(); |
438 | 438 | |
439 | - return new \Aimeos\MShop\Customer\Item\Standard( $address, $values, $listItems, $refItems, null, $helper ); |
|
439 | + return new \Aimeos\MShop\Customer\Item\Standard($address, $values, $listItems, $refItems, null, $helper); |
|
440 | 440 | } |
441 | 441 | } |
@@ -14,128 +14,128 @@ |
||
14 | 14 | */ |
15 | 15 | class CustomerAddEzpublishTestData extends \Aimeos\MW\Setup\Task\CustomerAddTestData |
16 | 16 | { |
17 | - /** |
|
18 | - * Returns the list of task names which this task depends on. |
|
19 | - * |
|
20 | - * @return string[] List of task names |
|
21 | - */ |
|
22 | - public function getPreDependencies() |
|
23 | - { |
|
24 | - return array( 'TablesCreateEzpublish', 'EzuserAddAddress', 'MShopSetLocale', 'MediaAddTestData' ); |
|
25 | - } |
|
26 | - |
|
27 | - |
|
28 | - /** |
|
29 | - * Adds attribute test data. |
|
30 | - */ |
|
31 | - public function migrate() |
|
32 | - { |
|
33 | - $iface = '\\Aimeos\\MShop\\Context\\Item\\Iface'; |
|
34 | - if( !( $this->additional instanceof $iface ) ) { |
|
35 | - throw new \Aimeos\MW\Setup\Exception( sprintf( 'Additionally provided object is not of type "%1$s"', $iface ) ); |
|
36 | - } |
|
37 | - |
|
38 | - $context = $this->getEzContext( $this->additional ); |
|
39 | - |
|
40 | - $this->msg( 'Adding ezPublish customer test data', 0 ); |
|
41 | - |
|
42 | - $parentIds = array(); |
|
43 | - $ds = DIRECTORY_SEPARATOR; |
|
44 | - $context->setEditor( 'ai-ezpublish:unittest' ); |
|
45 | - $path = __DIR__ . $ds . 'data' . $ds . 'customer.php'; |
|
46 | - |
|
47 | - if( ( $testdata = include( $path ) ) === false ){ |
|
48 | - throw new \Aimeos\MShop\Exception( sprintf( 'No file "%1$s" found for customer domain', $path ) ); |
|
49 | - } |
|
50 | - |
|
51 | - |
|
52 | - $customerManager = \Aimeos\MShop\Customer\Manager\Factory::createManager( $context, 'Ezpublish' ); |
|
53 | - $customerAddressManager = $customerManager->getSubManager( 'address', 'Ezpublish' ); |
|
54 | - |
|
55 | - $search = $customerManager->createSearch(); |
|
56 | - $search->setConditions( $search->compare( '==', 'customer.code', array( 'UTC001', 'UTC002', 'UTC003' ) ) ); |
|
57 | - $items = $customerManager->searchItems( $search ); |
|
58 | - |
|
59 | - $this->conn->begin(); |
|
60 | - |
|
61 | - $customerManager->deleteItems( array_keys( $items ) ); |
|
62 | - $parentIds = $this->addCustomerData( $testdata, $customerManager, $customerAddressManager->createItem() ); |
|
63 | - $this->addCustomerAddressData( $testdata, $customerAddressManager, $parentIds ); |
|
64 | - |
|
65 | - $this->conn->commit(); |
|
66 | - |
|
67 | - |
|
68 | - $this->status( 'done' ); |
|
69 | - } |
|
70 | - |
|
71 | - |
|
72 | - /** |
|
73 | - * Returns the Ezpublish context |
|
74 | - * |
|
75 | - * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
|
76 | - * @return \Aimeos\MShop\Context\Item\Ezpublish Ezpublish context object |
|
77 | - */ |
|
78 | - protected function getEzContext( \Aimeos\MShop\Context\Item\Iface $context ) |
|
79 | - { |
|
80 | - $class = '\Aimeos\MShop\Context\Item\Ezpublish'; |
|
81 | - if( is_a( $context, $class ) ) { |
|
82 | - return $context; |
|
83 | - } |
|
84 | - |
|
85 | - $ezContext = new \Aimeos\MShop\Context\Item\Ezpublish(); |
|
86 | - $ezContext->setDatabaseManager( clone $context->getDatabaseManager() ); |
|
87 | - $ezContext->setSession( clone $context->getSession() ); |
|
88 | - $ezContext->setLogger( clone $context->getLogger() ); |
|
89 | - $ezContext->setLocale( clone $context->getLocale() ); |
|
90 | - $ezContext->setConfig( clone $context->getConfig() ); |
|
91 | - $ezContext->setCache( clone $context->getCache() ); |
|
92 | - |
|
93 | - |
|
94 | - $ezContext->setEzUser( function( $code, $email, $password ) use ( $context ) { |
|
95 | - |
|
96 | - $id = mt_rand( -0x7fffffff,-1 ); |
|
97 | - $dbm = $context->getDatabaseManager(); |
|
98 | - $dbconf = $context->getConfig()->get( 'resource/db-customer' ); |
|
99 | - $dbname = ( $dbconf ? 'db-customer' : 'db' ); |
|
100 | - $conn = $dbm->acquire( $dbname ); |
|
101 | - |
|
102 | - try |
|
103 | - { |
|
104 | - $stmt = $conn->create( 'INSERT INTO "ezuser" ( |
|
17 | + /** |
|
18 | + * Returns the list of task names which this task depends on. |
|
19 | + * |
|
20 | + * @return string[] List of task names |
|
21 | + */ |
|
22 | + public function getPreDependencies() |
|
23 | + { |
|
24 | + return array( 'TablesCreateEzpublish', 'EzuserAddAddress', 'MShopSetLocale', 'MediaAddTestData' ); |
|
25 | + } |
|
26 | + |
|
27 | + |
|
28 | + /** |
|
29 | + * Adds attribute test data. |
|
30 | + */ |
|
31 | + public function migrate() |
|
32 | + { |
|
33 | + $iface = '\\Aimeos\\MShop\\Context\\Item\\Iface'; |
|
34 | + if( !( $this->additional instanceof $iface ) ) { |
|
35 | + throw new \Aimeos\MW\Setup\Exception( sprintf( 'Additionally provided object is not of type "%1$s"', $iface ) ); |
|
36 | + } |
|
37 | + |
|
38 | + $context = $this->getEzContext( $this->additional ); |
|
39 | + |
|
40 | + $this->msg( 'Adding ezPublish customer test data', 0 ); |
|
41 | + |
|
42 | + $parentIds = array(); |
|
43 | + $ds = DIRECTORY_SEPARATOR; |
|
44 | + $context->setEditor( 'ai-ezpublish:unittest' ); |
|
45 | + $path = __DIR__ . $ds . 'data' . $ds . 'customer.php'; |
|
46 | + |
|
47 | + if( ( $testdata = include( $path ) ) === false ){ |
|
48 | + throw new \Aimeos\MShop\Exception( sprintf( 'No file "%1$s" found for customer domain', $path ) ); |
|
49 | + } |
|
50 | + |
|
51 | + |
|
52 | + $customerManager = \Aimeos\MShop\Customer\Manager\Factory::createManager( $context, 'Ezpublish' ); |
|
53 | + $customerAddressManager = $customerManager->getSubManager( 'address', 'Ezpublish' ); |
|
54 | + |
|
55 | + $search = $customerManager->createSearch(); |
|
56 | + $search->setConditions( $search->compare( '==', 'customer.code', array( 'UTC001', 'UTC002', 'UTC003' ) ) ); |
|
57 | + $items = $customerManager->searchItems( $search ); |
|
58 | + |
|
59 | + $this->conn->begin(); |
|
60 | + |
|
61 | + $customerManager->deleteItems( array_keys( $items ) ); |
|
62 | + $parentIds = $this->addCustomerData( $testdata, $customerManager, $customerAddressManager->createItem() ); |
|
63 | + $this->addCustomerAddressData( $testdata, $customerAddressManager, $parentIds ); |
|
64 | + |
|
65 | + $this->conn->commit(); |
|
66 | + |
|
67 | + |
|
68 | + $this->status( 'done' ); |
|
69 | + } |
|
70 | + |
|
71 | + |
|
72 | + /** |
|
73 | + * Returns the Ezpublish context |
|
74 | + * |
|
75 | + * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
|
76 | + * @return \Aimeos\MShop\Context\Item\Ezpublish Ezpublish context object |
|
77 | + */ |
|
78 | + protected function getEzContext( \Aimeos\MShop\Context\Item\Iface $context ) |
|
79 | + { |
|
80 | + $class = '\Aimeos\MShop\Context\Item\Ezpublish'; |
|
81 | + if( is_a( $context, $class ) ) { |
|
82 | + return $context; |
|
83 | + } |
|
84 | + |
|
85 | + $ezContext = new \Aimeos\MShop\Context\Item\Ezpublish(); |
|
86 | + $ezContext->setDatabaseManager( clone $context->getDatabaseManager() ); |
|
87 | + $ezContext->setSession( clone $context->getSession() ); |
|
88 | + $ezContext->setLogger( clone $context->getLogger() ); |
|
89 | + $ezContext->setLocale( clone $context->getLocale() ); |
|
90 | + $ezContext->setConfig( clone $context->getConfig() ); |
|
91 | + $ezContext->setCache( clone $context->getCache() ); |
|
92 | + |
|
93 | + |
|
94 | + $ezContext->setEzUser( function( $code, $email, $password ) use ( $context ) { |
|
95 | + |
|
96 | + $id = mt_rand( -0x7fffffff,-1 ); |
|
97 | + $dbm = $context->getDatabaseManager(); |
|
98 | + $dbconf = $context->getConfig()->get( 'resource/db-customer' ); |
|
99 | + $dbname = ( $dbconf ? 'db-customer' : 'db' ); |
|
100 | + $conn = $dbm->acquire( $dbname ); |
|
101 | + |
|
102 | + try |
|
103 | + { |
|
104 | + $stmt = $conn->create( 'INSERT INTO "ezuser" ( |
|
105 | 105 | "contentobject_id", "email", "login", "login_normalized", "password_hash", "password_hash_type" |
106 | 106 | ) VALUES ( |
107 | 107 | ?, ?, ?, ?, ?, 5 |
108 | 108 | )' ); |
109 | 109 | |
110 | - $stmt->bind( 1, $id, \Aimeos\MW\DB\Statement\Base::PARAM_INT ); |
|
111 | - $stmt->bind( 2, $email ); |
|
112 | - $stmt->bind( 3, $code ); |
|
113 | - $stmt->bind( 4, $code ); |
|
114 | - $stmt->bind( 5, $password ); |
|
110 | + $stmt->bind( 1, $id, \Aimeos\MW\DB\Statement\Base::PARAM_INT ); |
|
111 | + $stmt->bind( 2, $email ); |
|
112 | + $stmt->bind( 3, $code ); |
|
113 | + $stmt->bind( 4, $code ); |
|
114 | + $stmt->bind( 5, $password ); |
|
115 | 115 | |
116 | - $stmt->execute()->finish(); |
|
116 | + $stmt->execute()->finish(); |
|
117 | 117 | |
118 | - $sql = 'INSERT INTO "ezuser_setting" ( "user_id", "is_enabled", "max_login" ) VALUES ( ?, ?, ? )'; |
|
119 | - $stmt = $conn->create( $sql ); |
|
118 | + $sql = 'INSERT INTO "ezuser_setting" ( "user_id", "is_enabled", "max_login" ) VALUES ( ?, ?, ? )'; |
|
119 | + $stmt = $conn->create( $sql ); |
|
120 | 120 | |
121 | - $stmt->bind( 1, $id, \Aimeos\MW\DB\Statement\Base::PARAM_INT ); |
|
122 | - $stmt->bind( 2, 0 ); |
|
123 | - $stmt->bind( 3, 10 ); |
|
121 | + $stmt->bind( 1, $id, \Aimeos\MW\DB\Statement\Base::PARAM_INT ); |
|
122 | + $stmt->bind( 2, 0 ); |
|
123 | + $stmt->bind( 3, 10 ); |
|
124 | 124 | |
125 | - $stmt->execute()->finish(); |
|
125 | + $stmt->execute()->finish(); |
|
126 | 126 | |
127 | - $dbm->release( $conn, $dbname ); |
|
128 | - } |
|
129 | - catch( \Exception $e ) |
|
130 | - { |
|
131 | - $dbm->release( $conn, $dbname ); |
|
132 | - throw $e; |
|
133 | - } |
|
127 | + $dbm->release( $conn, $dbname ); |
|
128 | + } |
|
129 | + catch( \Exception $e ) |
|
130 | + { |
|
131 | + $dbm->release( $conn, $dbname ); |
|
132 | + throw $e; |
|
133 | + } |
|
134 | 134 | |
135 | - return $id; |
|
136 | - } ); |
|
135 | + return $id; |
|
136 | + } ); |
|
137 | 137 | |
138 | 138 | |
139 | - return $ezContext; |
|
140 | - } |
|
139 | + return $ezContext; |
|
140 | + } |
|
141 | 141 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public function getPreDependencies() |
23 | 23 | { |
24 | - return array( 'TablesCreateEzpublish', 'EzuserAddAddress', 'MShopSetLocale', 'MediaAddTestData' ); |
|
24 | + return array('TablesCreateEzpublish', 'EzuserAddAddress', 'MShopSetLocale', 'MediaAddTestData'); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | |
@@ -31,41 +31,41 @@ discard block |
||
31 | 31 | public function migrate() |
32 | 32 | { |
33 | 33 | $iface = '\\Aimeos\\MShop\\Context\\Item\\Iface'; |
34 | - if( !( $this->additional instanceof $iface ) ) { |
|
35 | - throw new \Aimeos\MW\Setup\Exception( sprintf( 'Additionally provided object is not of type "%1$s"', $iface ) ); |
|
34 | + if (!($this->additional instanceof $iface)) { |
|
35 | + throw new \Aimeos\MW\Setup\Exception(sprintf('Additionally provided object is not of type "%1$s"', $iface)); |
|
36 | 36 | } |
37 | 37 | |
38 | - $context = $this->getEzContext( $this->additional ); |
|
38 | + $context = $this->getEzContext($this->additional); |
|
39 | 39 | |
40 | - $this->msg( 'Adding ezPublish customer test data', 0 ); |
|
40 | + $this->msg('Adding ezPublish customer test data', 0); |
|
41 | 41 | |
42 | 42 | $parentIds = array(); |
43 | 43 | $ds = DIRECTORY_SEPARATOR; |
44 | - $context->setEditor( 'ai-ezpublish:unittest' ); |
|
45 | - $path = __DIR__ . $ds . 'data' . $ds . 'customer.php'; |
|
44 | + $context->setEditor('ai-ezpublish:unittest'); |
|
45 | + $path = __DIR__.$ds.'data'.$ds.'customer.php'; |
|
46 | 46 | |
47 | - if( ( $testdata = include( $path ) ) === false ){ |
|
48 | - throw new \Aimeos\MShop\Exception( sprintf( 'No file "%1$s" found for customer domain', $path ) ); |
|
47 | + if (($testdata = include($path)) === false) { |
|
48 | + throw new \Aimeos\MShop\Exception(sprintf('No file "%1$s" found for customer domain', $path)); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | |
52 | - $customerManager = \Aimeos\MShop\Customer\Manager\Factory::createManager( $context, 'Ezpublish' ); |
|
53 | - $customerAddressManager = $customerManager->getSubManager( 'address', 'Ezpublish' ); |
|
52 | + $customerManager = \Aimeos\MShop\Customer\Manager\Factory::createManager($context, 'Ezpublish'); |
|
53 | + $customerAddressManager = $customerManager->getSubManager('address', 'Ezpublish'); |
|
54 | 54 | |
55 | 55 | $search = $customerManager->createSearch(); |
56 | - $search->setConditions( $search->compare( '==', 'customer.code', array( 'UTC001', 'UTC002', 'UTC003' ) ) ); |
|
57 | - $items = $customerManager->searchItems( $search ); |
|
56 | + $search->setConditions($search->compare('==', 'customer.code', array('UTC001', 'UTC002', 'UTC003'))); |
|
57 | + $items = $customerManager->searchItems($search); |
|
58 | 58 | |
59 | 59 | $this->conn->begin(); |
60 | 60 | |
61 | - $customerManager->deleteItems( array_keys( $items ) ); |
|
62 | - $parentIds = $this->addCustomerData( $testdata, $customerManager, $customerAddressManager->createItem() ); |
|
63 | - $this->addCustomerAddressData( $testdata, $customerAddressManager, $parentIds ); |
|
61 | + $customerManager->deleteItems(array_keys($items)); |
|
62 | + $parentIds = $this->addCustomerData($testdata, $customerManager, $customerAddressManager->createItem()); |
|
63 | + $this->addCustomerAddressData($testdata, $customerAddressManager, $parentIds); |
|
64 | 64 | |
65 | 65 | $this->conn->commit(); |
66 | 66 | |
67 | 67 | |
68 | - $this->status( 'done' ); |
|
68 | + $this->status('done'); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | |
@@ -75,60 +75,60 @@ discard block |
||
75 | 75 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
76 | 76 | * @return \Aimeos\MShop\Context\Item\Ezpublish Ezpublish context object |
77 | 77 | */ |
78 | - protected function getEzContext( \Aimeos\MShop\Context\Item\Iface $context ) |
|
78 | + protected function getEzContext(\Aimeos\MShop\Context\Item\Iface $context) |
|
79 | 79 | { |
80 | 80 | $class = '\Aimeos\MShop\Context\Item\Ezpublish'; |
81 | - if( is_a( $context, $class ) ) { |
|
81 | + if (is_a($context, $class)) { |
|
82 | 82 | return $context; |
83 | 83 | } |
84 | 84 | |
85 | 85 | $ezContext = new \Aimeos\MShop\Context\Item\Ezpublish(); |
86 | - $ezContext->setDatabaseManager( clone $context->getDatabaseManager() ); |
|
87 | - $ezContext->setSession( clone $context->getSession() ); |
|
88 | - $ezContext->setLogger( clone $context->getLogger() ); |
|
89 | - $ezContext->setLocale( clone $context->getLocale() ); |
|
90 | - $ezContext->setConfig( clone $context->getConfig() ); |
|
91 | - $ezContext->setCache( clone $context->getCache() ); |
|
86 | + $ezContext->setDatabaseManager(clone $context->getDatabaseManager()); |
|
87 | + $ezContext->setSession(clone $context->getSession()); |
|
88 | + $ezContext->setLogger(clone $context->getLogger()); |
|
89 | + $ezContext->setLocale(clone $context->getLocale()); |
|
90 | + $ezContext->setConfig(clone $context->getConfig()); |
|
91 | + $ezContext->setCache(clone $context->getCache()); |
|
92 | 92 | |
93 | 93 | |
94 | - $ezContext->setEzUser( function( $code, $email, $password ) use ( $context ) { |
|
94 | + $ezContext->setEzUser(function($code, $email, $password) use ($context) { |
|
95 | 95 | |
96 | - $id = mt_rand( -0x7fffffff,-1 ); |
|
96 | + $id = mt_rand( -0x7fffffff, -1 ); |
|
97 | 97 | $dbm = $context->getDatabaseManager(); |
98 | - $dbconf = $context->getConfig()->get( 'resource/db-customer' ); |
|
99 | - $dbname = ( $dbconf ? 'db-customer' : 'db' ); |
|
100 | - $conn = $dbm->acquire( $dbname ); |
|
98 | + $dbconf = $context->getConfig()->get('resource/db-customer'); |
|
99 | + $dbname = ($dbconf ? 'db-customer' : 'db'); |
|
100 | + $conn = $dbm->acquire($dbname); |
|
101 | 101 | |
102 | 102 | try |
103 | 103 | { |
104 | - $stmt = $conn->create( 'INSERT INTO "ezuser" ( |
|
104 | + $stmt = $conn->create('INSERT INTO "ezuser" ( |
|
105 | 105 | "contentobject_id", "email", "login", "login_normalized", "password_hash", "password_hash_type" |
106 | 106 | ) VALUES ( |
107 | 107 | ?, ?, ?, ?, ?, 5 |
108 | 108 | )' ); |
109 | 109 | |
110 | - $stmt->bind( 1, $id, \Aimeos\MW\DB\Statement\Base::PARAM_INT ); |
|
111 | - $stmt->bind( 2, $email ); |
|
112 | - $stmt->bind( 3, $code ); |
|
113 | - $stmt->bind( 4, $code ); |
|
114 | - $stmt->bind( 5, $password ); |
|
110 | + $stmt->bind(1, $id, \Aimeos\MW\DB\Statement\Base::PARAM_INT); |
|
111 | + $stmt->bind(2, $email); |
|
112 | + $stmt->bind(3, $code); |
|
113 | + $stmt->bind(4, $code); |
|
114 | + $stmt->bind(5, $password); |
|
115 | 115 | |
116 | 116 | $stmt->execute()->finish(); |
117 | 117 | |
118 | 118 | $sql = 'INSERT INTO "ezuser_setting" ( "user_id", "is_enabled", "max_login" ) VALUES ( ?, ?, ? )'; |
119 | - $stmt = $conn->create( $sql ); |
|
119 | + $stmt = $conn->create($sql); |
|
120 | 120 | |
121 | - $stmt->bind( 1, $id, \Aimeos\MW\DB\Statement\Base::PARAM_INT ); |
|
122 | - $stmt->bind( 2, 0 ); |
|
123 | - $stmt->bind( 3, 10 ); |
|
121 | + $stmt->bind(1, $id, \Aimeos\MW\DB\Statement\Base::PARAM_INT); |
|
122 | + $stmt->bind(2, 0); |
|
123 | + $stmt->bind(3, 10); |
|
124 | 124 | |
125 | 125 | $stmt->execute()->finish(); |
126 | 126 | |
127 | - $dbm->release( $conn, $dbname ); |
|
127 | + $dbm->release($conn, $dbname); |
|
128 | 128 | } |
129 | - catch( \Exception $e ) |
|
129 | + catch (\Exception $e) |
|
130 | 130 | { |
131 | - $dbm->release( $conn, $dbname ); |
|
131 | + $dbm->release($conn, $dbname); |
|
132 | 132 | throw $e; |
133 | 133 | } |
134 | 134 |
@@ -7,138 +7,138 @@ |
||
7 | 7 | |
8 | 8 | |
9 | 9 | return array( |
10 | - 'table' => array( |
|
11 | - 'ezuser' => function ( \Doctrine\DBAL\Schema\Schema $schema ) { |
|
12 | - |
|
13 | - $table = $schema->createTable( 'ezuser' ); |
|
14 | - |
|
15 | - $table->addColumn( 'contentobject_id', 'integer', array() ); |
|
16 | - $table->addColumn( 'email', 'string', array( 'length' => 150 ) ); |
|
17 | - $table->addColumn( 'login', 'string', array( 'length' => 150 ) ); |
|
18 | - $table->addColumn( 'login_normalized', 'string', array( 'length' => 150 ) ); |
|
19 | - $table->addColumn( 'password_hash', 'string', array( 'length' => 50 ) ); |
|
20 | - $table->addColumn( 'password_hash_type', 'integer', array( 'default' => 1 ) ); |
|
21 | - |
|
22 | - $table->setPrimaryKey( array( 'contentobject_id' ) ); |
|
23 | - $table->addUniqueIndex( array( 'login_normalized' ), 'ezuser_login' ); |
|
24 | - |
|
25 | - return $schema; |
|
26 | - }, |
|
27 | - |
|
28 | - 'ezuser_setting' => function ( \Doctrine\DBAL\Schema\Schema $schema ) { |
|
29 | - |
|
30 | - $table = $schema->createTable( 'ezuser_setting' ); |
|
31 | - |
|
32 | - $table->addColumn( 'is_enabled', 'integer', array() ); |
|
33 | - $table->addColumn( 'max_login', 'integer', array( 'notnull' => false ) ); |
|
34 | - $table->addColumn( 'user_id', 'integer', array() ); |
|
35 | - |
|
36 | - $table->setPrimaryKey( array( 'user_id' ) ); |
|
37 | - |
|
38 | - return $schema; |
|
39 | - }, |
|
40 | - |
|
41 | - 'ezuser_address' => function ( \Doctrine\DBAL\Schema\Schema $schema ) { |
|
42 | - |
|
43 | - $table = $schema->createTable( 'ezuser_address' ); |
|
44 | - |
|
45 | - $table->addColumn( 'id', 'integer', array( 'autoincrement' => true ) ); |
|
46 | - $table->addColumn( 'siteid', 'integer', array() ); |
|
47 | - $table->addColumn( 'parentid', 'integer', array() ); |
|
48 | - $table->addColumn( 'company', 'string', array( 'length' => 100 ) ); |
|
49 | - $table->addColumn( 'vatid', 'string', array( 'length' => 32 ) ); |
|
50 | - $table->addColumn( 'salutation', 'string', array( 'length' => 8 ) ); |
|
51 | - $table->addColumn( 'title', 'string', array( 'length' => 64 ) ); |
|
52 | - $table->addColumn( 'firstname', 'string', array( 'length' => 64 ) ); |
|
53 | - $table->addColumn( 'lastname', 'string', array( 'length' => 64 ) ); |
|
54 | - $table->addColumn( 'address1', 'string', array( 'length' => 255 ) ); |
|
55 | - $table->addColumn( 'address2', 'string', array( 'length' => 255 ) ); |
|
56 | - $table->addColumn( 'address3', 'string', array( 'length' => 255 ) ); |
|
57 | - $table->addColumn( 'postal', 'string', array( 'length' => 16 ) ); |
|
58 | - $table->addColumn( 'city', 'string', array( 'length' => 255 ) ); |
|
59 | - $table->addColumn( 'state', 'string', array( 'length' => 255 ) ); |
|
60 | - $table->addColumn( 'langid', 'string', array( 'length' => 5, 'notnull' => false ) ); |
|
61 | - $table->addColumn( 'countryid', 'string', array( 'length' => 2, 'notnull' => false, 'fixed' => true ) ); |
|
62 | - $table->addColumn( 'telephone', 'string', array( 'length' => 32 ) ); |
|
63 | - $table->addColumn( 'email', 'string', array( 'length' => 255 ) ); |
|
64 | - $table->addColumn( 'telefax', 'string', array( 'length' => 255 ) ); |
|
65 | - $table->addColumn( 'website', 'string', array( 'length' => 255 ) ); |
|
66 | - $table->addColumn( 'flag', 'integer', array() ); |
|
67 | - $table->addColumn( 'pos', 'smallint', array() ); |
|
68 | - $table->addColumn( 'mtime', 'datetime', array() ); |
|
69 | - $table->addColumn( 'ctime', 'datetime', array() ); |
|
70 | - $table->addColumn( 'editor', 'string', array('length' => 255 ) ); |
|
71 | - |
|
72 | - $table->setPrimaryKey( array( 'id' ), 'pk_ezpad_id' ); |
|
73 | - $table->addIndex( array( 'lastname', 'firstname' ), 'idx_ezpad_ln_fn' ); |
|
74 | - $table->addIndex( array( 'address1', 'address2' ), 'idx_ezpad_ad1_ad2' ); |
|
75 | - $table->addIndex( array( 'postal', 'city' ), 'idx_ezpad_post_ci' ); |
|
76 | - $table->addIndex( array( 'parentid' ), 'idx_ezpad_pid' ); |
|
77 | - $table->addIndex( array( 'city' ), 'idx_ezpad_city' ); |
|
78 | - |
|
79 | - $table->addForeignKeyConstraint( 'ezuser', array( 'parentid' ), array( 'contentobject_id' ), |
|
80 | - array( 'onUpdate' => 'CASCADE', 'onDelete' => 'CASCADE' ), 'fk_ezpad_pid' ); |
|
81 | - |
|
82 | - return $schema; |
|
83 | - }, |
|
84 | - |
|
85 | - 'ezuser_list_type' => function ( \Doctrine\DBAL\Schema\Schema $schema ) { |
|
86 | - |
|
87 | - $table = $schema->createTable( 'ezuser_list_type' ); |
|
88 | - |
|
89 | - $table->addColumn( 'id', 'integer', array( 'autoincrement' => true ) ); |
|
90 | - $table->addColumn( 'siteid', 'integer', array() ); |
|
91 | - $table->addColumn( 'domain', 'string', array( 'length' => 32 ) ); |
|
92 | - $table->addColumn( 'code', 'string', array( 'length' => 32 ) ); |
|
93 | - $table->addColumn( 'label', 'string', array( 'length' => 255 ) ); |
|
94 | - $table->addColumn( 'status', 'smallint', array() ); |
|
95 | - $table->addColumn( 'mtime', 'datetime', array() ); |
|
96 | - $table->addColumn( 'ctime', 'datetime', array() ); |
|
97 | - $table->addColumn( 'editor', 'string', array( 'length' => 255 ) ); |
|
98 | - |
|
99 | - $table->setPrimaryKey( array( 'id' ), 'pk_ezplity_id' ); |
|
100 | - $table->addUniqueIndex( array( 'siteid', 'domain', 'code' ), 'unq_ezplity_sid_dom_code' ); |
|
101 | - $table->addIndex( array( 'siteid', 'status' ), 'idx_ezplity_sid_status' ); |
|
102 | - $table->addIndex( array( 'siteid', 'label' ), 'idx_ezplity_sid_label' ); |
|
103 | - $table->addIndex( array( 'siteid', 'code' ), 'idx_ezplity_sid_code' ); |
|
104 | - |
|
105 | - return $schema; |
|
106 | - }, |
|
107 | - |
|
108 | - 'ezuser_list' => function ( \Doctrine\DBAL\Schema\Schema $schema ) { |
|
109 | - |
|
110 | - $table = $schema->createTable( 'ezuser_list' ); |
|
111 | - |
|
112 | - $table->addColumn( 'id', 'integer', array( 'autoincrement' => true ) ); |
|
113 | - $table->addColumn( 'parentid', 'integer', array() ); |
|
114 | - $table->addColumn( 'siteid', 'integer', array() ); |
|
115 | - $table->addColumn( 'typeid', 'integer', array() ); |
|
116 | - $table->addColumn( 'domain', 'string', array( 'length' => 32 ) ); |
|
117 | - $table->addColumn( 'refid', 'string', array( 'length' => 32 ) ); |
|
118 | - $table->addColumn( 'start', 'datetime', array( 'notnull' => false ) ); |
|
119 | - $table->addColumn( 'end', 'datetime', array( 'notnull' => false ) ); |
|
120 | - $table->addColumn( 'config', 'text', array( 'length' => 0xffff ) ); |
|
121 | - $table->addColumn( 'pos', 'integer', array() ); |
|
122 | - $table->addColumn( 'status', 'smallint', array() ); |
|
123 | - $table->addColumn( 'mtime', 'datetime', array() ); |
|
124 | - $table->addColumn( 'ctime', 'datetime', array() ); |
|
125 | - $table->addColumn( 'editor', 'string', array( 'length' => 255 ) ); |
|
126 | - |
|
127 | - $table->setPrimaryKey( array( 'id' ), 'pk_ezpli_id' ); |
|
128 | - $table->addUniqueIndex( array( 'siteid', 'domain', 'refid', 'typeid', 'parentid' ), 'unq_ezpli_sid_dm_rid_tid_pid' ); |
|
129 | - $table->addIndex( array( 'siteid', 'status', 'start', 'end' ), 'idx_ezpli_sid_stat_start_end' ); |
|
130 | - $table->addIndex( array( 'parentid', 'siteid', 'refid', 'domain', 'typeid' ), 'idx_ezpli_pid_sid_rid_dom_tid' ); |
|
131 | - $table->addIndex( array( 'parentid', 'siteid', 'start' ), 'idx_ezpli_pid_sid_start' ); |
|
132 | - $table->addIndex( array( 'parentid', 'siteid', 'end' ), 'idx_ezpli_pid_sid_end' ); |
|
133 | - $table->addIndex( array( 'parentid', 'siteid', 'pos' ), 'idx_ezpli_pid_sid_pos' ); |
|
134 | - |
|
135 | - $table->addForeignKeyConstraint( 'ezuser', array( 'parentid' ), array( 'contentobject_id' ), |
|
136 | - array( 'onUpdate' => 'CASCADE', 'onDelete' => 'CASCADE' ), 'fk_ezpli_pid' ); |
|
137 | - |
|
138 | - $table->addForeignKeyConstraint( 'ezuser_list_type', array( 'typeid' ), array( 'id' ), |
|
139 | - array( 'onUpdate' => 'CASCADE', 'onDelete' => 'CASCADE' ), 'fk_ezpli_typeid' ); |
|
140 | - |
|
141 | - return $schema; |
|
142 | - }, |
|
143 | - ), |
|
10 | + 'table' => array( |
|
11 | + 'ezuser' => function ( \Doctrine\DBAL\Schema\Schema $schema ) { |
|
12 | + |
|
13 | + $table = $schema->createTable( 'ezuser' ); |
|
14 | + |
|
15 | + $table->addColumn( 'contentobject_id', 'integer', array() ); |
|
16 | + $table->addColumn( 'email', 'string', array( 'length' => 150 ) ); |
|
17 | + $table->addColumn( 'login', 'string', array( 'length' => 150 ) ); |
|
18 | + $table->addColumn( 'login_normalized', 'string', array( 'length' => 150 ) ); |
|
19 | + $table->addColumn( 'password_hash', 'string', array( 'length' => 50 ) ); |
|
20 | + $table->addColumn( 'password_hash_type', 'integer', array( 'default' => 1 ) ); |
|
21 | + |
|
22 | + $table->setPrimaryKey( array( 'contentobject_id' ) ); |
|
23 | + $table->addUniqueIndex( array( 'login_normalized' ), 'ezuser_login' ); |
|
24 | + |
|
25 | + return $schema; |
|
26 | + }, |
|
27 | + |
|
28 | + 'ezuser_setting' => function ( \Doctrine\DBAL\Schema\Schema $schema ) { |
|
29 | + |
|
30 | + $table = $schema->createTable( 'ezuser_setting' ); |
|
31 | + |
|
32 | + $table->addColumn( 'is_enabled', 'integer', array() ); |
|
33 | + $table->addColumn( 'max_login', 'integer', array( 'notnull' => false ) ); |
|
34 | + $table->addColumn( 'user_id', 'integer', array() ); |
|
35 | + |
|
36 | + $table->setPrimaryKey( array( 'user_id' ) ); |
|
37 | + |
|
38 | + return $schema; |
|
39 | + }, |
|
40 | + |
|
41 | + 'ezuser_address' => function ( \Doctrine\DBAL\Schema\Schema $schema ) { |
|
42 | + |
|
43 | + $table = $schema->createTable( 'ezuser_address' ); |
|
44 | + |
|
45 | + $table->addColumn( 'id', 'integer', array( 'autoincrement' => true ) ); |
|
46 | + $table->addColumn( 'siteid', 'integer', array() ); |
|
47 | + $table->addColumn( 'parentid', 'integer', array() ); |
|
48 | + $table->addColumn( 'company', 'string', array( 'length' => 100 ) ); |
|
49 | + $table->addColumn( 'vatid', 'string', array( 'length' => 32 ) ); |
|
50 | + $table->addColumn( 'salutation', 'string', array( 'length' => 8 ) ); |
|
51 | + $table->addColumn( 'title', 'string', array( 'length' => 64 ) ); |
|
52 | + $table->addColumn( 'firstname', 'string', array( 'length' => 64 ) ); |
|
53 | + $table->addColumn( 'lastname', 'string', array( 'length' => 64 ) ); |
|
54 | + $table->addColumn( 'address1', 'string', array( 'length' => 255 ) ); |
|
55 | + $table->addColumn( 'address2', 'string', array( 'length' => 255 ) ); |
|
56 | + $table->addColumn( 'address3', 'string', array( 'length' => 255 ) ); |
|
57 | + $table->addColumn( 'postal', 'string', array( 'length' => 16 ) ); |
|
58 | + $table->addColumn( 'city', 'string', array( 'length' => 255 ) ); |
|
59 | + $table->addColumn( 'state', 'string', array( 'length' => 255 ) ); |
|
60 | + $table->addColumn( 'langid', 'string', array( 'length' => 5, 'notnull' => false ) ); |
|
61 | + $table->addColumn( 'countryid', 'string', array( 'length' => 2, 'notnull' => false, 'fixed' => true ) ); |
|
62 | + $table->addColumn( 'telephone', 'string', array( 'length' => 32 ) ); |
|
63 | + $table->addColumn( 'email', 'string', array( 'length' => 255 ) ); |
|
64 | + $table->addColumn( 'telefax', 'string', array( 'length' => 255 ) ); |
|
65 | + $table->addColumn( 'website', 'string', array( 'length' => 255 ) ); |
|
66 | + $table->addColumn( 'flag', 'integer', array() ); |
|
67 | + $table->addColumn( 'pos', 'smallint', array() ); |
|
68 | + $table->addColumn( 'mtime', 'datetime', array() ); |
|
69 | + $table->addColumn( 'ctime', 'datetime', array() ); |
|
70 | + $table->addColumn( 'editor', 'string', array('length' => 255 ) ); |
|
71 | + |
|
72 | + $table->setPrimaryKey( array( 'id' ), 'pk_ezpad_id' ); |
|
73 | + $table->addIndex( array( 'lastname', 'firstname' ), 'idx_ezpad_ln_fn' ); |
|
74 | + $table->addIndex( array( 'address1', 'address2' ), 'idx_ezpad_ad1_ad2' ); |
|
75 | + $table->addIndex( array( 'postal', 'city' ), 'idx_ezpad_post_ci' ); |
|
76 | + $table->addIndex( array( 'parentid' ), 'idx_ezpad_pid' ); |
|
77 | + $table->addIndex( array( 'city' ), 'idx_ezpad_city' ); |
|
78 | + |
|
79 | + $table->addForeignKeyConstraint( 'ezuser', array( 'parentid' ), array( 'contentobject_id' ), |
|
80 | + array( 'onUpdate' => 'CASCADE', 'onDelete' => 'CASCADE' ), 'fk_ezpad_pid' ); |
|
81 | + |
|
82 | + return $schema; |
|
83 | + }, |
|
84 | + |
|
85 | + 'ezuser_list_type' => function ( \Doctrine\DBAL\Schema\Schema $schema ) { |
|
86 | + |
|
87 | + $table = $schema->createTable( 'ezuser_list_type' ); |
|
88 | + |
|
89 | + $table->addColumn( 'id', 'integer', array( 'autoincrement' => true ) ); |
|
90 | + $table->addColumn( 'siteid', 'integer', array() ); |
|
91 | + $table->addColumn( 'domain', 'string', array( 'length' => 32 ) ); |
|
92 | + $table->addColumn( 'code', 'string', array( 'length' => 32 ) ); |
|
93 | + $table->addColumn( 'label', 'string', array( 'length' => 255 ) ); |
|
94 | + $table->addColumn( 'status', 'smallint', array() ); |
|
95 | + $table->addColumn( 'mtime', 'datetime', array() ); |
|
96 | + $table->addColumn( 'ctime', 'datetime', array() ); |
|
97 | + $table->addColumn( 'editor', 'string', array( 'length' => 255 ) ); |
|
98 | + |
|
99 | + $table->setPrimaryKey( array( 'id' ), 'pk_ezplity_id' ); |
|
100 | + $table->addUniqueIndex( array( 'siteid', 'domain', 'code' ), 'unq_ezplity_sid_dom_code' ); |
|
101 | + $table->addIndex( array( 'siteid', 'status' ), 'idx_ezplity_sid_status' ); |
|
102 | + $table->addIndex( array( 'siteid', 'label' ), 'idx_ezplity_sid_label' ); |
|
103 | + $table->addIndex( array( 'siteid', 'code' ), 'idx_ezplity_sid_code' ); |
|
104 | + |
|
105 | + return $schema; |
|
106 | + }, |
|
107 | + |
|
108 | + 'ezuser_list' => function ( \Doctrine\DBAL\Schema\Schema $schema ) { |
|
109 | + |
|
110 | + $table = $schema->createTable( 'ezuser_list' ); |
|
111 | + |
|
112 | + $table->addColumn( 'id', 'integer', array( 'autoincrement' => true ) ); |
|
113 | + $table->addColumn( 'parentid', 'integer', array() ); |
|
114 | + $table->addColumn( 'siteid', 'integer', array() ); |
|
115 | + $table->addColumn( 'typeid', 'integer', array() ); |
|
116 | + $table->addColumn( 'domain', 'string', array( 'length' => 32 ) ); |
|
117 | + $table->addColumn( 'refid', 'string', array( 'length' => 32 ) ); |
|
118 | + $table->addColumn( 'start', 'datetime', array( 'notnull' => false ) ); |
|
119 | + $table->addColumn( 'end', 'datetime', array( 'notnull' => false ) ); |
|
120 | + $table->addColumn( 'config', 'text', array( 'length' => 0xffff ) ); |
|
121 | + $table->addColumn( 'pos', 'integer', array() ); |
|
122 | + $table->addColumn( 'status', 'smallint', array() ); |
|
123 | + $table->addColumn( 'mtime', 'datetime', array() ); |
|
124 | + $table->addColumn( 'ctime', 'datetime', array() ); |
|
125 | + $table->addColumn( 'editor', 'string', array( 'length' => 255 ) ); |
|
126 | + |
|
127 | + $table->setPrimaryKey( array( 'id' ), 'pk_ezpli_id' ); |
|
128 | + $table->addUniqueIndex( array( 'siteid', 'domain', 'refid', 'typeid', 'parentid' ), 'unq_ezpli_sid_dm_rid_tid_pid' ); |
|
129 | + $table->addIndex( array( 'siteid', 'status', 'start', 'end' ), 'idx_ezpli_sid_stat_start_end' ); |
|
130 | + $table->addIndex( array( 'parentid', 'siteid', 'refid', 'domain', 'typeid' ), 'idx_ezpli_pid_sid_rid_dom_tid' ); |
|
131 | + $table->addIndex( array( 'parentid', 'siteid', 'start' ), 'idx_ezpli_pid_sid_start' ); |
|
132 | + $table->addIndex( array( 'parentid', 'siteid', 'end' ), 'idx_ezpli_pid_sid_end' ); |
|
133 | + $table->addIndex( array( 'parentid', 'siteid', 'pos' ), 'idx_ezpli_pid_sid_pos' ); |
|
134 | + |
|
135 | + $table->addForeignKeyConstraint( 'ezuser', array( 'parentid' ), array( 'contentobject_id' ), |
|
136 | + array( 'onUpdate' => 'CASCADE', 'onDelete' => 'CASCADE' ), 'fk_ezpli_pid' ); |
|
137 | + |
|
138 | + $table->addForeignKeyConstraint( 'ezuser_list_type', array( 'typeid' ), array( 'id' ), |
|
139 | + array( 'onUpdate' => 'CASCADE', 'onDelete' => 'CASCADE' ), 'fk_ezpli_typeid' ); |
|
140 | + |
|
141 | + return $schema; |
|
142 | + }, |
|
143 | + ), |
|
144 | 144 | ); |
@@ -8,135 +8,135 @@ |
||
8 | 8 | |
9 | 9 | return array( |
10 | 10 | 'table' => array( |
11 | - 'ezuser' => function ( \Doctrine\DBAL\Schema\Schema $schema ) { |
|
11 | + 'ezuser' => function(\Doctrine\DBAL\Schema\Schema $schema) { |
|
12 | 12 | |
13 | - $table = $schema->createTable( 'ezuser' ); |
|
13 | + $table = $schema->createTable('ezuser'); |
|
14 | 14 | |
15 | - $table->addColumn( 'contentobject_id', 'integer', array() ); |
|
16 | - $table->addColumn( 'email', 'string', array( 'length' => 150 ) ); |
|
17 | - $table->addColumn( 'login', 'string', array( 'length' => 150 ) ); |
|
18 | - $table->addColumn( 'login_normalized', 'string', array( 'length' => 150 ) ); |
|
19 | - $table->addColumn( 'password_hash', 'string', array( 'length' => 50 ) ); |
|
20 | - $table->addColumn( 'password_hash_type', 'integer', array( 'default' => 1 ) ); |
|
15 | + $table->addColumn('contentobject_id', 'integer', array()); |
|
16 | + $table->addColumn('email', 'string', array('length' => 150)); |
|
17 | + $table->addColumn('login', 'string', array('length' => 150)); |
|
18 | + $table->addColumn('login_normalized', 'string', array('length' => 150)); |
|
19 | + $table->addColumn('password_hash', 'string', array('length' => 50)); |
|
20 | + $table->addColumn('password_hash_type', 'integer', array('default' => 1)); |
|
21 | 21 | |
22 | - $table->setPrimaryKey( array( 'contentobject_id' ) ); |
|
23 | - $table->addUniqueIndex( array( 'login_normalized' ), 'ezuser_login' ); |
|
22 | + $table->setPrimaryKey(array('contentobject_id')); |
|
23 | + $table->addUniqueIndex(array('login_normalized'), 'ezuser_login'); |
|
24 | 24 | |
25 | 25 | return $schema; |
26 | 26 | }, |
27 | 27 | |
28 | - 'ezuser_setting' => function ( \Doctrine\DBAL\Schema\Schema $schema ) { |
|
28 | + 'ezuser_setting' => function(\Doctrine\DBAL\Schema\Schema $schema) { |
|
29 | 29 | |
30 | - $table = $schema->createTable( 'ezuser_setting' ); |
|
30 | + $table = $schema->createTable('ezuser_setting'); |
|
31 | 31 | |
32 | - $table->addColumn( 'is_enabled', 'integer', array() ); |
|
33 | - $table->addColumn( 'max_login', 'integer', array( 'notnull' => false ) ); |
|
34 | - $table->addColumn( 'user_id', 'integer', array() ); |
|
32 | + $table->addColumn('is_enabled', 'integer', array()); |
|
33 | + $table->addColumn('max_login', 'integer', array('notnull' => false)); |
|
34 | + $table->addColumn('user_id', 'integer', array()); |
|
35 | 35 | |
36 | - $table->setPrimaryKey( array( 'user_id' ) ); |
|
36 | + $table->setPrimaryKey(array('user_id')); |
|
37 | 37 | |
38 | 38 | return $schema; |
39 | 39 | }, |
40 | 40 | |
41 | - 'ezuser_address' => function ( \Doctrine\DBAL\Schema\Schema $schema ) { |
|
42 | - |
|
43 | - $table = $schema->createTable( 'ezuser_address' ); |
|
44 | - |
|
45 | - $table->addColumn( 'id', 'integer', array( 'autoincrement' => true ) ); |
|
46 | - $table->addColumn( 'siteid', 'integer', array() ); |
|
47 | - $table->addColumn( 'parentid', 'integer', array() ); |
|
48 | - $table->addColumn( 'company', 'string', array( 'length' => 100 ) ); |
|
49 | - $table->addColumn( 'vatid', 'string', array( 'length' => 32 ) ); |
|
50 | - $table->addColumn( 'salutation', 'string', array( 'length' => 8 ) ); |
|
51 | - $table->addColumn( 'title', 'string', array( 'length' => 64 ) ); |
|
52 | - $table->addColumn( 'firstname', 'string', array( 'length' => 64 ) ); |
|
53 | - $table->addColumn( 'lastname', 'string', array( 'length' => 64 ) ); |
|
54 | - $table->addColumn( 'address1', 'string', array( 'length' => 255 ) ); |
|
55 | - $table->addColumn( 'address2', 'string', array( 'length' => 255 ) ); |
|
56 | - $table->addColumn( 'address3', 'string', array( 'length' => 255 ) ); |
|
57 | - $table->addColumn( 'postal', 'string', array( 'length' => 16 ) ); |
|
58 | - $table->addColumn( 'city', 'string', array( 'length' => 255 ) ); |
|
59 | - $table->addColumn( 'state', 'string', array( 'length' => 255 ) ); |
|
60 | - $table->addColumn( 'langid', 'string', array( 'length' => 5, 'notnull' => false ) ); |
|
61 | - $table->addColumn( 'countryid', 'string', array( 'length' => 2, 'notnull' => false, 'fixed' => true ) ); |
|
62 | - $table->addColumn( 'telephone', 'string', array( 'length' => 32 ) ); |
|
63 | - $table->addColumn( 'email', 'string', array( 'length' => 255 ) ); |
|
64 | - $table->addColumn( 'telefax', 'string', array( 'length' => 255 ) ); |
|
65 | - $table->addColumn( 'website', 'string', array( 'length' => 255 ) ); |
|
66 | - $table->addColumn( 'flag', 'integer', array() ); |
|
67 | - $table->addColumn( 'pos', 'smallint', array() ); |
|
68 | - $table->addColumn( 'mtime', 'datetime', array() ); |
|
69 | - $table->addColumn( 'ctime', 'datetime', array() ); |
|
70 | - $table->addColumn( 'editor', 'string', array('length' => 255 ) ); |
|
71 | - |
|
72 | - $table->setPrimaryKey( array( 'id' ), 'pk_ezpad_id' ); |
|
73 | - $table->addIndex( array( 'lastname', 'firstname' ), 'idx_ezpad_ln_fn' ); |
|
74 | - $table->addIndex( array( 'address1', 'address2' ), 'idx_ezpad_ad1_ad2' ); |
|
75 | - $table->addIndex( array( 'postal', 'city' ), 'idx_ezpad_post_ci' ); |
|
76 | - $table->addIndex( array( 'parentid' ), 'idx_ezpad_pid' ); |
|
77 | - $table->addIndex( array( 'city' ), 'idx_ezpad_city' ); |
|
78 | - |
|
79 | - $table->addForeignKeyConstraint( 'ezuser', array( 'parentid' ), array( 'contentobject_id' ), |
|
80 | - array( 'onUpdate' => 'CASCADE', 'onDelete' => 'CASCADE' ), 'fk_ezpad_pid' ); |
|
41 | + 'ezuser_address' => function(\Doctrine\DBAL\Schema\Schema $schema) { |
|
42 | + |
|
43 | + $table = $schema->createTable('ezuser_address'); |
|
44 | + |
|
45 | + $table->addColumn('id', 'integer', array('autoincrement' => true)); |
|
46 | + $table->addColumn('siteid', 'integer', array()); |
|
47 | + $table->addColumn('parentid', 'integer', array()); |
|
48 | + $table->addColumn('company', 'string', array('length' => 100)); |
|
49 | + $table->addColumn('vatid', 'string', array('length' => 32)); |
|
50 | + $table->addColumn('salutation', 'string', array('length' => 8)); |
|
51 | + $table->addColumn('title', 'string', array('length' => 64)); |
|
52 | + $table->addColumn('firstname', 'string', array('length' => 64)); |
|
53 | + $table->addColumn('lastname', 'string', array('length' => 64)); |
|
54 | + $table->addColumn('address1', 'string', array('length' => 255)); |
|
55 | + $table->addColumn('address2', 'string', array('length' => 255)); |
|
56 | + $table->addColumn('address3', 'string', array('length' => 255)); |
|
57 | + $table->addColumn('postal', 'string', array('length' => 16)); |
|
58 | + $table->addColumn('city', 'string', array('length' => 255)); |
|
59 | + $table->addColumn('state', 'string', array('length' => 255)); |
|
60 | + $table->addColumn('langid', 'string', array('length' => 5, 'notnull' => false)); |
|
61 | + $table->addColumn('countryid', 'string', array('length' => 2, 'notnull' => false, 'fixed' => true)); |
|
62 | + $table->addColumn('telephone', 'string', array('length' => 32)); |
|
63 | + $table->addColumn('email', 'string', array('length' => 255)); |
|
64 | + $table->addColumn('telefax', 'string', array('length' => 255)); |
|
65 | + $table->addColumn('website', 'string', array('length' => 255)); |
|
66 | + $table->addColumn('flag', 'integer', array()); |
|
67 | + $table->addColumn('pos', 'smallint', array()); |
|
68 | + $table->addColumn('mtime', 'datetime', array()); |
|
69 | + $table->addColumn('ctime', 'datetime', array()); |
|
70 | + $table->addColumn('editor', 'string', array('length' => 255)); |
|
71 | + |
|
72 | + $table->setPrimaryKey(array('id'), 'pk_ezpad_id'); |
|
73 | + $table->addIndex(array('lastname', 'firstname'), 'idx_ezpad_ln_fn'); |
|
74 | + $table->addIndex(array('address1', 'address2'), 'idx_ezpad_ad1_ad2'); |
|
75 | + $table->addIndex(array('postal', 'city'), 'idx_ezpad_post_ci'); |
|
76 | + $table->addIndex(array('parentid'), 'idx_ezpad_pid'); |
|
77 | + $table->addIndex(array('city'), 'idx_ezpad_city'); |
|
78 | + |
|
79 | + $table->addForeignKeyConstraint('ezuser', array('parentid'), array('contentobject_id'), |
|
80 | + array('onUpdate' => 'CASCADE', 'onDelete' => 'CASCADE'), 'fk_ezpad_pid'); |
|
81 | 81 | |
82 | 82 | return $schema; |
83 | 83 | }, |
84 | 84 | |
85 | - 'ezuser_list_type' => function ( \Doctrine\DBAL\Schema\Schema $schema ) { |
|
85 | + 'ezuser_list_type' => function(\Doctrine\DBAL\Schema\Schema $schema) { |
|
86 | 86 | |
87 | - $table = $schema->createTable( 'ezuser_list_type' ); |
|
87 | + $table = $schema->createTable('ezuser_list_type'); |
|
88 | 88 | |
89 | - $table->addColumn( 'id', 'integer', array( 'autoincrement' => true ) ); |
|
90 | - $table->addColumn( 'siteid', 'integer', array() ); |
|
91 | - $table->addColumn( 'domain', 'string', array( 'length' => 32 ) ); |
|
92 | - $table->addColumn( 'code', 'string', array( 'length' => 32 ) ); |
|
93 | - $table->addColumn( 'label', 'string', array( 'length' => 255 ) ); |
|
94 | - $table->addColumn( 'status', 'smallint', array() ); |
|
95 | - $table->addColumn( 'mtime', 'datetime', array() ); |
|
96 | - $table->addColumn( 'ctime', 'datetime', array() ); |
|
97 | - $table->addColumn( 'editor', 'string', array( 'length' => 255 ) ); |
|
89 | + $table->addColumn('id', 'integer', array('autoincrement' => true)); |
|
90 | + $table->addColumn('siteid', 'integer', array()); |
|
91 | + $table->addColumn('domain', 'string', array('length' => 32)); |
|
92 | + $table->addColumn('code', 'string', array('length' => 32)); |
|
93 | + $table->addColumn('label', 'string', array('length' => 255)); |
|
94 | + $table->addColumn('status', 'smallint', array()); |
|
95 | + $table->addColumn('mtime', 'datetime', array()); |
|
96 | + $table->addColumn('ctime', 'datetime', array()); |
|
97 | + $table->addColumn('editor', 'string', array('length' => 255)); |
|
98 | 98 | |
99 | - $table->setPrimaryKey( array( 'id' ), 'pk_ezplity_id' ); |
|
100 | - $table->addUniqueIndex( array( 'siteid', 'domain', 'code' ), 'unq_ezplity_sid_dom_code' ); |
|
101 | - $table->addIndex( array( 'siteid', 'status' ), 'idx_ezplity_sid_status' ); |
|
102 | - $table->addIndex( array( 'siteid', 'label' ), 'idx_ezplity_sid_label' ); |
|
103 | - $table->addIndex( array( 'siteid', 'code' ), 'idx_ezplity_sid_code' ); |
|
99 | + $table->setPrimaryKey(array('id'), 'pk_ezplity_id'); |
|
100 | + $table->addUniqueIndex(array('siteid', 'domain', 'code'), 'unq_ezplity_sid_dom_code'); |
|
101 | + $table->addIndex(array('siteid', 'status'), 'idx_ezplity_sid_status'); |
|
102 | + $table->addIndex(array('siteid', 'label'), 'idx_ezplity_sid_label'); |
|
103 | + $table->addIndex(array('siteid', 'code'), 'idx_ezplity_sid_code'); |
|
104 | 104 | |
105 | 105 | return $schema; |
106 | 106 | }, |
107 | 107 | |
108 | - 'ezuser_list' => function ( \Doctrine\DBAL\Schema\Schema $schema ) { |
|
109 | - |
|
110 | - $table = $schema->createTable( 'ezuser_list' ); |
|
111 | - |
|
112 | - $table->addColumn( 'id', 'integer', array( 'autoincrement' => true ) ); |
|
113 | - $table->addColumn( 'parentid', 'integer', array() ); |
|
114 | - $table->addColumn( 'siteid', 'integer', array() ); |
|
115 | - $table->addColumn( 'typeid', 'integer', array() ); |
|
116 | - $table->addColumn( 'domain', 'string', array( 'length' => 32 ) ); |
|
117 | - $table->addColumn( 'refid', 'string', array( 'length' => 32 ) ); |
|
118 | - $table->addColumn( 'start', 'datetime', array( 'notnull' => false ) ); |
|
119 | - $table->addColumn( 'end', 'datetime', array( 'notnull' => false ) ); |
|
120 | - $table->addColumn( 'config', 'text', array( 'length' => 0xffff ) ); |
|
121 | - $table->addColumn( 'pos', 'integer', array() ); |
|
122 | - $table->addColumn( 'status', 'smallint', array() ); |
|
123 | - $table->addColumn( 'mtime', 'datetime', array() ); |
|
124 | - $table->addColumn( 'ctime', 'datetime', array() ); |
|
125 | - $table->addColumn( 'editor', 'string', array( 'length' => 255 ) ); |
|
126 | - |
|
127 | - $table->setPrimaryKey( array( 'id' ), 'pk_ezpli_id' ); |
|
128 | - $table->addUniqueIndex( array( 'siteid', 'domain', 'refid', 'typeid', 'parentid' ), 'unq_ezpli_sid_dm_rid_tid_pid' ); |
|
129 | - $table->addIndex( array( 'siteid', 'status', 'start', 'end' ), 'idx_ezpli_sid_stat_start_end' ); |
|
130 | - $table->addIndex( array( 'parentid', 'siteid', 'refid', 'domain', 'typeid' ), 'idx_ezpli_pid_sid_rid_dom_tid' ); |
|
131 | - $table->addIndex( array( 'parentid', 'siteid', 'start' ), 'idx_ezpli_pid_sid_start' ); |
|
132 | - $table->addIndex( array( 'parentid', 'siteid', 'end' ), 'idx_ezpli_pid_sid_end' ); |
|
133 | - $table->addIndex( array( 'parentid', 'siteid', 'pos' ), 'idx_ezpli_pid_sid_pos' ); |
|
134 | - |
|
135 | - $table->addForeignKeyConstraint( 'ezuser', array( 'parentid' ), array( 'contentobject_id' ), |
|
136 | - array( 'onUpdate' => 'CASCADE', 'onDelete' => 'CASCADE' ), 'fk_ezpli_pid' ); |
|
137 | - |
|
138 | - $table->addForeignKeyConstraint( 'ezuser_list_type', array( 'typeid' ), array( 'id' ), |
|
139 | - array( 'onUpdate' => 'CASCADE', 'onDelete' => 'CASCADE' ), 'fk_ezpli_typeid' ); |
|
108 | + 'ezuser_list' => function(\Doctrine\DBAL\Schema\Schema $schema) { |
|
109 | + |
|
110 | + $table = $schema->createTable('ezuser_list'); |
|
111 | + |
|
112 | + $table->addColumn('id', 'integer', array('autoincrement' => true)); |
|
113 | + $table->addColumn('parentid', 'integer', array()); |
|
114 | + $table->addColumn('siteid', 'integer', array()); |
|
115 | + $table->addColumn('typeid', 'integer', array()); |
|
116 | + $table->addColumn('domain', 'string', array('length' => 32)); |
|
117 | + $table->addColumn('refid', 'string', array('length' => 32)); |
|
118 | + $table->addColumn('start', 'datetime', array('notnull' => false)); |
|
119 | + $table->addColumn('end', 'datetime', array('notnull' => false)); |
|
120 | + $table->addColumn('config', 'text', array('length' => 0xffff)); |
|
121 | + $table->addColumn('pos', 'integer', array()); |
|
122 | + $table->addColumn('status', 'smallint', array()); |
|
123 | + $table->addColumn('mtime', 'datetime', array()); |
|
124 | + $table->addColumn('ctime', 'datetime', array()); |
|
125 | + $table->addColumn('editor', 'string', array('length' => 255)); |
|
126 | + |
|
127 | + $table->setPrimaryKey(array('id'), 'pk_ezpli_id'); |
|
128 | + $table->addUniqueIndex(array('siteid', 'domain', 'refid', 'typeid', 'parentid'), 'unq_ezpli_sid_dm_rid_tid_pid'); |
|
129 | + $table->addIndex(array('siteid', 'status', 'start', 'end'), 'idx_ezpli_sid_stat_start_end'); |
|
130 | + $table->addIndex(array('parentid', 'siteid', 'refid', 'domain', 'typeid'), 'idx_ezpli_pid_sid_rid_dom_tid'); |
|
131 | + $table->addIndex(array('parentid', 'siteid', 'start'), 'idx_ezpli_pid_sid_start'); |
|
132 | + $table->addIndex(array('parentid', 'siteid', 'end'), 'idx_ezpli_pid_sid_end'); |
|
133 | + $table->addIndex(array('parentid', 'siteid', 'pos'), 'idx_ezpli_pid_sid_pos'); |
|
134 | + |
|
135 | + $table->addForeignKeyConstraint('ezuser', array('parentid'), array('contentobject_id'), |
|
136 | + array('onUpdate' => 'CASCADE', 'onDelete' => 'CASCADE'), 'fk_ezpli_pid'); |
|
137 | + |
|
138 | + $table->addForeignKeyConstraint('ezuser_list_type', array('typeid'), array('id'), |
|
139 | + array('onUpdate' => 'CASCADE', 'onDelete' => 'CASCADE'), 'fk_ezpli_typeid'); |
|
140 | 140 | |
141 | 141 | return $schema; |
142 | 142 | }, |
@@ -8,134 +8,134 @@ |
||
8 | 8 | */ |
9 | 9 | class TestHelper |
10 | 10 | { |
11 | - private static $aimeos; |
|
12 | - private static $context = array(); |
|
11 | + private static $aimeos; |
|
12 | + private static $context = array(); |
|
13 | 13 | |
14 | 14 | |
15 | - public static function bootstrap() |
|
16 | - { |
|
17 | - $aimeos = self::getAimeos(); |
|
15 | + public static function bootstrap() |
|
16 | + { |
|
17 | + $aimeos = self::getAimeos(); |
|
18 | 18 | |
19 | - $includepaths = $aimeos->getIncludePaths(); |
|
20 | - $includepaths[] = get_include_path(); |
|
21 | - set_include_path( implode( PATH_SEPARATOR, $includepaths ) ); |
|
22 | - } |
|
19 | + $includepaths = $aimeos->getIncludePaths(); |
|
20 | + $includepaths[] = get_include_path(); |
|
21 | + set_include_path( implode( PATH_SEPARATOR, $includepaths ) ); |
|
22 | + } |
|
23 | 23 | |
24 | 24 | |
25 | - public static function getContext( $site = 'unittest' ) |
|
26 | - { |
|
27 | - if( !isset( self::$context[$site] ) ) { |
|
28 | - self::$context[$site] = self::createContext( $site ); |
|
29 | - } |
|
25 | + public static function getContext( $site = 'unittest' ) |
|
26 | + { |
|
27 | + if( !isset( self::$context[$site] ) ) { |
|
28 | + self::$context[$site] = self::createContext( $site ); |
|
29 | + } |
|
30 | 30 | |
31 | - return clone self::$context[$site]; |
|
32 | - } |
|
31 | + return clone self::$context[$site]; |
|
32 | + } |
|
33 | 33 | |
34 | 34 | |
35 | - private static function getAimeos() |
|
36 | - { |
|
37 | - if( !isset( self::$aimeos ) ) |
|
38 | - { |
|
39 | - require_once 'Bootstrap.php'; |
|
40 | - spl_autoload_register( 'Aimeos\\Bootstrap::autoload' ); |
|
35 | + private static function getAimeos() |
|
36 | + { |
|
37 | + if( !isset( self::$aimeos ) ) |
|
38 | + { |
|
39 | + require_once 'Bootstrap.php'; |
|
40 | + spl_autoload_register( 'Aimeos\\Bootstrap::autoload' ); |
|
41 | 41 | |
42 | - $extdir = dirname( dirname( dirname( __DIR__ ) ) ); |
|
43 | - self::$aimeos = new \Aimeos\Bootstrap( array( $extdir ), true ); |
|
44 | - } |
|
42 | + $extdir = dirname( dirname( dirname( __DIR__ ) ) ); |
|
43 | + self::$aimeos = new \Aimeos\Bootstrap( array( $extdir ), true ); |
|
44 | + } |
|
45 | 45 | |
46 | - return self::$aimeos; |
|
47 | - } |
|
46 | + return self::$aimeos; |
|
47 | + } |
|
48 | 48 | |
49 | 49 | |
50 | - /** |
|
51 | - * @param string $site |
|
52 | - */ |
|
53 | - private static function createContext( $site ) |
|
54 | - { |
|
55 | - $ctx = new \Aimeos\MShop\Context\Item\Ezpublish(); |
|
56 | - $aimeos = self::getAimeos(); |
|
50 | + /** |
|
51 | + * @param string $site |
|
52 | + */ |
|
53 | + private static function createContext( $site ) |
|
54 | + { |
|
55 | + $ctx = new \Aimeos\MShop\Context\Item\Ezpublish(); |
|
56 | + $aimeos = self::getAimeos(); |
|
57 | 57 | |
58 | 58 | |
59 | - $paths = $aimeos->getConfigPaths(); |
|
60 | - $paths[] = __DIR__ . DIRECTORY_SEPARATOR . 'config'; |
|
59 | + $paths = $aimeos->getConfigPaths(); |
|
60 | + $paths[] = __DIR__ . DIRECTORY_SEPARATOR . 'config'; |
|
61 | 61 | |
62 | - $conf = new \Aimeos\MW\Config\PHPArray( array(), $paths ); |
|
63 | - $ctx->setConfig( $conf ); |
|
62 | + $conf = new \Aimeos\MW\Config\PHPArray( array(), $paths ); |
|
63 | + $ctx->setConfig( $conf ); |
|
64 | 64 | |
65 | 65 | |
66 | - $dbm = new \Aimeos\MW\DB\Manager\DBAL( $conf ); |
|
67 | - $ctx->setDatabaseManager( $dbm ); |
|
66 | + $dbm = new \Aimeos\MW\DB\Manager\DBAL( $conf ); |
|
67 | + $ctx->setDatabaseManager( $dbm ); |
|
68 | 68 | |
69 | 69 | |
70 | - $logger = new \Aimeos\MW\Logger\File( $site . '.log', \Aimeos\MW\Logger\Base::DEBUG ); |
|
71 | - $ctx->setLogger( $logger ); |
|
70 | + $logger = new \Aimeos\MW\Logger\File( $site . '.log', \Aimeos\MW\Logger\Base::DEBUG ); |
|
71 | + $ctx->setLogger( $logger ); |
|
72 | 72 | |
73 | 73 | |
74 | - $cache = new \Aimeos\MW\Cache\None(); |
|
75 | - $ctx->setCache( $cache ); |
|
74 | + $cache = new \Aimeos\MW\Cache\None(); |
|
75 | + $ctx->setCache( $cache ); |
|
76 | 76 | |
77 | 77 | |
78 | - $i18n = new \Aimeos\MW\Translation\None( 'de' ); |
|
79 | - $ctx->setI18n( array( 'de' => $i18n ) ); |
|
78 | + $i18n = new \Aimeos\MW\Translation\None( 'de' ); |
|
79 | + $ctx->setI18n( array( 'de' => $i18n ) ); |
|
80 | 80 | |
81 | 81 | |
82 | - $session = new \Aimeos\MW\Session\None(); |
|
83 | - $ctx->setSession( $session ); |
|
82 | + $session = new \Aimeos\MW\Session\None(); |
|
83 | + $ctx->setSession( $session ); |
|
84 | 84 | |
85 | 85 | |
86 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $ctx ); |
|
87 | - $localeItem = $localeManager->bootstrap( $site, '', '', false ); |
|
86 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $ctx ); |
|
87 | + $localeItem = $localeManager->bootstrap( $site, '', '', false ); |
|
88 | 88 | |
89 | - $ctx->setLocale( $localeItem ); |
|
89 | + $ctx->setLocale( $localeItem ); |
|
90 | 90 | |
91 | - $ctx->setEditor( 'ai-ezpublish:unittest' ); |
|
91 | + $ctx->setEditor( 'ai-ezpublish:unittest' ); |
|
92 | 92 | |
93 | 93 | |
94 | - $ctx->setEzUser( function( $code, $email, $password ) use ( $ctx ) { |
|
94 | + $ctx->setEzUser( function( $code, $email, $password ) use ( $ctx ) { |
|
95 | 95 | |
96 | - $id = mt_rand( -0x7fffffff,-1 ); |
|
97 | - $dbm = $ctx->getDatabaseManager(); |
|
98 | - $dbconf = $ctx->getConfig()->get( 'resource/db-customer' ); |
|
99 | - $dbname = ( $dbconf ? 'db-customer' : 'db' ); |
|
100 | - $conn = $dbm->acquire( $dbname ); |
|
96 | + $id = mt_rand( -0x7fffffff,-1 ); |
|
97 | + $dbm = $ctx->getDatabaseManager(); |
|
98 | + $dbconf = $ctx->getConfig()->get( 'resource/db-customer' ); |
|
99 | + $dbname = ( $dbconf ? 'db-customer' : 'db' ); |
|
100 | + $conn = $dbm->acquire( $dbname ); |
|
101 | 101 | |
102 | - try |
|
103 | - { |
|
104 | - $stmt = $conn->create( 'INSERT INTO "ezuser" ( |
|
102 | + try |
|
103 | + { |
|
104 | + $stmt = $conn->create( 'INSERT INTO "ezuser" ( |
|
105 | 105 | "contentobject_id", "email", "login", "login_normalized", "password_hash", "password_hash_type" |
106 | 106 | ) VALUES ( |
107 | 107 | ?, ?, ?, ?, ?, 5 |
108 | 108 | )' ); |
109 | 109 | |
110 | - $stmt->bind( 1, $id, \Aimeos\MW\DB\Statement\Base::PARAM_INT ); |
|
111 | - $stmt->bind( 2, $email ); |
|
112 | - $stmt->bind( 3, $code ); |
|
113 | - $stmt->bind( 4, $code ); |
|
114 | - $stmt->bind( 5, $password ); |
|
110 | + $stmt->bind( 1, $id, \Aimeos\MW\DB\Statement\Base::PARAM_INT ); |
|
111 | + $stmt->bind( 2, $email ); |
|
112 | + $stmt->bind( 3, $code ); |
|
113 | + $stmt->bind( 4, $code ); |
|
114 | + $stmt->bind( 5, $password ); |
|
115 | 115 | |
116 | - $stmt->execute()->finish(); |
|
116 | + $stmt->execute()->finish(); |
|
117 | 117 | |
118 | - $sql = 'INSERT INTO "ezuser_setting" ( "user_id", "is_enabled", "max_login" ) VALUES ( ?, ?, ? )'; |
|
119 | - $stmt = $conn->create( $sql ); |
|
118 | + $sql = 'INSERT INTO "ezuser_setting" ( "user_id", "is_enabled", "max_login" ) VALUES ( ?, ?, ? )'; |
|
119 | + $stmt = $conn->create( $sql ); |
|
120 | 120 | |
121 | - $stmt->bind( 1, $id, \Aimeos\MW\DB\Statement\Base::PARAM_INT ); |
|
122 | - $stmt->bind( 2, 0 ); |
|
123 | - $stmt->bind( 3, 10 ); |
|
121 | + $stmt->bind( 1, $id, \Aimeos\MW\DB\Statement\Base::PARAM_INT ); |
|
122 | + $stmt->bind( 2, 0 ); |
|
123 | + $stmt->bind( 3, 10 ); |
|
124 | 124 | |
125 | - $stmt->execute()->finish(); |
|
125 | + $stmt->execute()->finish(); |
|
126 | 126 | |
127 | - $dbm->release( $conn, $dbname ); |
|
128 | - } |
|
129 | - catch( \Exception $e ) |
|
130 | - { |
|
131 | - $dbm->release( $conn, $dbname ); |
|
132 | - throw $e; |
|
133 | - } |
|
127 | + $dbm->release( $conn, $dbname ); |
|
128 | + } |
|
129 | + catch( \Exception $e ) |
|
130 | + { |
|
131 | + $dbm->release( $conn, $dbname ); |
|
132 | + throw $e; |
|
133 | + } |
|
134 | 134 | |
135 | - return $id; |
|
136 | - } ); |
|
135 | + return $id; |
|
136 | + } ); |
|
137 | 137 | |
138 | 138 | |
139 | - return $ctx; |
|
140 | - } |
|
139 | + return $ctx; |
|
140 | + } |
|
141 | 141 | } |
@@ -18,14 +18,14 @@ discard block |
||
18 | 18 | |
19 | 19 | $includepaths = $aimeos->getIncludePaths(); |
20 | 20 | $includepaths[] = get_include_path(); |
21 | - set_include_path( implode( PATH_SEPARATOR, $includepaths ) ); |
|
21 | + set_include_path(implode(PATH_SEPARATOR, $includepaths)); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | |
25 | - public static function getContext( $site = 'unittest' ) |
|
25 | + public static function getContext($site = 'unittest') |
|
26 | 26 | { |
27 | - if( !isset( self::$context[$site] ) ) { |
|
28 | - self::$context[$site] = self::createContext( $site ); |
|
27 | + if (!isset(self::$context[$site])) { |
|
28 | + self::$context[$site] = self::createContext($site); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | return clone self::$context[$site]; |
@@ -34,13 +34,13 @@ discard block |
||
34 | 34 | |
35 | 35 | private static function getAimeos() |
36 | 36 | { |
37 | - if( !isset( self::$aimeos ) ) |
|
37 | + if (!isset(self::$aimeos)) |
|
38 | 38 | { |
39 | 39 | require_once 'Bootstrap.php'; |
40 | - spl_autoload_register( 'Aimeos\\Bootstrap::autoload' ); |
|
40 | + spl_autoload_register('Aimeos\\Bootstrap::autoload'); |
|
41 | 41 | |
42 | - $extdir = dirname( dirname( dirname( __DIR__ ) ) ); |
|
43 | - self::$aimeos = new \Aimeos\Bootstrap( array( $extdir ), true ); |
|
42 | + $extdir = dirname(dirname(dirname(__DIR__))); |
|
43 | + self::$aimeos = new \Aimeos\Bootstrap(array($extdir), true); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | return self::$aimeos; |
@@ -50,85 +50,85 @@ discard block |
||
50 | 50 | /** |
51 | 51 | * @param string $site |
52 | 52 | */ |
53 | - private static function createContext( $site ) |
|
53 | + private static function createContext($site) |
|
54 | 54 | { |
55 | 55 | $ctx = new \Aimeos\MShop\Context\Item\Ezpublish(); |
56 | 56 | $aimeos = self::getAimeos(); |
57 | 57 | |
58 | 58 | |
59 | 59 | $paths = $aimeos->getConfigPaths(); |
60 | - $paths[] = __DIR__ . DIRECTORY_SEPARATOR . 'config'; |
|
60 | + $paths[] = __DIR__.DIRECTORY_SEPARATOR.'config'; |
|
61 | 61 | |
62 | - $conf = new \Aimeos\MW\Config\PHPArray( array(), $paths ); |
|
63 | - $ctx->setConfig( $conf ); |
|
62 | + $conf = new \Aimeos\MW\Config\PHPArray(array(), $paths); |
|
63 | + $ctx->setConfig($conf); |
|
64 | 64 | |
65 | 65 | |
66 | - $dbm = new \Aimeos\MW\DB\Manager\DBAL( $conf ); |
|
67 | - $ctx->setDatabaseManager( $dbm ); |
|
66 | + $dbm = new \Aimeos\MW\DB\Manager\DBAL($conf); |
|
67 | + $ctx->setDatabaseManager($dbm); |
|
68 | 68 | |
69 | 69 | |
70 | - $logger = new \Aimeos\MW\Logger\File( $site . '.log', \Aimeos\MW\Logger\Base::DEBUG ); |
|
71 | - $ctx->setLogger( $logger ); |
|
70 | + $logger = new \Aimeos\MW\Logger\File($site.'.log', \Aimeos\MW\Logger\Base::DEBUG); |
|
71 | + $ctx->setLogger($logger); |
|
72 | 72 | |
73 | 73 | |
74 | 74 | $cache = new \Aimeos\MW\Cache\None(); |
75 | - $ctx->setCache( $cache ); |
|
75 | + $ctx->setCache($cache); |
|
76 | 76 | |
77 | 77 | |
78 | - $i18n = new \Aimeos\MW\Translation\None( 'de' ); |
|
79 | - $ctx->setI18n( array( 'de' => $i18n ) ); |
|
78 | + $i18n = new \Aimeos\MW\Translation\None('de'); |
|
79 | + $ctx->setI18n(array('de' => $i18n)); |
|
80 | 80 | |
81 | 81 | |
82 | 82 | $session = new \Aimeos\MW\Session\None(); |
83 | - $ctx->setSession( $session ); |
|
83 | + $ctx->setSession($session); |
|
84 | 84 | |
85 | 85 | |
86 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $ctx ); |
|
87 | - $localeItem = $localeManager->bootstrap( $site, '', '', false ); |
|
86 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($ctx); |
|
87 | + $localeItem = $localeManager->bootstrap($site, '', '', false); |
|
88 | 88 | |
89 | - $ctx->setLocale( $localeItem ); |
|
89 | + $ctx->setLocale($localeItem); |
|
90 | 90 | |
91 | - $ctx->setEditor( 'ai-ezpublish:unittest' ); |
|
91 | + $ctx->setEditor('ai-ezpublish:unittest'); |
|
92 | 92 | |
93 | 93 | |
94 | - $ctx->setEzUser( function( $code, $email, $password ) use ( $ctx ) { |
|
94 | + $ctx->setEzUser(function($code, $email, $password) use ($ctx) { |
|
95 | 95 | |
96 | - $id = mt_rand( -0x7fffffff,-1 ); |
|
96 | + $id = mt_rand( -0x7fffffff, -1 ); |
|
97 | 97 | $dbm = $ctx->getDatabaseManager(); |
98 | - $dbconf = $ctx->getConfig()->get( 'resource/db-customer' ); |
|
99 | - $dbname = ( $dbconf ? 'db-customer' : 'db' ); |
|
100 | - $conn = $dbm->acquire( $dbname ); |
|
98 | + $dbconf = $ctx->getConfig()->get('resource/db-customer'); |
|
99 | + $dbname = ($dbconf ? 'db-customer' : 'db'); |
|
100 | + $conn = $dbm->acquire($dbname); |
|
101 | 101 | |
102 | 102 | try |
103 | 103 | { |
104 | - $stmt = $conn->create( 'INSERT INTO "ezuser" ( |
|
104 | + $stmt = $conn->create('INSERT INTO "ezuser" ( |
|
105 | 105 | "contentobject_id", "email", "login", "login_normalized", "password_hash", "password_hash_type" |
106 | 106 | ) VALUES ( |
107 | 107 | ?, ?, ?, ?, ?, 5 |
108 | 108 | )' ); |
109 | 109 | |
110 | - $stmt->bind( 1, $id, \Aimeos\MW\DB\Statement\Base::PARAM_INT ); |
|
111 | - $stmt->bind( 2, $email ); |
|
112 | - $stmt->bind( 3, $code ); |
|
113 | - $stmt->bind( 4, $code ); |
|
114 | - $stmt->bind( 5, $password ); |
|
110 | + $stmt->bind(1, $id, \Aimeos\MW\DB\Statement\Base::PARAM_INT); |
|
111 | + $stmt->bind(2, $email); |
|
112 | + $stmt->bind(3, $code); |
|
113 | + $stmt->bind(4, $code); |
|
114 | + $stmt->bind(5, $password); |
|
115 | 115 | |
116 | 116 | $stmt->execute()->finish(); |
117 | 117 | |
118 | 118 | $sql = 'INSERT INTO "ezuser_setting" ( "user_id", "is_enabled", "max_login" ) VALUES ( ?, ?, ? )'; |
119 | - $stmt = $conn->create( $sql ); |
|
119 | + $stmt = $conn->create($sql); |
|
120 | 120 | |
121 | - $stmt->bind( 1, $id, \Aimeos\MW\DB\Statement\Base::PARAM_INT ); |
|
122 | - $stmt->bind( 2, 0 ); |
|
123 | - $stmt->bind( 3, 10 ); |
|
121 | + $stmt->bind(1, $id, \Aimeos\MW\DB\Statement\Base::PARAM_INT); |
|
122 | + $stmt->bind(2, 0); |
|
123 | + $stmt->bind(3, 10); |
|
124 | 124 | |
125 | 125 | $stmt->execute()->finish(); |
126 | 126 | |
127 | - $dbm->release( $conn, $dbname ); |
|
127 | + $dbm->release($conn, $dbname); |
|
128 | 128 | } |
129 | - catch( \Exception $e ) |
|
129 | + catch (\Exception $e) |
|
130 | 130 | { |
131 | - $dbm->release( $conn, $dbname ); |
|
131 | + $dbm->release($conn, $dbname); |
|
132 | 132 | throw $e; |
133 | 133 | } |
134 | 134 |
@@ -6,14 +6,14 @@ discard block |
||
6 | 6 | */ |
7 | 7 | |
8 | 8 | return array( |
9 | - 'delete' => array( |
|
10 | - 'ansi' => ' |
|
9 | + 'delete' => array( |
|
10 | + 'ansi' => ' |
|
11 | 11 | DELETE FROM "ezuser" |
12 | 12 | WHERE :cond |
13 | 13 | ', |
14 | - ), |
|
15 | - 'update' => array( |
|
16 | - 'ansi' => ' |
|
14 | + ), |
|
15 | + 'update' => array( |
|
16 | + 'ansi' => ' |
|
17 | 17 | UPDATE "ezuser" |
18 | 18 | SET "login_normalized" = ?, "login" = ?, "company" = ?, "vatid" = ?, |
19 | 19 | "salutation" = ?, "title" = ?, "firstname" = ?, "lastname" = ?, |
@@ -24,16 +24,16 @@ discard block |
||
24 | 24 | "mtime" = ?, "editor" = ?, "ctime" = ? |
25 | 25 | WHERE "contentobject_id" = ? |
26 | 26 | ', |
27 | - ), |
|
28 | - 'update-status' => array( |
|
29 | - 'ansi' => ' |
|
27 | + ), |
|
28 | + 'update-status' => array( |
|
29 | + 'ansi' => ' |
|
30 | 30 | UPDATE "ezuser_setting" |
31 | 31 | SET "is_enabled" = ? |
32 | 32 | WHERE "user_id" = ? |
33 | 33 | ', |
34 | - ), |
|
35 | - 'search' => array( |
|
36 | - 'ansi' => ' |
|
34 | + ), |
|
35 | + 'search' => array( |
|
36 | + 'ansi' => ' |
|
37 | 37 | SELECT DISTINCT ezu."contentobject_id" AS "customer.id", |
38 | 38 | ezu."login_normalized" as "customer.code", ezu."login" as "customer.label", |
39 | 39 | ezu."company" AS "customer.company", ezu."vatid" AS "customer.vatid", |
@@ -56,9 +56,9 @@ discard block |
||
56 | 56 | /*-orderby*/ ORDER BY :order /*orderby-*/ |
57 | 57 | LIMIT :size OFFSET :start |
58 | 58 | ', |
59 | - ), |
|
60 | - 'count' => array( |
|
61 | - 'ansi' => ' |
|
59 | + ), |
|
60 | + 'count' => array( |
|
61 | + 'ansi' => ' |
|
62 | 62 | SELECT COUNT(*) AS "count" |
63 | 63 | FROM ( |
64 | 64 | SELECT DISTINCT ezu."contentobject_id" |
@@ -69,5 +69,5 @@ discard block |
||
69 | 69 | LIMIT 10000 OFFSET 0 |
70 | 70 | ) AS list |
71 | 71 | ', |
72 | - ), |
|
72 | + ), |
|
73 | 73 | ); |