Passed
Push — master ( ae8cc8...b4d665 )
by Aimeos
04:50
created

Standard::clear()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 4
c 0
b 0
f 0
dl 0
loc 8
rs 10
cc 2
nc 2
nop 1
1
<?php
2
3
/**
4
 * @license LGPLv3, https://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2015-2023
6
 * @package MShop
7
 * @subpackage Group
8
 */
9
10
11
namespace Aimeos\MShop\Group\Manager;
12
13
14
/**
15
 * Default implementation of the group manager
16
 *
17
 * @package MShop
18
 * @subpackage Group
19
 */
20
class Standard
21
	extends \Aimeos\MShop\Common\Manager\Base
22
	implements \Aimeos\MShop\Group\Manager\Iface, \Aimeos\MShop\Common\Manager\Factory\Iface
23
{
24
	private array $searchConfig = array(
25
		'group.id' => array(
26
			'code' => 'group.id',
27
			'internalcode' => 'mgro."id"',
28
			'label' => 'Group ID',
29
			'type' => 'int',
30
			'public' => false,
31
		),
32
		'group.siteid' => array(
33
			'code' => 'group.siteid',
34
			'internalcode' => 'mgro."siteid"',
35
			'label' => 'Group site ID',
36
			'public' => false,
37
		),
38
		'group.code' => array(
39
			'code' => 'group.code',
40
			'internalcode' => 'mgro."code"',
41
			'label' => 'Group code',
42
		),
43
		'group.label' => array(
44
			'code' => 'group.label',
45
			'internalcode' => 'mgro."label"',
46
			'label' => 'Group label',
47
		),
48
		'group.ctime' => array(
49
			'code' => 'group.ctime',
50
			'internalcode' => 'mgro."ctime"',
51
			'label' => 'Group create date/time',
52
			'type' => 'datetime',
53
			'public' => false,
54
		),
55
		'group.mtime' => array(
56
			'code' => 'group.mtime',
57
			'internalcode' => 'mgro."mtime"',
58
			'label' => 'Group modify date/time',
59
			'type' => 'datetime',
60
			'public' => false,
61
		),
62
		'group.editor' => array(
63
			'code' => 'group.editor',
64
			'internalcode' => 'mgro."editor"',
65
			'label' => 'Group editor',
66
			'public' => false,
67
		),
68
	);
69
70
71
	/**
72
	 * Initializes the object
73
	 *
74
	 * @param \Aimeos\MShop\ContextIface $context Context object
75
	 */
76
	public function __construct( \Aimeos\MShop\ContextIface $context )
77
	{
78
		parent::__construct( $context );
79
80
		/** mshop/group/manager/resource
81
		 * Name of the database connection resource to use
82
		 *
83
		 * You can configure a different database connection for each data domain
84
		 * and if no such connection name exists, the "db" connection will be used.
85
		 * It's also possible to use the same database connection for different
86
		 * data domains by configuring the same connection name using this setting.
87
		 *
88
		 * @param string Database connection name
89
		 * @since 2023.04
90
		 */
91
		$this->setResourceName( $context->config()->get( 'mshop/group/manager/resource', 'db-group' ) );
92
	}
93
94
95
	/**
96
	 * Removes old entries from the database
97
	 *
98
	 * @param iterable $siteids List of IDs for sites whose entries should be deleted
99
	 * @return \Aimeos\MShop\Group\Manager\Iface Manager object for chaining method calls
100
	 */
101
	public function clear( iterable $siteids ) : \Aimeos\MShop\Common\Manager\Iface
102
	{
103
		$path = 'mshop/group/manager/submanagers';
104
		foreach( $this->context()->config()->get( $path, [] ) as $domain ) {
105
			$this->object()->getSubManager( $domain )->clear( $siteids );
106
		}
107
108
		return $this->clearBase( $siteids, 'mshop/group/manager/delete' );
109
	}
110
111
112
	/**
113
	 * Creates a new empty item instance
114
	 *
115
	 * @param array $values Values the item should be initialized with
116
	 * @return \Aimeos\MShop\Group\Item\Iface New group item object
117
	 */
118
	public function create( array $values = [] ) : \Aimeos\MShop\Common\Item\Iface
119
	{
120
		$values['group.siteid'] = $values['group.siteid'] ?? $this->context()->locale()->getSiteId();
121
		return $this->createItemBase( $values );
122
	}
123
124
125
	/**
126
	 * Returns the available manager types
127
	 *
128
	 * @param bool $withsub Return also the resource type of sub-managers if true
129
	 * @return string[] Type of the manager and submanagers, subtypes are separated by slashes
130
	 */
131
	public function getResourceType( bool $withsub = true ) : array
132
	{
133
		$path = 'mshop/group/manager/submanagers';
134
		return $this->getResourceTypeBase( 'group', $path, [], $withsub );
135
	}
136
137
138
	/**
139
	 * Returns the attributes that can be used for searching
140
	 *
141
	 * @param bool $withsub Return attributes of sub-managers too if true
142
	 * @return \Aimeos\Base\Criteria\Attribute\Iface[] List of search attribute items
143
	 */
144
	public function getSearchAttributes( bool $withsub = true ) : array
145
	{
146
		/** mshop/group/manager/submanagers
147
		 * List of manager names that can be instantiated by the group manager
148
		 *
149
		 * Managers provide a generic interface to the underlying storage.
150
		 * Each manager has or can have sub-managers caring about particular
151
		 * aspects. Each of these sub-managers can be instantiated by its
152
		 * parent manager using the getSubManager() method.
153
		 *
154
		 * The search keys from sub-managers can be normally used in the
155
		 * manager as well. It allows you to search for items of the manager
156
		 * using the search keys of the sub-managers to further limit the
157
		 * retrieved list of items.
158
		 *
159
		 * @param array List of sub-manager names
160
		 * @since 2015.08
161
		 * @category Developer
162
		 */
163
		$path = 'mshop/group/manager/submanagers';
164
165
		return $this->getSearchAttributesBase( $this->searchConfig, $path, [], $withsub );
166
	}
167
168
169
	/**
170
	 * Removes multiple items.
171
	 *
172
	 * @param \Aimeos\MShop\Common\Item\Iface[]|string[] $itemIds List of item objects or IDs of the items
173
	 * @return \Aimeos\MShop\Group\Manager\Iface Manager object for chaining method calls
174
	 */
175
	public function delete( $itemIds ) : \Aimeos\MShop\Common\Manager\Iface
176
	{
177
		/** mshop/group/manager/delete/mysql
178
		 * Deletes the items matched by the given IDs from the database
179
		 *
180
		 * @see mshop/group/manager/delete/ansi
181
		 */
182
183
		/** mshop/group/manager/delete/ansi
184
		 * Deletes the items matched by the given IDs from the database
185
		 *
186
		 * Removes the records specified by the given IDs from the group
187
		 * database. The records must be from the site that is configured via the
188
		 * context item.
189
		 *
190
		 * The ":cond" placeholder is replaced by the name of the ID column and
191
		 * the given ID or list of IDs while the site ID is bound to the question
192
		 * mark.
193
		 *
194
		 * The SQL statement should conform to the ANSI standard to be
195
		 * compatible with most relational database systems. This also
196
		 * includes using double quotes for table and column names.
197
		 *
198
		 * @param string SQL statement for deleting items
199
		 * @since 2015.08
200
		 * @category Developer
201
		 * @see mshop/group/manager/insert/ansi
202
		 * @see mshop/group/manager/update/ansi
203
		 * @see mshop/group/manager/newid/ansi
204
		 * @see mshop/group/manager/search/ansi
205
		 * @see mshop/group/manager/count/ansi
206
		 */
207
		$path = 'mshop/group/manager/delete';
208
209
		return $this->deleteItemsBase( $itemIds, $path );
210
	}
211
212
213
	/**
214
	 * Returns the item specified by its code and domain/type if necessary
215
	 *
216
	 * @param string $code Code of the item
217
	 * @param string[] $ref List of domains to fetch list items and referenced items for
218
	 * @param string|null $domain Domain of the item if necessary to identify the item uniquely
219
	 * @param string|null $type Type code of the item if necessary to identify the item uniquely
220
	 * @param bool|null $default Add default criteria or NULL for relaxed default criteria
221
	 * @return \Aimeos\MShop\Common\Item\Iface Item object
222
	 */
223
	public function find( string $code, array $ref = [], string $domain = null, string $type = null,
224
		?bool $default = false ) : \Aimeos\MShop\Common\Item\Iface
225
	{
226
		return $this->findBase( array( 'group.code' => $code ), $ref, $default );
227
	}
228
229
230
	/**
231
	 * Returns the group item object specificed by its ID
232
	 *
233
	 * @param string $id Unique group ID referencing an existing group
234
	 * @param string[] $ref List of domains to fetch list items and referenced items for
235
	 * @param bool|null $default Add default criteria or NULL for relaxed default criteria
236
	 * @return \Aimeos\MShop\Group\Item\Iface Returns the group item for the given ID
237
	 * @throws \Aimeos\MShop\Exception If item couldn't be found
238
	 */
239
	public function get( string $id, array $ref = [], ?bool $default = false ) : \Aimeos\MShop\Common\Item\Iface
240
	{
241
		return $this->getItemBase( 'group.id', $id, $ref, $default );
242
	}
243
244
245
	/**
246
	 * Inserts a new or updates an existing group item
247
	 *
248
	 * @param \Aimeos\MShop\Group\Item\Iface $item Group group item
249
	 * @param bool $fetch True if the new ID should be returned in the item
250
	 * @return \Aimeos\MShop\Group\Item\Iface $item Updated item including the generated ID
251
	 */
252
	protected function saveItem( \Aimeos\MShop\Group\Item\Iface $item, bool $fetch = true ) : \Aimeos\MShop\Group\Item\Iface
253
	{
254
		if( !$item->isModified() ) {
255
			return $item;
256
		}
257
258
		$context = $this->context();
259
		$conn = $context->db( $this->getResourceName() );
260
261
		$id = $item->getId();
262
		$date = date( 'Y-m-d H:i:s' );
263
		$columns = $this->object()->getSaveAttributes();
264
265
		if( $id === null )
266
		{
267
			/** mshop/group/manager/insert/mysql
268
			 * Inserts a new group record into the database table
269
			 *
270
			 * @see mshop/group/manager/insert/ansi
271
			 */
272
273
			/** mshop/group/manager/insert/ansi
274
			 * Inserts a new group record into the database table
275
			 *
276
			 * Items with no ID yet (i.e. the ID is NULL) will be created in
277
			 * the database and the newly created ID retrieved afterwards
278
			 * using the "newid" SQL statement.
279
			 *
280
			 * The SQL statement must be a string suitable for being used as
281
			 * prepared statement. It must include question marks for binding
282
			 * the values from the group item to the statement before
283
			 * they are sent to the database server. The number of question
284
			 * marks must be the same as the number of columns listed in the
285
			 * INSERT statement. The order of the columns must correspond to
286
			 * the order in the save() method, so the correct values are
287
			 * bound to the columns.
288
			 *
289
			 * The SQL statement should conform to the ANSI standard to be
290
			 * compatible with most relational database systems. This also
291
			 * includes using double quotes for table and column names.
292
			 *
293
			 * @param string SQL statement for inserting records
294
			 * @since 2015.08
295
			 * @category Developer
296
			 * @see mshop/group/manager/update/ansi
297
			 * @see mshop/group/manager/newid/ansi
298
			 * @see mshop/group/manager/delete/ansi
299
			 * @see mshop/group/manager/search/ansi
300
			 * @see mshop/group/manager/count/ansi
301
			 */
302
			$path = 'mshop/group/manager/insert';
303
			$sql = $this->addSqlColumns( array_keys( $columns ), $this->getSqlConfig( $path ) );
0 ignored issues
show
Bug introduced by
It seems like $this->getSqlConfig($path) can also be of type array; however, parameter $sql of Aimeos\MShop\Common\Manager\Base::addSqlColumns() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

303
			$sql = $this->addSqlColumns( array_keys( $columns ), /** @scrutinizer ignore-type */ $this->getSqlConfig( $path ) );
Loading history...
304
		}
305
		else
306
		{
307
			/** mshop/group/manager/update/mysql
308
			 * Updates an existing group record in the database
309
			 *
310
			 * @see mshop/group/manager/update/ansi
311
			 */
312
313
			/** mshop/group/manager/update/ansi
314
			 * Updates an existing group record in the database
315
			 *
316
			 * Items which already have an ID (i.e. the ID is not NULL) will
317
			 * be updated in the database.
318
			 *
319
			 * The SQL statement must be a string suitable for being used as
320
			 * prepared statement. It must include question marks for binding
321
			 * the values from the group item to the statement before
322
			 * they are sent to the database server. The order of the columns
323
			 * must correspond to the order in the save() method, so the
324
			 * correct values are bound to the columns.
325
			 *
326
			 * The SQL statement should conform to the ANSI standard to be
327
			 * compatible with most relational database systems. This also
328
			 * includes using double quotes for table and column names.
329
			 *
330
			 * @param string SQL statement for updating records
331
			 * @since 2015.08
332
			 * @category Developer
333
			 * @see mshop/group/manager/insert/ansi
334
			 * @see mshop/group/manager/newid/ansi
335
			 * @see mshop/group/manager/delete/ansi
336
			 * @see mshop/group/manager/search/ansi
337
			 * @see mshop/group/manager/count/ansi
338
			 */
339
			$path = 'mshop/group/manager/update';
340
			$sql = $this->addSqlColumns( array_keys( $columns ), $this->getSqlConfig( $path ), false );
341
		}
342
343
		$idx = 1;
344
		$stmt = $this->getCachedStatement( $conn, $path, $sql );
345
346
		foreach( $columns as $name => $entry ) {
347
			$stmt->bind( $idx++, $item->get( $name ), \Aimeos\Base\Criteria\SQL::type( $entry->getType() ) );
348
		}
349
350
		$stmt->bind( $idx++, $item->getCode() );
351
		$stmt->bind( $idx++, $item->getLabel() );
352
		$stmt->bind( $idx++, $date ); // mtime
353
		$stmt->bind( $idx++, $context->editor() );
354
355
		if( $id !== null ) {
356
			$stmt->bind( $idx++, $context->locale()->getSiteId() . '%' );
357
			$stmt->bind( $idx++, $id, \Aimeos\Base\DB\Statement\Base::PARAM_INT );
358
		} else {
359
			$stmt->bind( $idx++, $this->siteId( $item->getSiteId(), \Aimeos\MShop\Locale\Manager\Base::SITE_SUBTREE ) );
360
			$stmt->bind( $idx++, $date ); // ctime
361
		}
362
363
		$stmt->execute()->finish();
364
365
		if( $id === null && $fetch === true )
366
		{
367
			/** mshop/group/manager/newid/mysql
368
			 * Retrieves the ID generated by the database when inserting a new record
369
			 *
370
			 * @see mshop/group/manager/newid/ansi
371
			 */
372
373
			/** mshop/group/manager/newid/ansi
374
			 * Retrieves the ID generated by the database when inserting a new record
375
			 *
376
			 * As soon as a new record is inserted into the database table,
377
			 * the database server generates a new and unique identifier for
378
			 * that record. This ID can be used for retrieving, updating and
379
			 * deleting that specific record from the table again.
380
			 *
381
			 * For MySQL:
382
			 *  SELECT LAST_INSERT_ID()
383
			 * For PostgreSQL:
384
			 *  SELECT currval('seq_mcus_id')
385
			 * For SQL Server:
386
			 *  SELECT SCOPE_IDENTITY()
387
			 * For Oracle:
388
			 *  SELECT "seq_mcus_id".CURRVAL FROM DUAL
389
			 *
390
			 * There's no way to retrive the new ID by a SQL statements that
391
			 * fits for most database servers as they implement their own
392
			 * specific way.
393
			 *
394
			 * @param string SQL statement for retrieving the last inserted record ID
395
			 * @since 2015.08
396
			 * @category Developer
397
			 * @see mshop/group/manager/insert/ansi
398
			 * @see mshop/group/manager/update/ansi
399
			 * @see mshop/group/manager/delete/ansi
400
			 * @see mshop/group/manager/search/ansi
401
			 * @see mshop/group/manager/count/ansi
402
			 */
403
			$path = 'mshop/group/manager/newid';
404
			$id = $this->newId( $conn, $path );
405
		}
406
407
		return $item->setId( $id );
408
	}
409
410
411
	/**
412
	 * Returns the item objects matched by the given search criteria.
413
	 *
414
	 * @param \Aimeos\Base\Criteria\Iface $search Search criteria object
415
	 * @param string[] $ref List of domains to fetch list items and referenced items for
416
	 * @param int|null &$total Number of items that are available in total
417
	 * @return \Aimeos\Map List of items implementing \Aimeos\MShop\Group\Item\Iface with ids as keys
418
	 */
419
	public function search( \Aimeos\Base\Criteria\Iface $search, array $ref = [], int &$total = null ) : \Aimeos\Map
420
	{
421
		$items = [];
422
		$context = $this->context();
423
		$conn = $context->db( $this->getResourceName() );
424
425
			$required = array( 'group' );
426
			$level = \Aimeos\MShop\Locale\Manager\Base::SITE_ALL;
427
428
			/** mshop/group/manager/search/mysql
429
			 * Retrieves the records matched by the given criteria in the database
430
			 *
431
			 * @see mshop/group/manager/search/ansi
432
			 */
433
434
			/** mshop/group/manager/search/ansi
435
			 * Retrieves the records matched by the given criteria in the database
436
			 *
437
			 * Fetches the records matched by the given criteria from the group
438
			 * database. The records must be from one of the sites that are
439
			 * configured via the context item. If the current site is part of
440
			 * a tree of sites, the SELECT statement can retrieve all records
441
			 * from the current site and the complete sub-tree of sites.
442
			 *
443
			 * As the records can normally be limited by criteria from sub-managers,
444
			 * their tables must be joined in the SQL context. This is done by
445
			 * using the "internaldeps" property from the definition of the ID
446
			 * column of the sub-managers. These internal dependencies specify
447
			 * the JOIN between the tables and the used columns for joining. The
448
			 * ":joins" placeholder is then replaced by the JOIN strings from
449
			 * the sub-managers.
450
			 *
451
			 * To limit the records matched, conditions can be added to the given
452
			 * criteria object. It can contain comparisons like column names that
453
			 * must match specific values which can be combined by AND, OR or NOT
454
			 * operators. The resulting string of SQL conditions replaces the
455
			 * ":cond" placeholder before the statement is sent to the database
456
			 * server.
457
			 *
458
			 * If the records that are retrieved should be ordered by one or more
459
			 * columns, the generated string of column / sort direction pairs
460
			 * replaces the ":order" placeholder. In case no ordering is required,
461
			 * the complete ORDER BY part including the "\/*-orderby*\/...\/*orderby-*\/"
462
			 * markers is removed to speed up retrieving the records. Columns of
463
			 * sub-managers can also be used for ordering the result set but then
464
			 * no index can be used.
465
			 *
466
			 * The number of returned records can be limited and can start at any
467
			 * number between the begining and the end of the result set. For that
468
			 * the ":size" and ":start" placeholders are replaced by the
469
			 * corresponding values from the criteria object. The default values
470
			 * are 0 for the start and 100 for the size value.
471
			 *
472
			 * The SQL statement should conform to the ANSI standard to be
473
			 * compatible with most relational database systems. This also
474
			 * includes using double quotes for table and column names.
475
			 *
476
			 * @param string SQL statement for searching items
477
			 * @since 2015.08
478
			 * @category Developer
479
			 * @see mshop/group/manager/insert/ansi
480
			 * @see mshop/group/manager/update/ansi
481
			 * @see mshop/group/manager/newid/ansi
482
			 * @see mshop/group/manager/delete/ansi
483
			 * @see mshop/group/manager/count/ansi
484
			 */
485
			$cfgPathSearch = 'mshop/group/manager/search';
486
487
			/** mshop/group/manager/count/mysql
488
			 * Counts the number of records matched by the given criteria in the database
489
			 *
490
			 * @see mshop/group/manager/count/ansi
491
			 */
492
493
			/** mshop/group/manager/count/ansi
494
			 * Counts the number of records matched by the given criteria in the database
495
			 *
496
			 * Counts all records matched by the given criteria from the group
497
			 * database. The records must be from one of the sites that are
498
			 * configured via the context item. If the current site is part of
499
			 * a tree of sites, the statement can count all records from the
500
			 * current site and the complete sub-tree of sites.
501
			 *
502
			 * As the records can normally be limited by criteria from sub-managers,
503
			 * their tables must be joined in the SQL context. This is done by
504
			 * using the "internaldeps" property from the definition of the ID
505
			 * column of the sub-managers. These internal dependencies specify
506
			 * the JOIN between the tables and the used columns for joining. The
507
			 * ":joins" placeholder is then replaced by the JOIN strings from
508
			 * the sub-managers.
509
			 *
510
			 * To limit the records matched, conditions can be added to the given
511
			 * criteria object. It can contain comparisons like column names that
512
			 * must match specific values which can be combined by AND, OR or NOT
513
			 * operators. The resulting string of SQL conditions replaces the
514
			 * ":cond" placeholder before the statement is sent to the database
515
			 * server.
516
			 *
517
			 * Both, the strings for ":joins" and for ":cond" are the same as for
518
			 * the "search" SQL statement.
519
			 *
520
			 * Contrary to the "search" statement, it doesn't return any records
521
			 * but instead the number of records that have been found. As counting
522
			 * thousands of records can be a long running task, the maximum number
523
			 * of counted records is limited for performance reasons.
524
			 *
525
			 * The SQL statement should conform to the ANSI standard to be
526
			 * compatible with most relational database systems. This also
527
			 * includes using double quotes for table and column names.
528
			 *
529
			 * @param string SQL statement for counting items
530
			 * @since 2015.08
531
			 * @category Developer
532
			 * @see mshop/group/manager/insert/ansi
533
			 * @see mshop/group/manager/update/ansi
534
			 * @see mshop/group/manager/newid/ansi
535
			 * @see mshop/group/manager/delete/ansi
536
			 * @see mshop/group/manager/search/ansi
537
			 */
538
			$cfgPathCount = 'mshop/group/manager/count';
539
540
			$results = $this->searchItemsBase( $conn, $search, $cfgPathSearch, $cfgPathCount, $required, $total, $level );
541
542
			while( ( $row = $results->fetch() ) !== null )
543
			{
544
				if( $item = $this->applyFilter( $this->createItemBase( $row ) ) ) {
545
					$items[$row['group.id']] = $item;
546
				}
547
			}
548
549
		return map( $items );
550
	}
551
552
553
	/**
554
	 * Returns a new manager for group extensions
555
	 *
556
	 * @param string $manager Name of the sub manager type in lower case
557
	 * @param string|null $name Name of the implementation, will be from configuration (or Default) if null
558
	 * @return \Aimeos\MShop\Common\Manager\Iface Manager for different extensions
559
	 */
560
	public function getSubManager( string $manager, string $name = null ) : \Aimeos\MShop\Common\Manager\Iface
561
	{
562
		/** mshop/group/manager/name
563
		 * Class name of the used group manager implementation
564
		 *
565
		 * Each default group manager can be replaced by an alternative
566
		 * imlementation. To use this implementation, you have to set the last
567
		 * part of the class name as configuration value so the manager factory
568
		 * knows which class it has to instantiate.
569
		 *
570
		 * For example, if the name of the default class is
571
		 *
572
		 *  \Aimeos\MShop\Group\Manager\Standard
573
		 *
574
		 * and you want to replace it with your own version named
575
		 *
576
		 *  \Aimeos\MShop\Group\Manager\Mygroup
577
		 *
578
		 * then you have to set the this configuration option:
579
		 *
580
		 *  mshop/group/manager/name = Mygroup
581
		 *
582
		 * The value is the last part of your own class name and it's case sensitive,
583
		 * so take care that the configuration value is exactly named like the last
584
		 * part of the class name.
585
		 *
586
		 * The allowed characters of the class name are A-Z, a-z and 0-9. No other
587
		 * characters are possible! You should always start the last part of the class
588
		 * name with an upper case character and continue only with lower case characters
589
		 * or numbers. Avoid chamel case names like "MyGroup"!
590
		 *
591
		 * @param string Last part of the class name
592
		 * @since 2015.08
593
		 * @category Developer
594
		 */
595
596
		/** mshop/group/manager/decorators/excludes
597
		 * Excludes decorators added by the "common" option from the group manager
598
		 *
599
		 * Decorators extend the functionality of a class by adding new aspects
600
		 * (e.g. log what is currently done), executing the methods of the underlying
601
		 * class only in certain conditions (e.g. only for logged in users) or
602
		 * modify what is returned to the caller.
603
		 *
604
		 * This option allows you to remove a decorator added via
605
		 * "mshop/common/manager/decorators/default" before they are wrapped
606
		 * around the group manager.
607
		 *
608
		 *  mshop/group/manager/decorators/excludes = array( 'decorator1' )
609
		 *
610
		 * This would remove the decorator named "decorator1" from the list of
611
		 * common decorators ("\Aimeos\MShop\Common\Manager\Decorator\*") added via
612
		 * "mshop/common/manager/decorators/default" for the group manager.
613
		 *
614
		 * @param array List of decorator names
615
		 * @since 2015.08
616
		 * @category Developer
617
		 * @see mshop/common/manager/decorators/default
618
		 * @see mshop/group/manager/decorators/global
619
		 * @see mshop/group/manager/decorators/local
620
		 */
621
622
		/** mshop/group/manager/decorators/global
623
		 * Adds a list of globally available decorators only to the group manager
624
		 *
625
		 * Decorators extend the functionality of a class by adding new aspects
626
		 * (e.g. log what is currently done), executing the methods of the underlying
627
		 * class only in certain conditions (e.g. only for logged in users) or
628
		 * modify what is returned to the caller.
629
		 *
630
		 * This option allows you to wrap global decorators
631
		 * ("\Aimeos\MShop\Common\Manager\Decorator\*") around the group manager.
632
		 *
633
		 *  mshop/group/manager/decorators/global = array( 'decorator1' )
634
		 *
635
		 * This would add the decorator named "decorator1" defined by
636
		 * "\Aimeos\MShop\Common\Manager\Decorator\Decorator1" only to the group
637
		 * group manager.
638
		 *
639
		 * @param array List of decorator names
640
		 * @since 2015.08
641
		 * @category Developer
642
		 * @see mshop/common/manager/decorators/default
643
		 * @see mshop/group/manager/decorators/excludes
644
		 * @see mshop/group/manager/decorators/local
645
		 */
646
647
		/** mshop/group/manager/decorators/local
648
		 * Adds a list of local decorators only to the group manager
649
		 *
650
		 * Decorators extend the functionality of a class by adding new aspects
651
		 * (e.g. log what is currently done), executing the methods of the underlying
652
		 * class only in certain conditions (e.g. only for logged in users) or
653
		 * modify what is returned to the caller.
654
		 *
655
		 * This option allows you to wrap local decorators
656
		 * ("\Aimeos\MShop\Group\Manager\Decorator\*") around the group
657
		 * group manager.
658
		 *
659
		 *  mshop/group/manager/decorators/local = array( 'decorator2' )
660
		 *
661
		 * This would add the decorator named "decorator2" defined by
662
		 * "\Aimeos\MShop\Group\Manager\Decorator\Decorator2" only to the
663
		 * group manager.
664
		 *
665
		 * @param array List of decorator names
666
		 * @since 2015.08
667
		 * @category Developer
668
		 * @see mshop/common/manager/decorators/default
669
		 * @see mshop/group/manager/decorators/excludes
670
		 * @see mshop/group/manager/decorators/global
671
		 */
672
673
		return $this->getSubManagerBase( 'group', $manager, $name );
674
	}
675
676
677
	/**
678
	 * Creates a new group item
679
	 *
680
	 * @param array $values List of attributes for group item
681
	 * @return \Aimeos\MShop\Group\Item\Iface New group item
682
	 */
683
	protected function createItemBase( array $values = [] ) : \Aimeos\MShop\Group\Item\Iface
684
	{
685
		return new \Aimeos\MShop\Group\Item\Standard( $values );
686
	}
687
}
688