Standard   A
last analyzed

Complexity

Total Complexity 15

Size/Duplication

Total Lines 189
Duplicated Lines 0 %

Importance

Changes 7
Bugs 0 Features 0
Metric Value
eloc 54
dl 0
loc 189
rs 10
c 7
b 0
f 0
wmc 15

10 Methods

Rating   Name   Duplication   Size   Complexity  
A find() 0 4 1
A create() 0 4 1
A prefix() 0 3 1
A saveRefs() 0 4 1
A delete() 0 3 1
A getSaveAttributes() 0 20 1
A getSearchAttributes() 0 27 5
A filter() 0 3 1
A searchRefs() 0 9 2
A save() 0 7 1
1
<?php
2
3
/**
4
 * @license LGPLv3, https://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2020-2025
6
 * @package MShop
7
 * @subpackage Cms
8
 */
9
10
11
namespace Aimeos\MShop\Cms\Manager;
12
13
14
/**
15
 * Default cms manager implementation
16
 *
17
 * @package MShop
18
 * @subpackage Cms
19
 */
20
class Standard
21
	extends \Aimeos\MShop\Common\Manager\Base
22
	implements \Aimeos\MShop\Cms\Manager\Iface, \Aimeos\MShop\Common\Manager\Factory\Iface
23
{
24
	use \Aimeos\MShop\Common\Manager\ListsRef\Traits;
25
26
27
	/**
28
	 * Creates a new empty item instance
29
	 *
30
	 * @param array $values Values the item should be initialized with
31
	 * @return \Aimeos\MShop\Cms\Item\Iface New cms item object
32
	 */
33
	public function create( array $values = [] ) : \Aimeos\MShop\Common\Item\Iface
34
	{
35
		$values['cms.siteid'] = $values['cms.siteid'] ?? $this->context()->locale()->getSiteId();
36
		return new \Aimeos\MShop\Cms\Item\Standard( 'cms.', $values );
37
	}
38
39
40
	/**
41
	 * Removes multiple items.
42
	 *
43
	 * @param \Aimeos\MShop\Common\Item\Iface[]|string[] $items List of item objects or IDs of the items
44
	 * @return \Aimeos\MShop\Text\Manager\Iface Manager object for chaining method calls
45
	 */
46
	public function delete( $items ) : \Aimeos\MShop\Common\Manager\Iface
47
	{
48
		return parent::delete( $items )->deleteRefItems( $items );
0 ignored issues
show
Bug introduced by
The method deleteRefItems() does not exist on Aimeos\MShop\Common\Manager\Iface. Did you maybe mean delete()? ( Ignorable by Annotation )

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

48
		return parent::delete( $items )->/** @scrutinizer ignore-call */ deleteRefItems( $items );

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
49
	}
50
51
52
	/**
53
	 * Creates a filter object.
54
	 *
55
	 * @param bool|null $default Add default criteria or NULL for relaxed default criteria
56
	 * @param bool $site TRUE for adding site criteria to limit items by the site of related items
57
	 * @return \Aimeos\Base\Criteria\Iface Returns the filter object
58
	 */
59
	public function filter( ?bool $default = false, bool $site = false ) : \Aimeos\Base\Criteria\Iface
60
	{
61
		return $this->filterBase( 'cms', $default );
62
	}
63
64
65
	/**
66
	 * Returns the item specified by its URL
67
	 *
68
	 * @param string $code URL of the item
69
	 * @param string[] $ref List of domains to fetch list items and referenced items for
70
	 * @param string|null $domain Domain of the item if necessary to identify the item uniquely
71
	 * @param string|null $type Type code of the item if necessary to identify the item uniquely
72
	 * @param bool|null $default Add default criteria or NULL for relaxed default criteria
73
	 * @return \Aimeos\MShop\Common\Item\Iface Item object
74
	 */
75
	public function find( string $code, array $ref = [], ?string $domain = null, ?string $type = null,
76
		?bool $default = false ) : \Aimeos\MShop\Common\Item\Iface
77
	{
78
		return $this->findBase( ['cms.url' => $code], $ref, $default );
79
	}
80
81
82
	/**
83
	 * Returns the additional column/search definitions
84
	 *
85
	 * @return array Associative list of column names as keys and items implementing \Aimeos\Base\Criteria\Attribute\Iface
86
	 */
87
	public function getSaveAttributes() : array
88
	{
89
		return $this->createAttributes( [
90
			'cms.url' => [
91
				'code' => 'cms.url',
92
				'internalcode' => 'url',
93
				'label' => 'Type',
94
				'type' => 'string',
95
			],
96
			'cms.label' => [
97
				'code' => 'cms.label',
98
				'internalcode' => 'label',
99
				'label' => 'Label',
100
				'type' => 'string',
101
			],
102
			'cms.status' => [
103
				'code' => 'cms.status',
104
				'internalcode' => 'status',
105
				'label' => 'Status',
106
				'type' => 'int',
107
			],
108
		] );
109
	}
110
111
112
	/**
113
	 * Returns the attributes that can be used for searching.
114
	 *
115
	 * @param bool $withsub Return also attributes of sub-managers if true
116
	 * @return \Aimeos\Base\Criteria\Attribute\Iface[] List of search attribute items
117
	 */
118
	public function getSearchAttributes( bool $withsub = true ) : array
119
	{
120
		$level = \Aimeos\MShop\Locale\Manager\Base::SITE_ALL;
121
		$level = $this->context()->config()->get( 'mshop/cms/manager/sitemode', $level );
122
123
		return array_replace( parent::getSearchAttributes( $withsub ), $this->createAttributes( [
124
			'cms:has' => [
125
				'code' => 'cms:has()',
126
				'internalcode' => ':site AND :key AND mcmsli."id"',
127
				'internaldeps' => ['LEFT JOIN "mshop_cms_list" AS mcmsli ON ( mcmsli."parentid" = mcms."id" )'],
128
				'label' => 'Cms has list item, parameter(<domain>[,<list type>[,<reference ID>)]]',
129
				'type' => 'null',
130
				'public' => false,
131
				'function' => function( &$source, array $params ) use ( $level ) {
132
					$keys = [];
133
134
					foreach( (array) ( $params[1] ?? '' ) as $type ) {
135
						foreach( (array) ( $params[2] ?? '' ) as $id ) {
136
							$keys[] = $params[0] . '|' . ( $type ? $type . '|' : '' ) . $id;
137
						}
138
					}
139
140
					$sitestr = $this->siteString( 'mcmsli."siteid"', $level );
141
					$keystr = $this->toExpression( 'mcmsli."key"', $keys, ( $params[2] ?? null ) ? '==' : '=~' );
142
					$source = str_replace( [':site', ':key'], [$sitestr, $keystr], $source );
143
144
					return $params;
145
				}
146
			],
147
		] ) );
148
	}
149
150
151
	/**
152
	 * Adds or updates an item object or a list of them.
153
	 *
154
	 * @param \Aimeos\Map|\Aimeos\MShop\Common\Item\Iface[]|\Aimeos\MShop\Common\Item\Iface $items Item or list of items whose data should be saved
155
	 * @param bool $fetch True if the new ID should be returned in the item
156
	 * @return \Aimeos\Map|\Aimeos\MShop\Common\Item\Iface Saved item or items
157
	 */
158
	public function save( $items, bool $fetch = true )
159
	{
160
		$items = parent::save( $items, $fetch );
161
162
		$this->context()->cache()->deleteByTags( map( $items )->getId()->prefix( 'cms-' ) );
163
164
		return $items;
165
	}
166
167
168
	/**
169
	 * Saves the dependent items of the item
170
	 *
171
	 * @param \Aimeos\MShop\Common\Item\Iface $item Item object
172
	 * @param bool $fetch True if the new ID should be returned in the item
173
	 * @return \Aimeos\MShop\Common\Item\Iface Updated item
174
	 */
175
	public function saveRefs( \Aimeos\MShop\Common\Item\Iface $item, bool $fetch = true ) : \Aimeos\MShop\Common\Item\Iface
176
	{
177
		$this->saveListItems( $item, 'cms', $fetch );
178
		return $item;
179
	}
180
181
182
	/**
183
	 * Merges the data from the given map and the referenced items
184
	 *
185
	 * @param array $entries Associative list of ID as key and the associative list of property key/value pairs as values
186
	 * @param array $ref List of referenced items to fetch and add to the entries
187
	 * @return array Associative list of ID as key and the updated entries as value
188
	 */
189
	public function searchRefs( array $entries, array $ref ) : array
190
	{
191
		$parentIds = array_keys( $entries );
192
193
		foreach( $this->getListItems( $parentIds, $ref, 'cms' ) as $id => $listItem ) {
194
			$entries[$listItem->getParentId()]['.listitems'][$id] = $listItem;
195
		}
196
197
		return $entries;
198
	}
199
200
201
	/**
202
	 * Returns the prefix for the item properties and search keys.
203
	 *
204
	 * @return string Prefix for the item properties and search keys
205
	 */
206
	protected function prefix() : string
207
	{
208
		return 'cms.';
209
	}
210
211
212
	/** madmin/cms/manager/resource
213
	 * Name of the database connection resource to use
214
	 *
215
	 * You can configure a different database connection for each data domain
216
	 * and if no such connection name exists, the "db" connection will be used.
217
	 * It's also possible to use the same database connection for different
218
	 * data domains by configuring the same connection name using this setting.
219
	 *
220
	 * @param string Database connection name
221
	 * @since 2023.04
222
	 */
223
224
	/** mshop/cms/manager/name
225
	 * Class name of the used cms manager implementation
226
	 *
227
	 * Each default manager can be replace by an alternative imlementation.
228
	 * To use this implementation, you have to set the last part of the class
229
	 * name as configuration value so the manager factory knows which class it
230
	 * has to instantiate.
231
	 *
232
	 * For example, if the name of the default class is
233
	 *
234
	 *  \Aimeos\MShop\Cms\Manager\Standard
235
	 *
236
	 * and you want to replace it with your own version named
237
	 *
238
	 *  \Aimeos\MShop\Cms\Manager\Mymanager
239
	 *
240
	 * then you have to set the this configuration option:
241
	 *
242
	 *  mshop/cms/manager/name = Mymanager
243
	 *
244
	 * The value is the last part of your own class name and it's case sensitive,
245
	 * so take care that the configuration value is exactly named like the last
246
	 * part of the class name.
247
	 *
248
	 * The allowed characters of the class name are A-Z, a-z and 0-9. No other
249
	 * characters are possible! You should always start the last part of the class
250
	 * name with an upper case character and continue only with lower case characters
251
	 * or numbers. Avoid chamel case names like "MyManager"!
252
	 *
253
	 * @param string Last part of the class name
254
	 * @since 2020.10
255
	 * @category Developer
256
	 */
257
258
	/** mshop/cms/manager/decorators/excludes
259
	 * Excludes decorators added by the "common" option from the cms manager
260
	 *
261
	 * Decorators extend the functionality of a class by adding new aspects
262
	 * (e.g. log what is currently done), executing the methods of the underlying
263
	 * class only in certain conditions (e.g. only for logged in users) or
264
	 * modify what is returned to the caller.
265
	 *
266
	 * This option allows you to remove a decorator added via
267
	 * "mshop/common/manager/decorators/default" before they are wrapped
268
	 * around the cms manager.
269
	 *
270
	 *  mshop/cms/manager/decorators/excludes = array( 'decorator1' )
271
	 *
272
	 * This would remove the decorator named "decorator1" from the list of
273
	 * common decorators ("\Aimeos\MShop\Common\Manager\Decorator\*") added via
274
	 * "mshop/common/manager/decorators/default" for the cms manager.
275
	 *
276
	 * @param array List of decorator names
277
	 * @since 2020.10
278
	 * @category Developer
279
	 * @see mshop/common/manager/decorators/default
280
	 * @see mshop/cms/manager/decorators/global
281
	 * @see mshop/cms/manager/decorators/local
282
	 */
283
284
	/** mshop/cms/manager/decorators/global
285
	 * Adds a list of globally available decorators only to the cms manager
286
	 *
287
	 * Decorators extend the functionality of a class by adding new aspects
288
	 * (e.g. log what is currently done), executing the methods of the underlying
289
	 * class only in certain conditions (e.g. only for logged in users) or
290
	 * modify what is returned to the caller.
291
	 *
292
	 * This option allows you to wrap global decorators
293
	 * ("\Aimeos\MShop\Common\Manager\Decorator\*") around the cms manager.
294
	 *
295
	 *  mshop/cms/manager/decorators/global = array( 'decorator1' )
296
	 *
297
	 * This would add the decorator named "decorator1" defined by
298
	 * "\Aimeos\MShop\Common\Manager\Decorator\Decorator1" only to the cms
299
	 * manager.
300
	 *
301
	 * @param array List of decorator names
302
	 * @since 2020.10
303
	 * @category Developer
304
	 * @see mshop/common/manager/decorators/default
305
	 * @see mshop/cms/manager/decorators/excludes
306
	 * @see mshop/cms/manager/decorators/local
307
	 */
308
309
	/** mshop/cms/manager/decorators/local
310
	 * Adds a list of local decorators only to the cms manager
311
	 *
312
	 * Decorators extend the functionality of a class by adding new aspects
313
	 * (e.g. log what is currently done), executing the methods of the underlying
314
	 * class only in certain conditions (e.g. only for logged in users) or
315
	 * modify what is returned to the caller.
316
	 *
317
	 * This option allows you to wrap local decorators
318
	 * ("\Aimeos\MShop\Cms\Manager\Decorator\*") around the cms manager.
319
	 *
320
	 *  mshop/cms/manager/decorators/local = array( 'decorator2' )
321
	 *
322
	 * This would add the decorator named "decorator2" defined by
323
	 * "\Aimeos\MShop\Cms\Manager\Decorator\Decorator2" only to the cms
324
	 * manager.
325
	 *
326
	 * @param array List of decorator names
327
	 * @since 2020.10
328
	 * @category Developer
329
	 * @see mshop/common/manager/decorators/default
330
	 * @see mshop/cms/manager/decorators/excludes
331
	 * @see mshop/cms/manager/decorators/global
332
	 */
333
334
	/** mshop/cms/manager/submanagers
335
	 * List of manager names that can be instantiated by the cms manager
336
	 *
337
	 * Managers provide a generic interface to the underlying storage.
338
	 * Each manager has or can have sub-managers caring about particular
339
	 * aspects. Each of these sub-managers can be instantiated by its
340
	 * parent manager using the getSubManager() method.
341
	 *
342
	 * The search keys from sub-managers can be normally used in the
343
	 * manager as well. It allows you to search for items of the manager
344
	 * using the search keys of the sub-managers to further limit the
345
	 * retrieved list of items.
346
	 *
347
	 * @param array List of sub-manager names
348
	 * @since 2020.10
349
	 * @category Developer
350
	 */
351
352
	/** mshop/cms/manager/delete/mysql
353
	 * Deletes the items matched by the given IDs from the database
354
	 *
355
	 * @see mshop/cms/manager/delete/ansi
356
	 */
357
358
	/** mshop/cms/manager/delete/ansi
359
	 * Deletes the items matched by the given IDs from the database
360
	 *
361
	 * Removes the records specified by the given IDs from the cms database.
362
	 * The records must be from the site that is configured via the
363
	 * context item.
364
	 *
365
	 * The ":cond" placeholder is replaced by the name of the ID column and
366
	 * the given ID or list of IDs while the site ID is bound to the question
367
	 * mark.
368
	 *
369
	 * The SQL statement should conform to the ANSI standard to be
370
	 * compatible with most relational database systems. This also
371
	 * includes using double quotes for table and column names.
372
	 *
373
	 * @param string SQL statement for deleting items
374
	 * @since 2020.10
375
	 * @category Developer
376
	 * @see mshop/cms/manager/insert/ansi
377
	 * @see mshop/cms/manager/update/ansi
378
	 * @see mshop/cms/manager/newid/ansi
379
	 * @see mshop/cms/manager/search/ansi
380
	 * @see mshop/cms/manager/count/ansi
381
	 */
382
383
	/** mshop/cms/manager/insert/mysql
384
	 * Inserts a new cms record into the database table
385
	 *
386
	 * @see mshop/cms/manager/insert/ansi
387
	 */
388
389
	/** mshop/cms/manager/insert/ansi
390
	 * Inserts a new cms record into the database table
391
	 *
392
	 * Items with no ID yet (i.e. the ID is NULL) will be created in
393
	 * the database and the newly created ID retrieved afterwards
394
	 * using the "newid" SQL statement.
395
	 *
396
	 * The SQL statement must be a string suitable for being used as
397
	 * prepared statement. It must include question marks for binding
398
	 * the values from the cms item to the statement before they are
399
	 * sent to the database server. The number of question marks must
400
	 * be the same as the number of columns listed in the INSERT
401
	 * statement. The order of the columns must correspond to the
402
	 * order in the save() method, so the correct values are
403
	 * bound to the columns.
404
	 *
405
	 * The SQL statement should conform to the ANSI standard to be
406
	 * compatible with most relational database systems. This also
407
	 * includes using double quotes for table and column names.
408
	 *
409
	 * @param string SQL statement for inserting records
410
	 * @since 2020.10
411
	 * @category Developer
412
	 * @see mshop/cms/manager/update/ansi
413
	 * @see mshop/cms/manager/newid/ansi
414
	 * @see mshop/cms/manager/delete/ansi
415
	 * @see mshop/cms/manager/search/ansi
416
	 * @see mshop/cms/manager/count/ansi
417
	 */
418
419
	/** mshop/cms/manager/update/mysql
420
	 * Updates an existing cms record in the database
421
	 *
422
	 * @see mshop/cms/manager/update/ansi
423
	 */
424
425
	/** mshop/cms/manager/update/ansi
426
	 * Updates an existing cms record in the database
427
	 *
428
	 * Items which already have an ID (i.e. the ID is not NULL) will
429
	 * be updated in the database.
430
	 *
431
	 * The SQL statement must be a string suitable for being used as
432
	 * prepared statement. It must include question marks for binding
433
	 * the values from the cms item to the statement before they are
434
	 * sent to the database server. The order of the columns must
435
	 * correspond to the order in the save() method, so the
436
	 * correct values are bound to the columns.
437
	 *
438
	 * The SQL statement should conform to the ANSI standard to be
439
	 * compatible with most relational database systems. This also
440
	 * includes using double quotes for table and column names.
441
	 *
442
	 * @param string SQL statement for updating records
443
	 * @since 2020.10
444
	 * @category Developer
445
	 * @see mshop/cms/manager/insert/ansi
446
	 * @see mshop/cms/manager/newid/ansi
447
	 * @see mshop/cms/manager/delete/ansi
448
	 * @see mshop/cms/manager/search/ansi
449
	 * @see mshop/cms/manager/count/ansi
450
	 */
451
452
	/** mshop/cms/manager/newid/mysql
453
	 * Retrieves the ID generated by the database when inserting a new record
454
	 *
455
	 * @see mshop/cms/manager/newid/ansi
456
	 */
457
458
	/** mshop/cms/manager/newid/ansi
459
	 * Retrieves the ID generated by the database when inserting a new record
460
	 *
461
	 * As soon as a new record is inserted into the database table,
462
	 * the database server generates a new and unique identifier for
463
	 * that record. This ID can be used for retrieving, updating and
464
	 * deleting that specific record from the table again.
465
	 *
466
	 * For MySQL:
467
	 *  SELECT LAST_INSERT_ID()
468
	 * For PostgreSQL:
469
	 *  SELECT currval('seq_mcms_id')
470
	 * For SQL Server:
471
	 *  SELECT SCOPE_IDENTITY()
472
	 * For Oracle:
473
	 *  SELECT "seq_mcms_id".CURRVAL FROM DUAL
474
	 *
475
	 * There's no way to retrive the new ID by a SQL statements that
476
	 * fits for most database servers as they implement their own
477
	 * specific way.
478
	 *
479
	 * @param string SQL statement for retrieving the last inserted record ID
480
	 * @since 2020.10
481
	 * @category Developer
482
	 * @see mshop/cms/manager/insert/ansi
483
	 * @see mshop/cms/manager/update/ansi
484
	 * @see mshop/cms/manager/delete/ansi
485
	 * @see mshop/cms/manager/search/ansi
486
	 * @see mshop/cms/manager/count/ansi
487
	 */
488
489
	/** mshop/cms/manager/sitemode
490
	 * Mode how items from levels below or above in the site tree are handled
491
	 *
492
	 * By default, only items from the current site are fetched from the
493
	 * storage. If the ai-sites extension is installed, you can create a
494
	 * tree of sites. Then, this setting allows you to define for the
495
	 * whole cms domain if items from parent sites are inherited,
496
	 * sites from child sites are aggregated or both.
497
	 *
498
	 * Available constants for the site mode are:
499
	 * * 0 = only items from the current site
500
	 * * 1 = inherit items from parent sites
501
	 * * 2 = aggregate items from child sites
502
	 * * 3 = inherit and aggregate items at the same time
503
	 *
504
	 * You also need to set the mode in the locale manager
505
	 * (mshop/locale/manager/sitelevel) to one of the constants.
506
	 * If you set it to the same value, it will work as described but you
507
	 * can also use different modes. For example, if inheritance and
508
	 * aggregation is configured the locale manager but only inheritance
509
	 * in the domain manager because aggregating items makes no sense in
510
	 * this domain, then items wil be only inherited. Thus, you have full
511
	 * control over inheritance and aggregation in each domain.
512
	 *
513
	 * @param int Constant from Aimeos\MShop\Locale\Manager\Base class
514
	 * @category Developer
515
	 * @since 2020.10
516
	 * @see mshop/locale/manager/sitelevel
517
	 */
518
519
	/** mshop/cms/manager/search/mysql
520
	 * Retrieves the records matched by the given criteria in the database
521
	 *
522
	 * @see mshop/cms/manager/search/ansi
523
	 */
524
525
	/** mshop/cms/manager/search/ansi
526
	 * Retrieves the records matched by the given criteria in the database
527
	 *
528
	 * Fetches the records matched by the given criteria from the cms
529
	 * database. The records must be from one of the sites that are
530
	 * configured via the context item. If the current site is part of
531
	 * a tree of sites, the SELECT statement can retrieve all records
532
	 * from the current site and the complete sub-tree of sites.
533
	 *
534
	 * As the records can normally be limited by criteria from sub-managers,
535
	 * their tables must be joined in the SQL context. This is done by
536
	 * using the "internaldeps" property from the definition of the ID
537
	 * column of the sub-managers. These internal dependencies specify
538
	 * the JOIN between the tables and the used columns for joining. The
539
	 * ":joins" placeholder is then replaced by the JOIN strings from
540
	 * the sub-managers.
541
	 *
542
	 * To limit the records matched, conditions can be added to the given
543
	 * criteria object. It can contain comparisons like column names that
544
	 * must match specific values which can be combined by AND, OR or NOT
545
	 * operators. The resulting string of SQL conditions replaces the
546
	 * ":cond" placeholder before the statement is sent to the database
547
	 * server.
548
	 *
549
	 * If the records that are retrieved should be ordered by one or more
550
	 * columns, the generated string of column / sort direction pairs
551
	 * replaces the ":order" placeholder. In case no ordering is required,
552
	 * the complete ORDER BY part including the "\/*-orderby*\/...\/*orderby-*\/"
553
	 * markers is removed to speed up retrieving the records. Columns of
554
	 * sub-managers can also be used for ordering the result set but then
555
	 * no index can be used.
556
	 *
557
	 * The number of returned records can be limited and can start at any
558
	 * number between the begining and the end of the result set. For that
559
	 * the ":size" and ":start" placeholders are replaced by the
560
	 * corresponding values from the criteria object. The default values
561
	 * are 0 for the start and 100 for the size value.
562
	 *
563
	 * The SQL statement should conform to the ANSI standard to be
564
	 * compatible with most relational database systems. This also
565
	 * includes using double quotes for table and column names.
566
	 *
567
	 * @param string SQL statement for searching items
568
	 * @since 2020.10
569
	 * @category Developer
570
	 * @see mshop/cms/manager/insert/ansi
571
	 * @see mshop/cms/manager/update/ansi
572
	 * @see mshop/cms/manager/newid/ansi
573
	 * @see mshop/cms/manager/delete/ansi
574
	 * @see mshop/cms/manager/count/ansi
575
	 */
576
577
	/** mshop/cms/manager/count/mysql
578
	 * Counts the number of records matched by the given criteria in the database
579
	 *
580
	 * @see mshop/cms/manager/count/ansi
581
	 */
582
583
	/** mshop/cms/manager/count/ansi
584
	 * Counts the number of records matched by the given criteria in the database
585
	 *
586
	 * Counts all records matched by the given criteria from the cms
587
	 * database. The records must be from one of the sites that are
588
	 * configured via the context item. If the current site is part of
589
	 * a tree of sites, the statement can count all records from the
590
	 * current site and the complete sub-tree of sites.
591
	 *
592
	 * As the records can normally be limited by criteria from sub-managers,
593
	 * their tables must be joined in the SQL context. This is done by
594
	 * using the "internaldeps" property from the definition of the ID
595
	 * column of the sub-managers. These internal dependencies specify
596
	 * the JOIN between the tables and the used columns for joining. The
597
	 * ":joins" placeholder is then replaced by the JOIN strings from
598
	 * the sub-managers.
599
	 *
600
	 * To limit the records matched, conditions can be added to the given
601
	 * criteria object. It can contain comparisons like column names that
602
	 * must match specific values which can be combined by AND, OR or NOT
603
	 * operators. The resulting string of SQL conditions replaces the
604
	 * ":cond" placeholder before the statement is sent to the database
605
	 * server.
606
	 *
607
	 * Both, the strings for ":joins" and for ":cond" are the same as for
608
	 * the "search" SQL statement.
609
	 *
610
	 * Contrary to the "search" statement, it doesn't return any records
611
	 * but instead the number of records that have been found. As counting
612
	 * thousands of records can be a long running task, the maximum number
613
	 * of counted records is limited for performance reasons.
614
	 *
615
	 * The SQL statement should conform to the ANSI standard to be
616
	 * compatible with most relational database systems. This also
617
	 * includes using double quotes for table and column names.
618
	 *
619
	 * @param string SQL statement for counting items
620
	 * @since 2020.10
621
	 * @category Developer
622
	 * @see mshop/cms/manager/insert/ansi
623
	 * @see mshop/cms/manager/update/ansi
624
	 * @see mshop/cms/manager/newid/ansi
625
	 * @see mshop/cms/manager/delete/ansi
626
	 * @see mshop/cms/manager/search/ansi
627
	 */
628
}
629