Passed
Push — master ( 3bf164...51d5ad )
by Aimeos
04:31
created

Standard::prefix()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
/**
4
 * @license LGPLv3, https://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2018-2024
6
 * @package MShop
7
 * @subpackage Subscription
8
 */
9
10
11
namespace Aimeos\MShop\Subscription\Manager;
12
13
14
/**
15
 * Default subscription manager implementation
16
 *
17
 * @package MShop
18
 * @subpackage Subscription
19
 */
20
class Standard
21
	extends \Aimeos\MShop\Common\Manager\Base
22
	implements \Aimeos\MShop\Subscription\Manager\Iface, \Aimeos\MShop\Common\Manager\Factory\Iface
23
{
24
	private array $searchConfig = [
25
		'subscription.orderid' => [
26
			'label' => 'Order ID',
27
			'internalcode' => 'orderid',
28
			'type' => 'int',
29
			'public' => false,
30
		],
31
		'subscription.ordprodid' => [
32
			'label' => 'Order product ID',
33
			'internalcode' => 'ordprodid',
34
			'type' => 'int',
35
			'public' => false,
36
		],
37
		'subscription.datenext' => [
38
			'label' => 'Next renewal date/time',
39
			'internalcode' => 'next',
40
			'type' => 'datetime',
41
		],
42
		'subscription.dateend' => [
43
			'label' => 'End of subscription',
44
			'internalcode' => 'end',
45
			'type' => 'datetime',
46
		],
47
		'subscription.interval' => [
48
			'label' => 'Renewal interval',
49
			'internalcode' => 'interval',
50
		],
51
		'subscription.reason' => [
52
			'label' => 'Subscription end reason',
53
			'internalcode' => 'reason',
54
			'type' => 'int',
55
		],
56
		'subscription.period' => [
57
			'label' => 'Subscription period count',
58
			'internalcode' => 'period',
59
			'type' => 'int',
60
		],
61
		'subscription.productid' => [
62
			'label' => 'Subscription product ID',
63
			'internalcode' => 'productid',
64
		],
65
		'subscription.status' => [
66
			'label' => 'Subscription status',
67
			'internalcode' => 'status',
68
			'type' => 'int',
69
		],
70
	];
71
72
73
	/**
74
	 * Creates the manager that will use the given context object.
75
	 *
76
	 * @param \Aimeos\MShop\ContextIface $context Context object with required objects
77
	 */
78
	public function __construct( \Aimeos\MShop\ContextIface $context )
79
	{
80
		parent::__construct( $context );
81
82
		/** mshop/subscription/manager/resource
83
		 * Name of the database connection resource to use
84
		 *
85
		 * You can configure a different database connection for each data domain
86
		 * and if no such connection name exists, the "db" connection will be used.
87
		 * It's also possible to use the same database connection for different
88
		 * data domains by configuring the same connection name using this setting.
89
		 *
90
		 * @param string Database connection name
91
		 * @since 2023.04
92
		 */
93
		$this->setResourceName( $context->config()->get( 'mshop/subscription/manager/resource', 'db-order' ) );
94
	}
95
96
97
	/**
98
	 * Counts the number items that are available for the values of the given key.
99
	 *
100
	 * @param \Aimeos\Base\Criteria\Iface $search Search criteria
101
	 * @param array|string $key Search key or list of keys to aggregate items for
102
	 * @param string|null $value Search key for aggregating the value column
103
	 * @param string|null $type Type of the aggregation, empty string for count or "sum" or "avg" (average)
104
	 * @return \Aimeos\Map List of the search keys as key and the number of counted items as value
105
	 */
106
	public function aggregate( \Aimeos\Base\Criteria\Iface $search, $key, string $value = null, string $type = null ) : \Aimeos\Map
107
	{
108
		/** mshop/subscription/manager/aggregate/mysql
109
		 * Counts the number of records grouped by the values in the key column and matched by the given criteria
110
		 *
111
		 * @see mshop/subscription/manager/aggregate/ansi
112
		 */
113
114
		/** mshop/subscription/manager/aggregate/ansi
115
		 * Counts the number of records grouped by the values in the key column and matched by the given criteria
116
		 *
117
		 * Groups all records by the values in the key column and counts their
118
		 * occurence. The matched records can be limited by the given criteria
119
		 * from the subscription database. The records must be from one of the sites
120
		 * that are configured via the context item. If the current site is part
121
		 * of a tree of sites, the statement can count all records from the
122
		 * current site and the complete sub-tree of sites.
123
		 *
124
		 * As the records can normally be limited by criteria from sub-managers,
125
		 * their tables must be joined in the SQL context. This is done by
126
		 * using the "internaldeps" property from the definition of the ID
127
		 * column of the sub-managers. These internal dependencies specify
128
		 * the JOIN between the tables and the used columns for joining. The
129
		 * ":joins" placeholder is then replaced by the JOIN strings from
130
		 * the sub-managers.
131
		 *
132
		 * To limit the records matched, conditions can be added to the given
133
		 * criteria object. It can contain comparisons like column names that
134
		 * must match specific values which can be combined by AND, OR or NOT
135
		 * operators. The resulting string of SQL conditions replaces the
136
		 * ":cond" placeholder before the statement is sent to the database
137
		 * server.
138
		 *
139
		 * This statement doesn't return any records. Instead, it returns pairs
140
		 * of the different values found in the key column together with the
141
		 * number of records that have been found for that key values.
142
		 *
143
		 * The SQL statement should conform to the ANSI standard to be
144
		 * compatible with most relational database systems. This also
145
		 * includes using double quotes for table and column names.
146
		 *
147
		 * @param string SQL statement for aggregating subscription items
148
		 * @since 2018.04
149
		 * @see mshop/subscription/manager/insert/ansi
150
		 * @see mshop/subscription/manager/update/ansi
151
		 * @see mshop/subscription/manager/newid/ansi
152
		 * @see mshop/subscription/manager/delete/ansi
153
		 * @see mshop/subscription/manager/search/ansi
154
		 * @see mshop/subscription/manager/count/ansi
155
		 */
156
157
		$cfgkey = 'mshop/subscription/manager/aggregate';
158
		return $this->aggregateBase( $search, $key, $cfgkey, ['subscription'], $value, $type );
159
	}
160
161
162
	/**
163
	 * Creates a new empty item instance
164
	 *
165
	 * @param array $values Values the item should be initialized with
166
	 * @return \Aimeos\MShop\Subscription\Item\Iface New subscription item object
167
	 */
168
	public function create( array $values = [] ) : \Aimeos\MShop\Common\Item\Iface
169
	{
170
		$values['subscription.siteid'] = $values['subscription.siteid'] ?? $this->context()->locale()->getSiteId();
171
		return new \Aimeos\MShop\Subscription\Item\Standard( 'subscription.', $values );
172
	}
173
174
175
	/**
176
	 * Creates a filter object.
177
	 *
178
	 * @param bool|null $default Add default criteria or NULL for relaxed default criteria
179
	 * @param bool $site TRUE for adding site criteria to limit items by the site of related items
180
	 * @return \Aimeos\Base\Criteria\Iface Returns the filter object
181
	 */
182
	public function filter( ?bool $default = false, bool $site = false ) : \Aimeos\Base\Criteria\Iface
183
	{
184
		$filter = $this->filterBase( 'subscription', $default );
185
186
		if( $site )
187
		{
188
			$level = \Aimeos\MShop\Locale\Manager\Base::SITE_ALL;
189
			$filter->add( $this->siteCondition( 'order.product.siteid', $level ) );
190
		}
191
192
		return $filter;
193
	}
194
195
196
	/**
197
	 * Returns the additional column/search definitions
198
	 *
199
	 * @return array Associative list of column names as keys and items implementing \Aimeos\Base\Criteria\Attribute\Iface
200
	 */
201
	public function getSaveAttributes() : array
202
	{
203
		return $this->createAttributes( $this->searchConfig );
204
	}
205
206
207
	/**
208
	 * Returns the attributes that can be used for searching.
209
	 *
210
	 * @param bool $withsub Return also attributes of sub-managers if true
211
	 * @return \Aimeos\Base\Criteria\Attribute\Iface[] List of search attribute items
212
	 */
213
	public function getSearchAttributes( bool $withsub = true ) : array
214
	{
215
		$list = parent::getSearchAttributes( $withsub );
216
217
		if( $withsub ) {
218
			$list += \Aimeos\MShop::create( $this->context(), 'order' )->getSearchAttributes( $withsub );
219
		}
220
221
		return $list;
222
	}
223
224
225
	/**
226
	 * Searches for subscriptions based on the given criteria.
227
	 *
228
	 * @param \Aimeos\Base\Criteria\Iface $search Search criteria object
229
	 * @param string[] $ref List of domains to fetch list items and referenced items for
230
	 * @param int|null &$total Number of items that are available in total
231
	 * @return \Aimeos\Map List of items implementing \Aimeos\MShop\Subscription\Item\Iface with ids as keys
232
	 */
233
	public function search( \Aimeos\Base\Criteria\Iface $search, array $ref = [], int &$total = null ) : \Aimeos\Map
234
	{
235
		$context = $this->context();
236
237
		/** mshop/subscription/manager/sitemode
238
		 * Mode how items from levels below or above in the site tree are handled
239
		 *
240
		 * By default, only items from the current site are fetched from the
241
		 * storage. If the ai-sites extension is installed, you can create a
242
		 * tree of sites. Then, this setting allows you to define for the
243
		 * whole subscription domain if items from parent sites are inherited,
244
		 * sites from child sites are aggregated or both.
245
		 *
246
		 * Available constants for the site mode are:
247
		 * * 0 = only items from the current site
248
		 * * 1 = inherit items from parent sites
249
		 * * 2 = aggregate items from child sites
250
		 * * 3 = inherit and aggregate items at the same time
251
		 *
252
		 * You also need to set the mode in the locale manager
253
		 * (mshop/locale/manager/sitelevel) to one of the constants.
254
		 * If you set it to the same value, it will work as described but you
255
		 * can also use different modes. For example, if inheritance and
256
		 * aggregation is configured the locale manager but only inheritance
257
		 * in the domain manager because aggregating items makes no sense in
258
		 * this domain, then items wil be only inherited. Thus, you have full
259
		 * control over inheritance and aggregation in each domain.
260
		 *
261
		 * @param int Constant from Aimeos\MShop\Locale\Manager\Base class
262
		 * @since 2018.04
263
		 * @see mshop/locale/manager/sitelevel
264
		 */
265
		$level = \Aimeos\MShop\Locale\Manager\Base::SITE_SUBTREE;
266
		$level = $context->config()->get( 'mshop/subscription/manager/sitemode', $level );
267
268
		/** mshop/subscription/manager/search/mysql
269
		 * Retrieves the records matched by the given criteria in the database
270
		 *
271
		 * @see mshop/subscription/manager/search/ansi
272
		 */
273
274
		/** mshop/subscription/manager/search/ansi
275
		 * Retrieves the records matched by the given criteria in the database
276
		 *
277
		 * Fetches the records matched by the given criteria from the subscription
278
		 * database. The records must be from one of the sites that are
279
		 * configured via the context item. If the current site is part of
280
		 * a tree of sites, the SELECT statement can retrieve all records
281
		 * from the current site and the complete sub-tree of sites.
282
		 *
283
		 * As the records can normally be limited by criteria from sub-managers,
284
		 * their tables must be joined in the SQL context. This is done by
285
		 * using the "internaldeps" property from the definition of the ID
286
		 * column of the sub-managers. These internal dependencies specify
287
		 * the JOIN between the tables and the used columns for joining. The
288
		 * ":joins" placeholder is then replaced by the JOIN strings from
289
		 * the sub-managers.
290
		 *
291
		 * To limit the records matched, conditions can be added to the given
292
		 * criteria object. It can contain comparisons like column names that
293
		 * must match specific values which can be combined by AND, OR or NOT
294
		 * operators. The resulting string of SQL conditions replaces the
295
		 * ":cond" placeholder before the statement is sent to the database
296
		 * server.
297
		 *
298
		 * If the records that are retrieved should be subscriptioned by one or more
299
		 * columns, the generated string of column / sort direction pairs
300
		 * replaces the ":subscription" placeholder. In case no subscriptioning is required,
301
		 * the complete ORDER BY part including the "\/*-subscriptionby*\/...\/*subscriptionby-*\/"
302
		 * markers is removed to speed up retrieving the records. Columns of
303
		 * sub-managers can also be used for subscriptioning the result set but then
304
		 * no index can be used.
305
		 *
306
		 * The number of returned records can be limited and can start at any
307
		 * number between the begining and the end of the result set. For that
308
		 * the ":size" and ":start" placeholders are replaced by the
309
		 * corresponding values from the criteria object. The default values
310
		 * are 0 for the start and 100 for the size value.
311
		 *
312
		 * The SQL statement should conform to the ANSI standard to be
313
		 * compatible with most relational database systems. This also
314
		 * includes using double quotes for table and column names.
315
		 *
316
		 * @param string SQL statement for searching items
317
		 * @since 2018.04
318
		 * @see mshop/subscription/manager/insert/ansi
319
		 * @see mshop/subscription/manager/update/ansi
320
		 * @see mshop/subscription/manager/newid/ansi
321
		 * @see mshop/subscription/manager/delete/ansi
322
		 * @see mshop/subscription/manager/count/ansi
323
		 */
324
		$cfgPathSearch = 'mshop/subscription/manager/search';
325
326
		/** mshop/subscription/manager/count/mysql
327
		 * Counts the number of records matched by the given criteria in the database
328
		 *
329
		 * @see mshop/subscription/manager/count/ansi
330
		 */
331
332
		/** mshop/subscription/manager/count/ansi
333
		 * Counts the number of records matched by the given criteria in the database
334
		 *
335
		 * Counts all records matched by the given criteria from the subscription
336
		 * database. The records must be from one of the sites that are
337
		 * configured via the context item. If the current site is part of
338
		 * a tree of sites, the statement can count all records from the
339
		 * current site and the complete sub-tree of sites.
340
		 *
341
		 * As the records can normally be limited by criteria from sub-managers,
342
		 * their tables must be joined in the SQL context. This is done by
343
		 * using the "internaldeps" property from the definition of the ID
344
		 * column of the sub-managers. These internal dependencies specify
345
		 * the JOIN between the tables and the used columns for joining. The
346
		 * ":joins" placeholder is then replaced by the JOIN strings from
347
		 * the sub-managers.
348
		 *
349
		 * To limit the records matched, conditions can be added to the given
350
		 * criteria object. It can contain comparisons like column names that
351
		 * must match specific values which can be combined by AND, OR or NOT
352
		 * operators. The resulting string of SQL conditions replaces the
353
		 * ":cond" placeholder before the statement is sent to the database
354
		 * server.
355
		 *
356
		 * Both, the strings for ":joins" and for ":cond" are the same as for
357
		 * the "search" SQL statement.
358
		 *
359
		 * Contrary to the "search" statement, it doesn't return any records
360
		 * but instead the number of records that have been found. As counting
361
		 * thousands of records can be a long running task, the maximum number
362
		 * of counted records is limited for performance reasons.
363
		 *
364
		 * The SQL statement should conform to the ANSI standard to be
365
		 * compatible with most relational database systems. This also
366
		 * includes using double quotes for table and column names.
367
		 *
368
		 * @param string SQL statement for counting items
369
		 * @since 2018.04
370
		 * @see mshop/subscription/manager/insert/ansi
371
		 * @see mshop/subscription/manager/update/ansi
372
		 * @see mshop/subscription/manager/newid/ansi
373
		 * @see mshop/subscription/manager/delete/ansi
374
		 * @see mshop/subscription/manager/search/ansi
375
		 */
376
		$cfgPathCount = 'mshop/subscription/manager/count';
377
378
		$items = [];
379
		$required = ['subscription', 'order'];
380
		$conn = $context->db( $this->getResourceName() );
381
		$results = $this->searchItemsBase( $conn, $search, $cfgPathSearch, $cfgPathCount, $required, $total, $level );
382
383
		try
384
		{
385
			while( $row = $results->fetch() )
386
			{
387
				if( $item = $this->applyFilter( $this->create( $row ) ) ) {
388
					$items[$row['subscription.id']] = $item;
389
				}
390
			}
391
		}
392
		catch( \Exception $e )
393
		{
394
			$results->finish();
395
			throw $e;
396
		}
397
398
399
		if( in_array( 'order', $ref ) )
400
		{
401
			$ids = array_column( $items, 'subscription.orderid' );
402
			$manager = \Aimeos\MShop::create( $context, 'order' );
403
			$search = $manager->filter()->add( 'order.id', '==', $ids )->slice( 0, count( $ids ) );
404
			$orderItems = $manager->search( $search, $ref );
405
406
			foreach( $items as $item ) {
407
				$item->set( '.orderitem', $orderItems[$item['subscription.orderid']] ?? null );
408
			}
409
		}
410
411
		return map( $items );
412
	}
413
414
415
	/**
416
	 * Returns the prefix for the item properties and search keys.
417
	 *
418
	 * @return string Prefix for the item properties and search keys
419
	 */
420
	protected function prefix() : string
421
	{
422
		return 'subscription.';
423
	}
424
425
426
	/**
427
	 * Creates a one-time subscription in the storage from the given invoice object.
428
	 *
429
	 * @param \Aimeos\MShop\Common\Item\Iface $item Subscription item with necessary values
430
	 * @param bool $fetch True if the new ID should be returned in the item
431
	 * @return \Aimeos\MShop\Subscription\Item\Iface Updated item including the generated ID
432
	 */
433
	protected function saveBase( \Aimeos\MShop\Common\Item\Iface $item, bool $fetch = true ) : \Aimeos\MShop\Subscription\Item\Iface
434
	{
435
		if( $item->getOrderProductId() === null ) {
436
			throw new \Aimeos\MShop\Subscription\Exception( 'Required order product ID is missing' );
437
		}
438
439
		if( $orderItem = $item->getOrderItem() ) {
440
			\Aimeos\MShop::create( $this->context(), 'order' )->save( $orderItem );
441
		}
442
443
		return parent::saveBase( $item, $fetch );
444
	}
445
446
447
	/** mshop/subscription/manager/name
448
	 * Class name of the used subscription manager implementation
449
	 *
450
	 * Each default manager can be replace by an alternative imlementation.
451
	 * To use this implementation, you have to set the last part of the class
452
	 * name as configuration value so the manager factory knows which class it
453
	 * has to instantiate.
454
	 *
455
	 * For example, if the name of the default class is
456
	 *
457
	 *  \Aimeos\MShop\Subscription\Manager\Standard
458
	 *
459
	 * and you want to replace it with your own version named
460
	 *
461
	 *  \Aimeos\MShop\Subscription\Manager\Mymanager
462
	 *
463
	 * then you have to set the this configuration option:
464
	 *
465
	 *  mshop/subscription/manager/name = Mymanager
466
	 *
467
	 * The value is the last part of your own class name and it's case sensitive,
468
	 * so take care that the configuration value is exactly named like the last
469
	 * part of the class name.
470
	 *
471
	 * The allowed characters of the class name are A-Z, a-z and 0-9. No other
472
	 * characters are possible! You should always start the last part of the class
473
	 * name with an upper case character and continue only with lower case characters
474
	 * or numbers. Avoid chamel case names like "MyManager"!
475
	 *
476
	 * @param string Last part of the class name
477
	 * @since 2018.04
478
	 */
479
480
	/** mshop/subscription/manager/decorators/excludes
481
	 * Excludes decorators added by the "common" option from the subscription manager
482
	 *
483
	 * Decorators extend the functionality of a class by adding new aspects
484
	 * (e.g. log what is currently done), executing the methods of the underlying
485
	 * class only in certain conditions (e.g. only for logged in users) or
486
	 * modify what is returned to the caller.
487
	 *
488
	 * This option allows you to remove a decorator added via
489
	 * "mshop/common/manager/decorators/default" before they are wrapped
490
	 * around the subscription manager.
491
	 *
492
	 *  mshop/subscription/manager/decorators/excludes = array( 'decorator1' )
493
	 *
494
	 * This would remove the decorator named "decorator1" from the list of
495
	 * common decorators ("\Aimeos\MShop\Common\Manager\Decorator\*") added via
496
	 * "mshop/common/manager/decorators/default" for the subscription manager.
497
	 *
498
	 * @param array List of decorator names
499
	 * @since 2018.04
500
	 * @see mshop/common/manager/decorators/default
501
	 * @see mshop/subscription/manager/decorators/global
502
	 * @see mshop/subscription/manager/decorators/local
503
	 */
504
505
	/** mshop/subscription/manager/decorators/global
506
	 * Adds a list of globally available decorators only to the subscription manager
507
	 *
508
	 * Decorators extend the functionality of a class by adding new aspects
509
	 * (e.g. log what is currently done), executing the methods of the underlying
510
	 * class only in certain conditions (e.g. only for logged in users) or
511
	 * modify what is returned to the caller.
512
	 *
513
	 * This option allows you to wrap global decorators
514
	 * ("\Aimeos\MShop\Common\Manager\Decorator\*") around the subscription manager.
515
	 *
516
	 *  mshop/subscription/manager/decorators/global = array( 'decorator1' )
517
	 *
518
	 * This would add the decorator named "decorator1" defined by
519
	 * "\Aimeos\MShop\Common\Manager\Decorator\Decorator1" only to the subscription
520
	 * manager.
521
	 *
522
	 * @param array List of decorator names
523
	 * @since 2018.04
524
	 * @see mshop/common/manager/decorators/default
525
	 * @see mshop/subscription/manager/decorators/excludes
526
	 * @see mshop/subscription/manager/decorators/local
527
	 */
528
529
	/** mshop/subscription/manager/decorators/local
530
	 * Adds a list of local decorators only to the subscription manager
531
	 *
532
	 * Decorators extend the functionality of a class by adding new aspects
533
	 * (e.g. log what is currently done), executing the methods of the underlying
534
	 * class only in certain conditions (e.g. only for logged in users) or
535
	 * modify what is returned to the caller.
536
	 *
537
	 * This option allows you to wrap local decorators
538
	 * ("\Aimeos\MShop\Subscription\Manager\Decorator\*") around the subscription manager.
539
	 *
540
	 *  mshop/subscription/manager/decorators/local = array( 'decorator2' )
541
	 *
542
	 * This would add the decorator named "decorator2" defined by
543
	 * "\Aimeos\MShop\Subscription\Manager\Decorator\Decorator2" only to the subscription
544
	 * manager.
545
	 *
546
	 * @param array List of decorator names
547
	 * @since 2018.04
548
	 * @see mshop/common/manager/decorators/default
549
	 * @see mshop/subscription/manager/decorators/excludes
550
	 * @see mshop/subscription/manager/decorators/global
551
	 */
552
553
	/** mshop/subscription/manager/delete/mysql
554
	 * Deletes the items matched by the given IDs from the database
555
	 *
556
	 * @see mshop/subscription/manager/delete/ansi
557
	 */
558
559
	/** mshop/subscription/manager/delete/ansi
560
	 * Deletes the items matched by the given IDs from the database
561
	 *
562
	 * Removes the records specified by the given IDs from the subscription database.
563
	 * The records must be from the site that is configured via the
564
	 * context item.
565
	 *
566
	 * The ":cond" placeholder is replaced by the name of the ID column and
567
	 * the given ID or list of IDs while the site ID is bound to the question
568
	 * mark.
569
	 *
570
	 * The SQL statement should conform to the ANSI standard to be
571
	 * compatible with most relational database systems. This also
572
	 * includes using double quotes for table and column names.
573
	 *
574
	 * @param string SQL statement for deleting items
575
	 * @since 2018.04
576
	 * @see mshop/subscription/manager/insert/ansi
577
	 * @see mshop/subscription/manager/update/ansi
578
	 * @see mshop/subscription/manager/newid/ansi
579
	 * @see mshop/subscription/manager/search/ansi
580
	 * @see mshop/subscription/manager/count/ansi
581
	 */
582
583
	 /** mshop/subscription/manager/submanagers
584
	 * List of manager names that can be instantiated by the subscription manager
585
	 *
586
	 * Managers provide a generic interface to the underlying storage.
587
	 * Each manager has or can have sub-managers caring about particular
588
	 * aspects. Each of these sub-managers can be instantiated by its
589
	 * parent manager using the getSubManager() method.
590
	 *
591
	 * The search keys from sub-managers can be normally used in the
592
	 * manager as well. It allows you to search for items of the manager
593
	 * using the search keys of the sub-managers to further limit the
594
	 * retrieved list of items.
595
	 *
596
	 * @param array List of sub-manager names
597
	 * @since 2018.04
598
	 */
599
600
	 /** mshop/subscription/manager/insert/mysql
601
	 * Inserts a new subscription record into the database table
602
	 *
603
	 * @see mshop/subscription/manager/insert/ansi
604
	 */
605
606
	/** mshop/subscription/manager/insert/ansi
607
	 * Inserts a new subscription record into the database table
608
	 *
609
	 * Items with no ID yet (i.e. the ID is NULL) will be created in
610
	 * the database and the newly created ID retrieved afterwards
611
	 * using the "newid" SQL statement.
612
	 *
613
	 * The SQL statement must be a string suitable for being used as
614
	 * prepared statement. It must include question marks for binding
615
	 * the values from the subscription item to the statement before they are
616
	 * sent to the database server. The number of question marks must
617
	 * be the same as the number of columns listed in the INSERT
618
	 * statement. The catalog of the columns must correspond to the
619
	 * catalog in the save() method, so the correct values are
620
	 * bound to the columns.
621
	 *
622
	 * The SQL statement should conform to the ANSI standard to be
623
	 * compatible with most relational database systems. This also
624
	 * includes using double quotes for table and column names.
625
	 *
626
	 * @param string SQL statement for inserting records
627
	 * @since 2018.04
628
	 * @see mshop/subscription/manager/update/ansi
629
	 * @see mshop/subscription/manager/newid/ansi
630
	 * @see mshop/subscription/manager/delete/ansi
631
	 * @see mshop/subscription/manager/search/ansi
632
	 * @see mshop/subscription/manager/count/ansi
633
	 */
634
635
	 /** mshop/subscription/manager/update/mysql
636
	 * Updates an existing subscription record in the database
637
	 *
638
	 * @see mshop/subscription/manager/update/ansi
639
	 */
640
641
	/** mshop/subscription/manager/update/ansi
642
	 * Updates an existing subscription record in the database
643
	 *
644
	 * Items which already have an ID (i.e. the ID is not NULL) will
645
	 * be updated in the database.
646
	 *
647
	 * The SQL statement must be a string suitable for being used as
648
	 * prepared statement. It must include question marks for binding
649
	 * the values from the subscription item to the statement before they are
650
	 * sent to the database server. The catalog of the columns must
651
	 * correspond to the catalog in the save() method, so the
652
	 * correct values are bound to the columns.
653
	 *
654
	 * The SQL statement should conform to the ANSI standard to be
655
	 * compatible with most relational database systems. This also
656
	 * includes using double quotes for table and column names.
657
	 *
658
	 * @param string SQL statement for updating records
659
	 * @since 2018.04
660
	 * @see mshop/subscription/manager/insert/ansi
661
	 * @see mshop/subscription/manager/newid/ansi
662
	 * @see mshop/subscription/manager/delete/ansi
663
	 * @see mshop/subscription/manager/search/ansi
664
	 * @see mshop/subscription/manager/count/ansi
665
	 */
666
667
	/** mshop/subscription/manager/newid/mysql
668
	 * Retrieves the ID generated by the database when inserting a new record
669
	 *
670
	 * @see mshop/subscription/manager/newid/ansi
671
	 */
672
673
	/** mshop/subscription/manager/newid/ansi
674
	 * Retrieves the ID generated by the database when inserting a new record
675
	 *
676
	 * As soon as a new record is inserted into the database table,
677
	 * the database server generates a new and unique identifier for
678
	 * that record. This ID can be used for retrieving, updating and
679
	 * deleting that specific record from the table again.
680
	 *
681
	 * For MySQL:
682
	 *  SELECT LAST_INSERT_ID()
683
	 * For PostgreSQL:
684
	 *  SELECT currval('seq_mrul_id')
685
	 * For SQL Server:
686
	 *  SELECT SCOPE_IDENTITY()
687
	 * For Oracle:
688
	 *  SELECT "seq_mrul_id".CURRVAL FROM DUAL
689
	 *
690
	 * There's no way to retrive the new ID by a SQL statements that
691
	 * fits for most database servers as they implement their own
692
	 * specific way.
693
	 *
694
	 * @param string SQL statement for retrieving the last inserted record ID
695
	 * @since 2018.04
696
	 * @see mshop/subscription/manager/insert/ansi
697
	 * @see mshop/subscription/manager/update/ansi
698
	 * @see mshop/subscription/manager/delete/ansi
699
	 * @see mshop/subscription/manager/search/ansi
700
	 * @see mshop/subscription/manager/count/ansi
701
	 */
702
}
703