• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

aimeos / aimeos-core / 4f8b7e8d-5595-43b2-ba5c-df9921830178

17 May 2026 07:32AM UTC coverage: 92.581%. Remained the same
4f8b7e8d-5595-43b2-ba5c-df9921830178

push

circleci

aimeos
Fixed PHPStan issues

896 of 980 new or added lines in 165 files covered. (91.43%)

35 existing lines in 29 files now uncovered.

9734 of 10514 relevant lines covered (92.58%)

80.53 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

88.89
/src/MShop/Subscription/Manager/Standard.php
1
<?php
2

3
/**
4
 * @license LGPLv3, https://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2018-2026
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 );
16✔
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
                 * @type string Database connection name
91
                 * @since 2023.04
92
                 */
93
                $this->setResourceName( (string) $context->config()->get( 'mshop/subscription/manager/resource', 'db-order' ) );
16✔
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
                 * @type 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';
1✔
158
                return $this->aggregateBase( $search, $key, $cfgkey, ['subscription'], $value, $type );
1✔
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();
6✔
171
                return new \Aimeos\MShop\Subscription\Item\Standard( 'subscription.', $values );
6✔
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 );
10✔
185

186
                if( $site )
10✔
187
                {
188
                        $level = \Aimeos\MShop\Locale\Manager\Base::SITE_ALL;
1✔
189
                        $filter->add( $this->siteCondition( 'order.product.siteid', $level ) );
1✔
190
                }
191

192
                return $filter;
10✔
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 );
6✔
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 );
6✔
216

217
                if( $withsub ) {
6✔
218
                        $list += \Aimeos\MShop::create( $this->context(), 'order' )->getSearchAttributes( $withsub );
6✔
219
                }
220

221
                return $list;
6✔
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
         * @type 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();
5✔
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
                 * @type 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;
5✔
266
                $level = (int) $context->config()->get( 'mshop/subscription/manager/sitemode', $level );
5✔
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 ordered by one or more
299
                 * columns, the generated string of column / sort direction pairs
300
                 * replaces the ":order" placeholder.
301
                 *
302
                 * The number of returned records can be limited and can start at any
303
                 * number between the begining and the end of the result set. For that
304
                 * the ":size" and ":start" placeholders are replaced by the
305
                 * corresponding values from the criteria object. The default values
306
                 * are 0 for the start and 100 for the size value.
307
                 *
308
                 * The SQL statement should conform to the ANSI standard to be
309
                 * compatible with most relational database systems. This also
310
                 * includes using double quotes for table and column names.
311
                 *
312
                 * @type string SQL statement for searching items
313
                 * @since 2018.04
314
                 * @see mshop/subscription/manager/insert/ansi
315
                 * @see mshop/subscription/manager/update/ansi
316
                 * @see mshop/subscription/manager/newid/ansi
317
                 * @see mshop/subscription/manager/delete/ansi
318
                 * @see mshop/subscription/manager/count/ansi
319
                 */
320
                $cfgPathSearch = 'mshop/subscription/manager/search';
5✔
321

322
                /** mshop/subscription/manager/count/mysql
323
                 * Counts the number of records matched by the given criteria in the database
324
                 *
325
                 * @see mshop/subscription/manager/count/ansi
326
                 */
327

328
                /** mshop/subscription/manager/count/ansi
329
                 * Counts the number of records matched by the given criteria in the database
330
                 *
331
                 * Counts all records matched by the given criteria from the subscription
332
                 * database. The records must be from one of the sites that are
333
                 * configured via the context item. If the current site is part of
334
                 * a tree of sites, the statement can count all records from the
335
                 * current site and the complete sub-tree of sites.
336
                 *
337
                 * As the records can normally be limited by criteria from sub-managers,
338
                 * their tables must be joined in the SQL context. This is done by
339
                 * using the "internaldeps" property from the definition of the ID
340
                 * column of the sub-managers. These internal dependencies specify
341
                 * the JOIN between the tables and the used columns for joining. The
342
                 * ":joins" placeholder is then replaced by the JOIN strings from
343
                 * the sub-managers.
344
                 *
345
                 * To limit the records matched, conditions can be added to the given
346
                 * criteria object. It can contain comparisons like column names that
347
                 * must match specific values which can be combined by AND, OR or NOT
348
                 * operators. The resulting string of SQL conditions replaces the
349
                 * ":cond" placeholder before the statement is sent to the database
350
                 * server.
351
                 *
352
                 * Both, the strings for ":joins" and for ":cond" are the same as for
353
                 * the "search" SQL statement.
354
                 *
355
                 * Contrary to the "search" statement, it doesn't return any records
356
                 * but instead the number of records that have been found. As counting
357
                 * thousands of records can be a long running task, the maximum number
358
                 * of counted records is limited for performance reasons.
359
                 *
360
                 * The SQL statement should conform to the ANSI standard to be
361
                 * compatible with most relational database systems. This also
362
                 * includes using double quotes for table and column names.
363
                 *
364
                 * @type string SQL statement for counting items
365
                 * @since 2018.04
366
                 * @see mshop/subscription/manager/insert/ansi
367
                 * @see mshop/subscription/manager/update/ansi
368
                 * @see mshop/subscription/manager/newid/ansi
369
                 * @see mshop/subscription/manager/delete/ansi
370
                 * @see mshop/subscription/manager/search/ansi
371
                 */
372
                $cfgPathCount = 'mshop/subscription/manager/count';
5✔
373

374
                $items = [];
5✔
375
                $required = ['subscription', 'order'];
5✔
376
                $conn = $context->db( $this->getResourceName() );
5✔
377
                $results = $this->searchItemsBase( $conn, $search, $cfgPathSearch, $cfgPathCount, $required, $total, $level );
5✔
378

379
                try
380
                {
381
                        while( $row = $results->fetch() )
5✔
382
                        {
383
                                if( $item = $this->applyFilter( $this->create( $row ) ) ) {
5✔
384
                                        $items[$row['subscription.id']] = $item;
5✔
385
                                }
386
                        }
387
                }
388
                catch( \Exception $e )
×
389
                {
390
                        $results->finish();
×
391
                        throw $e;
×
392
                }
393

394

395
                if( in_array( 'order', $ref ) )
5✔
396
                {
397
                        $ids = array_column( $items, 'subscription.orderid' );
1✔
398
                        $manager = \Aimeos\MShop::create( $context, 'order' );
1✔
399
                        $search = $manager->filter()->add( 'order.id', '==', $ids )->slice( 0, count( $ids ) );
1✔
400
                        $orderItems = $manager->search( $search, $ref );
1✔
401

402
                        foreach( $items as $item ) {
1✔
403
                                $item->set( '.orderitem', $orderItems[$item['subscription.orderid']] ?? null ); // @phpstan-ignore method.notFound
1✔
404
                        }
405
                }
406

407
                return map( $items );
5✔
408
        }
409

410

411
        /**
412
         * Returns the prefix for the item properties and search keys.
413
         *
414
         * @return string Prefix for the item properties and search keys
415
         */
416
        protected function prefix() : string
417
        {
418
                return 'subscription.';
6✔
419
        }
420

421

422
        /**
423
         * Creates a one-time subscription in the storage from the given invoice object.
424
         *
425
         * @param \Aimeos\MShop\Common\Item\Iface $item Subscription item with necessary values
426
         * @param bool $fetch True if the new ID should be returned in the item
427
         * @return \Aimeos\MShop\Subscription\Item\Iface Updated item including the generated ID
428
         */
429
        protected function saveBase( \Aimeos\MShop\Common\Item\Iface $item, bool $fetch = true ) : \Aimeos\MShop\Subscription\Item\Iface
430
        {
431
                if( $item->getOrderProductId() === null ) {
1✔
432
                        throw new \Aimeos\MShop\Subscription\Exception( 'Required order product ID is missing' );
×
433
                }
434

435
                if( $orderItem = $item->getOrderItem() ) {
1✔
436
                        // @phpstan-ignore argument.type
UNCOV
437
                        \Aimeos\MShop::create( $this->context(), 'order' )->save( $orderItem );
×
438
                }
439

440
                return parent::saveBase( $item, $fetch ); // @phpstan-ignore return.type
1✔
441
        }
442

443

444
        /** mshop/subscription/manager/name
445
         * Class name of the used subscription manager implementation
446
         *
447
         * Each default manager can be replace by an alternative imlementation.
448
         * To use this implementation, you have to set the last part of the class
449
         * name as configuration value so the manager factory knows which class it
450
         * has to instantiate.
451
         *
452
         * For example, if the name of the default class is
453
         *
454
         *  \Aimeos\MShop\Subscription\Manager\Standard
455
         *
456
         * and you want to replace it with your own version named
457
         *
458
         *  \Aimeos\MShop\Subscription\Manager\Mymanager
459
         *
460
         * then you have to set the this configuration option:
461
         *
462
         *  mshop/subscription/manager/name = Mymanager
463
         *
464
         * The value is the last part of your own class name and it's case sensitive,
465
         * so take care that the configuration value is exactly named like the last
466
         * part of the class name.
467
         *
468
         * The allowed characters of the class name are A-Z, a-z and 0-9. No other
469
         * characters are possible! You should always start the last part of the class
470
         * name with an upper case character and continue only with lower case characters
471
         * or numbers. Avoid chamel case names like "MyManager"!
472
         *
473
         * @type string Last part of the class name
474
         * @since 2018.04
475
         */
476

477
        /** mshop/subscription/manager/decorators/excludes
478
         * Excludes decorators added by the "common" option from the subscription manager
479
         *
480
         * Decorators extend the functionality of a class by adding new aspects
481
         * (e.g. log what is currently done), executing the methods of the underlying
482
         * class only in certain conditions (e.g. only for logged in users) or
483
         * modify what is returned to the caller.
484
         *
485
         * This option allows you to remove a decorator added via
486
         * "mshop/common/manager/decorators/default" before they are wrapped
487
         * around the subscription manager.
488
         *
489
         *  mshop/subscription/manager/decorators/excludes = array( 'decorator1' )
490
         *
491
         * This would remove the decorator named "decorator1" from the list of
492
         * common decorators ("\Aimeos\MShop\Common\Manager\Decorator\*") added via
493
         * "mshop/common/manager/decorators/default" for the subscription manager.
494
         *
495
         * @type array List of decorator names
496
         * @since 2018.04
497
         * @see mshop/common/manager/decorators/default
498
         * @see mshop/subscription/manager/decorators/global
499
         * @see mshop/subscription/manager/decorators/local
500
         */
501

502
        /** mshop/subscription/manager/decorators/global
503
         * Adds a list of globally available decorators only to the subscription manager
504
         *
505
         * Decorators extend the functionality of a class by adding new aspects
506
         * (e.g. log what is currently done), executing the methods of the underlying
507
         * class only in certain conditions (e.g. only for logged in users) or
508
         * modify what is returned to the caller.
509
         *
510
         * This option allows you to wrap global decorators
511
         * ("\Aimeos\MShop\Common\Manager\Decorator\*") around the subscription manager.
512
         *
513
         *  mshop/subscription/manager/decorators/global = array( 'decorator1' )
514
         *
515
         * This would add the decorator named "decorator1" defined by
516
         * "\Aimeos\MShop\Common\Manager\Decorator\Decorator1" only to the subscription
517
         * manager.
518
         *
519
         * @type array List of decorator names
520
         * @since 2018.04
521
         * @see mshop/common/manager/decorators/default
522
         * @see mshop/subscription/manager/decorators/excludes
523
         * @see mshop/subscription/manager/decorators/local
524
         */
525

526
        /** mshop/subscription/manager/decorators/local
527
         * Adds a list of local decorators only to the subscription manager
528
         *
529
         * Decorators extend the functionality of a class by adding new aspects
530
         * (e.g. log what is currently done), executing the methods of the underlying
531
         * class only in certain conditions (e.g. only for logged in users) or
532
         * modify what is returned to the caller.
533
         *
534
         * This option allows you to wrap local decorators
535
         * ("\Aimeos\MShop\Subscription\Manager\Decorator\*") around the subscription manager.
536
         *
537
         *  mshop/subscription/manager/decorators/local = array( 'decorator2' )
538
         *
539
         * This would add the decorator named "decorator2" defined by
540
         * "\Aimeos\MShop\Subscription\Manager\Decorator\Decorator2" only to the subscription
541
         * manager.
542
         *
543
         * @type array List of decorator names
544
         * @since 2018.04
545
         * @see mshop/common/manager/decorators/default
546
         * @see mshop/subscription/manager/decorators/excludes
547
         * @see mshop/subscription/manager/decorators/global
548
         */
549

550
        /** mshop/subscription/manager/delete/mysql
551
         * Deletes the items matched by the given IDs from the database
552
         *
553
         * @see mshop/subscription/manager/delete/ansi
554
         */
555

556
        /** mshop/subscription/manager/delete/ansi
557
         * Deletes the items matched by the given IDs from the database
558
         *
559
         * Removes the records specified by the given IDs from the subscription database.
560
         * The records must be from the site that is configured via the
561
         * context item.
562
         *
563
         * The ":cond" placeholder is replaced by the name of the ID column and
564
         * the given ID or list of IDs while the site ID is bound to the question
565
         * mark.
566
         *
567
         * The SQL statement should conform to the ANSI standard to be
568
         * compatible with most relational database systems. This also
569
         * includes using double quotes for table and column names.
570
         *
571
         * @type string SQL statement for deleting items
572
         * @since 2018.04
573
         * @see mshop/subscription/manager/insert/ansi
574
         * @see mshop/subscription/manager/update/ansi
575
         * @see mshop/subscription/manager/newid/ansi
576
         * @see mshop/subscription/manager/search/ansi
577
         * @see mshop/subscription/manager/count/ansi
578
         */
579

580
        /** mshop/subscription/manager/submanagers
581
         * List of manager names that can be instantiated by the subscription manager
582
         *
583
         * Managers provide a generic interface to the underlying storage.
584
         * Each manager has or can have sub-managers caring about particular
585
         * aspects. Each of these sub-managers can be instantiated by its
586
         * parent manager using the getSubManager() method.
587
         *
588
         * The search keys from sub-managers can be normally used in the
589
         * manager as well. It allows you to search for items of the manager
590
         * using the search keys of the sub-managers to further limit the
591
         * retrieved list of items.
592
         *
593
         * @type array List of sub-manager names
594
         * @since 2018.04
595
         */
596

597
        /** mshop/subscription/manager/insert/mysql
598
         * Inserts a new subscription record into the database table
599
         *
600
         * @see mshop/subscription/manager/insert/ansi
601
         */
602

603
        /** mshop/subscription/manager/insert/ansi
604
         * Inserts a new subscription record into the database table
605
         *
606
         * Items with no ID yet (i.e. the ID is NULL) will be created in
607
         * the database and the newly created ID retrieved afterwards
608
         * using the "newid" SQL statement.
609
         *
610
         * The SQL statement must be a string suitable for being used as
611
         * prepared statement. It must include question marks for binding
612
         * the values from the subscription item to the statement before they are
613
         * sent to the database server. The number of question marks must
614
         * be the same as the number of columns listed in the INSERT
615
         * statement. The order of the columns must correspond to the
616
         * order in the save() method, so the correct values are
617
         * bound to the columns.
618
         *
619
         * The SQL statement should conform to the ANSI standard to be
620
         * compatible with most relational database systems. This also
621
         * includes using double quotes for table and column names.
622
         *
623
         * @type string SQL statement for inserting records
624
         * @since 2018.04
625
         * @see mshop/subscription/manager/update/ansi
626
         * @see mshop/subscription/manager/newid/ansi
627
         * @see mshop/subscription/manager/delete/ansi
628
         * @see mshop/subscription/manager/search/ansi
629
         * @see mshop/subscription/manager/count/ansi
630
         */
631

632
        /** mshop/subscription/manager/update/mysql
633
         * Updates an existing subscription record in the database
634
         *
635
         * @see mshop/subscription/manager/update/ansi
636
         */
637

638
        /** mshop/subscription/manager/update/ansi
639
         * Updates an existing subscription record in the database
640
         *
641
         * Items which already have an ID (i.e. the ID is not NULL) will
642
         * be updated in the database.
643
         *
644
         * The SQL statement must be a string suitable for being used as
645
         * prepared statement. It must include question marks for binding
646
         * the values from the subscription item to the statement before they are
647
         * sent to the database server. The order of the columns must
648
         * correspond to the order in the save() method, so the
649
         * correct values are bound to the columns.
650
         *
651
         * The SQL statement should conform to the ANSI standard to be
652
         * compatible with most relational database systems. This also
653
         * includes using double quotes for table and column names.
654
         *
655
         * @type string SQL statement for updating records
656
         * @since 2018.04
657
         * @see mshop/subscription/manager/insert/ansi
658
         * @see mshop/subscription/manager/newid/ansi
659
         * @see mshop/subscription/manager/delete/ansi
660
         * @see mshop/subscription/manager/search/ansi
661
         * @see mshop/subscription/manager/count/ansi
662
         */
663

664
        /** mshop/subscription/manager/newid/mysql
665
         * Retrieves the ID generated by the database when inserting a new record
666
         *
667
         * @see mshop/subscription/manager/newid/ansi
668
         */
669

670
        /** mshop/subscription/manager/newid/ansi
671
         * Retrieves the ID generated by the database when inserting a new record
672
         *
673
         * As soon as a new record is inserted into the database table,
674
         * the database server generates a new and unique identifier for
675
         * that record. This ID can be used for retrieving, updating and
676
         * deleting that specific record from the table again.
677
         *
678
         * For MySQL:
679
         *  SELECT LAST_INSERT_ID()
680
         * For PostgreSQL:
681
         *  SELECT currval('seq_mrul_id')
682
         * For SQL Server:
683
         *  SELECT SCOPE_IDENTITY()
684
         * For Oracle:
685
         *  SELECT "seq_mrul_id".CURRVAL FROM DUAL
686
         *
687
         * There's no way to retrive the new ID by a SQL statements that
688
         * fits for most database servers as they implement their own
689
         * specific way.
690
         *
691
         * @type string SQL statement for retrieving the last inserted record ID
692
         * @since 2018.04
693
         * @see mshop/subscription/manager/insert/ansi
694
         * @see mshop/subscription/manager/update/ansi
695
         * @see mshop/subscription/manager/delete/ansi
696
         * @see mshop/subscription/manager/search/ansi
697
         * @see mshop/subscription/manager/count/ansi
698
         */
699
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc