Completed
Push — master ( 21369d...7d30ed )
by Vitaly
02:24
created

GeneratorApi::generateConstructorCollectionClass()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 12

Duplication

Lines 15
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 15
loc 15
rs 9.4285
cc 1
eloc 12
nc 1
nop 0
1
<?php
2
//[PHPCOMPRESSOR(remove,start)]
3
/**
4
 * Created by PhpStorm.
5
 * User: VITALYIEGOROV
6
 * Date: 09.12.15
7
 * Time: 14:34
8
 */
9
namespace samsoncms\api;
10
11
use samsoncms\api\generator\exception\ParentEntityNotFound;
12
use samsoncms\api\generator\Generator;
13
use samsoncms\api\generator\Metadata;
14
use samsonframework\orm\DatabaseInterface;
15
16
/**
17
 * Entity classes generator.
18
 * @package samsoncms\api
19
 */
20
class GeneratorApi extends Generator
21
{
22
23
    /**
24
     * Generator constructor.
25
     * @param DatabaseInterface $database Database instance
26
     * @throws ParentEntityNotFound
27
     * @throws \samsoncms\api\exception\AdditionalFieldTypeNotFound
28
     */
29
    public function __construct(DatabaseInterface $database)
30
    {
31
        parent::__construct($database);
32
33
        /**
34
         * Fill metadata only with structures which have to be generated
35
         */
36
        $this->fillMetadata();
37
    }
38
39
    /**
40
     * Generate entity classes.
41
     *
42
     * @param string $namespace Base namespace for generated classes
43
     *
44
     * @return string Generated PHP code for entity classes
45
     * @throws ParentEntityNotFound
46
     * @throws \samsoncms\api\exception\AdditionalFieldTypeNotFound
47
     */
48
    public function createEntityClasses($namespace = __NAMESPACE__)
49
    {
50
        $classes = "\n" . 'namespace ' . $namespace . '\\generated;';
51
        $classes .= "\n";
52
        $classes .= "\n" . 'use ' . $namespace . '\renderable\FieldsTable;';
53
        $classes .= "\n" . 'use ' . $namespace . '\field\Row;';
54
        $classes .= "\n" . 'use \samsoncms\api\Entity;';
55
        $classes .= "\n" . 'use \samsonframework\core\ViewInterface;';
56
        $classes .= "\n" . 'use \samsonframework\orm\ArgumentInterface;';
57
        $classes .= "\n" . 'use \samsonframework\orm\QueryInterface;';
58
        $classes .= "\n" . 'use \samson\activerecord\dbQuery;';
59
        $classes .= "\n";
60
61
        // Iterate all entities metadata
62
        foreach ($this->metadata as $metadata) {
63
            // Generate classes of default type
64
            if ($metadata->type === Metadata::TYPE_DEFAULT) {
65
                $classes .= $this->createEntityClass($metadata);
66
                $classes .= $this->createQueryClass($metadata);
67
                $classes .= $this->createCollectionClass(
68
                    $metadata,
69
                    $this->fullEntityName($metadata->entity . 'Query', $namespace),
70
                    array(\samsoncms\api\Renderable::class)
71
                );
72
73
                // Generate classes of table type
74
            } elseif ($metadata->type === Metadata::TYPE_TABLE) {
75
                $classes .= $this->createTableRowClass($metadata);
76
                $classes .= $this->createTableClass($metadata);
77
            }
78
        }
79
80
        // Make correct code formatting
81
        return $this->formatTab($classes);
82
    }
83
84
    /**
85
     * Create entity PHP class code.
86
     *
87
     * @param Metadata $metadata  Entity metadata
88
     * @param string   $namespace Namespace of generated class
89
     * @return string Generated entity query PHP class code
90
     */
91
    protected function createEntityClass(Metadata $metadata, $namespace = __NAMESPACE__)
92
    {
93
        /**
94
         * TODO: Parent problem
95
         * Should be changed to merging fields instead of extending with OOP for structure_relation support
96
         * or creating traits and using them on shared parent entities.
97
         */
98
99
        $this->generator
100
            ->multiComment(array('"' . $metadata->entityRealName . '" entity class'))
101
            ->defClass($metadata->entity, null !== $metadata->parent ? $this->fullEntityName($metadata->parent->entity, $namespace) : 'Entity')
102
            ->commentVar('string', '@deprecated Entity full class name, use ::class')
103
            ->defClassConst('ENTITY', $this->fullEntityName($metadata->entity, $namespace))
104
            ->commentVar('string', 'Entity manager full class name')
105
            ->defClassConst('MANAGER', $this->fullEntityName($metadata->entity, $namespace) . 'Query')
106
            ->commentVar('string', 'Entity database identifier')
107
            ->defClassConst('IDENTIFIER', $metadata->entityID)
108
            ->commentVar('string', 'Not transliterated entity name')
109
            ->defClassVar('$viewName', 'protected static', $metadata->entityRealName);
110
111
        foreach ($metadata->allFieldIDs as $fieldID => $fieldName) {
112
            $this->generator
113
                ->commentVar('string', $metadata->fieldDescriptions[$fieldID] . ' variable name')
114
                ->defClassConst('F_' . $fieldName, $fieldName)
115
                ->commentVar($metadata->allFieldTypes[$fieldID], $metadata->fieldDescriptions[$fieldID])
116
                ->defClassVar('$' . $fieldName, 'public');
117
        }
118
119
        return $this->generator
120
            ->commentVar('array', 'Collection of navigation identifiers')
121
            ->defClassVar('$navigationIDs', 'protected static', array($metadata->entityID))
122
            ->defClassVar('$_sql_select', 'public static ', $metadata->arSelect)
123
            ->defClassVar('$_attributes', 'public static ', $metadata->arAttributes)
124
            ->defClassVar('$_map', 'public static ', $metadata->arMap)
125
            ->defClassVar('$_sql_from', 'public static ', $metadata->arFrom)
126
            ->defClassVar('$_own_group', 'public static ', $metadata->arGroup)
127
            ->defClassVar('$_relation_alias', 'public static ', $metadata->arRelationAlias)
128
            ->defClassVar('$_relation_type', 'public static ', $metadata->arRelationType)
129
            ->defClassVar('$_relations', 'public static ', $metadata->arRelations)
130
            ->defClassVar('$fieldIDs', 'protected static ', $metadata->allFieldIDs)
131
            ->defClassVar('$fieldValueColumns', 'protected static ', $metadata->allFieldValueColumns)
132
            ->endClass()
133
            ->flush();
134
    }
135
136
    /**
137
     * Create entity query PHP class code.
138
     *
139
     * @param Metadata $metadata      Entity metadata
140
     * @param string   $defaultParent Parent class name
141
     * @param array    $use           Collection of traits
142
     * @param string   $namespace     Namespace of generated class
143
     *
144
     * @return string Generated entity query PHP class code
145
     */
146
    protected function createQueryClass(Metadata $metadata, $defaultParent = '\samsoncms\api\query\Entity', $use = array(), $namespace = __NAMESPACE__)
147
    {
148
        $this->generateQuerableClassHeader($metadata, 'Query', $defaultParent, $use, $namespace);
149
150
        foreach ($metadata->allFieldIDs as $fieldID => $fieldName) {
151
            // TODO: Add different method generation depending on their field type
152
            $this->generator->text($this->generateFieldConditionMethod(
153
                $fieldName,
154
                $fieldID,
155
                $metadata->allFieldTypes[$fieldID]
156
            ));
157
        }
158
159
        return $this->generator
160
            ->commentVar('array', 'Collection of real additional field names')
161
            ->defClassVar('$fieldRealNames', 'public static', $metadata->realNames)
162
            ->commentVar('array', 'Collection of additional field names')
163
            ->defClassVar('$fieldNames', 'public static', $metadata->allFieldNames)
164
            // TODO: two above fields should be protected
165
            ->commentVar('array', 'Collection of navigation identifiers')
166
            ->defClassVar('$navigationIDs', 'protected static', array($metadata->entityID))
167
            ->commentVar('string', 'Entity full class name')
168
            ->defClassVar('$identifier', 'protected static', $this->fullEntityName($metadata->entity, $namespace))
169
            ->commentVar('array', 'Collection of localized additional fields identifiers')
170
            ->defClassVar('$localizedFieldIDs', 'protected static', $metadata->localizedFieldIDs)
171
            ->commentVar('array', 'Collection of NOT localized additional fields identifiers')
172
            ->defClassVar('$notLocalizedFieldIDs', 'protected static', $metadata->notLocalizedFieldIDs)
173
            ->commentVar('array', 'Collection of localized additional fields identifiers')
174
            ->defClassVar('$fieldIDs', 'protected static', $metadata->allFieldIDs)
175
            ->commentVar('array', 'Collection of additional fields value column names')
176
            ->defClassVar('$fieldValueColumns', 'protected static', $metadata->allFieldValueColumns)
177
            ->endClass()
178
            ->flush();
179
    }
180
181
    /**
182
     * Start quearable class declaration.
183
     *
184
     * @param Metadata $metadata      Entity metadata
185
     * @param string   $suffix        Entity class name suffix
186
     * @param string   $defaultParent Parent class name
187
     * @param array    $use           Collection of traits
188
     * @param string   $namespace     Namespace of generated class
189
     */
190
    protected function generateQuerableClassHeader(Metadata $metadata, $suffix, $defaultParent, $use, $namespace = __NAMESPACE__)
191
    {
192
        $this->generator
193
            ->multiComment(array(
194
                'Class for fetching "' . $metadata->entityRealName . '" instances from database',
195
                '@method ' . $this->fullEntityName($metadata->entity, $namespace) . ' first();',
196
                '@method ' . $this->fullEntityName($metadata->entity, $namespace) . '[] find();',
197
            ))
198
            ->defClass($metadata->entity . $suffix, $defaultParent);
199
200
201
        // Add traits to generated classes
202
        $this->generateTraitsUsage($use);
203
    }
204
205
    /**
206
     * Generate class traits usage.
207
     *
208
     * @param array $use Collection of trait names
209
     */
210
    protected function generateTraitsUsage($use = array())
211
    {
212
        // Add traits to generated classes
213
        foreach ($use as $trait) {
214
            $this->generator->newLine();
215
            $this->generator->tabs('use \\' . ltrim($trait, '\\') . ';');
216
        }
217
        $this->generator->newLine();
218
    }
219
220
    /**
221
     * Generate Query::where() analog for specific field.
222
     *
223
     * @param string $fieldName Field name
224
     * @param string $fieldId Field primary identifier
225
     * @param string $fieldType Field PHP type
226
     * @return string Generated PHP method code
227
     */
228
    protected function generateFieldConditionMethod($fieldName, $fieldId, $fieldType)
229
    {
230
        $code = "\n\t" . '/**';
231
        $code .= "\n\t" . ' * Add '.$fieldName.'(#' . $fieldId . ') field query condition.';
232
        $code .= "\n\t" . ' * @param ' . $fieldType . ' $value Field value';
233
        $code .= "\n\t" . ' * @return $this Chaining';
234
        $code .= "\n\t" . ' * @see Generic::where()';
235
        $code .= "\n\t" . ' */';
236
        $code .= "\n\t" . 'public function ' . $fieldName . '($value, $relation = ArgumentInterface::EQUAL)';
237
        $code .= "\n\t" . "{";
238
        $code .= "\n\t\t" . 'return $this->where("' . $fieldName . '", $value, $relation);';
239
240
        return $code . "\n\t" . "}"."\n";
241
    }
242
243
    /**
244
     * Create entity collection PHP class code.
245
     *
246
     * @param Metadata $metadata      Entity metadata
247
     * @param string   $suffix        Generated class name suffix
248
     * @param string   $defaultParent Parent class name
249
     * @param array    $use           Collection of traits
250
     * @param string   $namespace     Namespace of generated class
251
     *
252
     * @return string Generated entity query PHP class code
253
     */
254
    protected function createCollectionClass(Metadata $metadata, $defaultParent, $use = array(), $suffix = 'Collection', $namespace = __NAMESPACE__)
0 ignored issues
show
Unused Code introduced by
The parameter $suffix is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
255
    {
256
        $this->generateQuerableClassHeader($metadata, 'Collection', $defaultParent, $use, $namespace);
257
258
        return $this->generator
259
            ->text($this->generateConstructorCollectionClass())
260
            ->endClass()
261
            ->flush();
262
    }
263
264
    /**
265
     * Generate constructor for collection class.
266
     */
267 View Code Duplication
    protected function generateConstructorCollectionClass()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
268
    {
269
        $class = "\n\t".'/**';
270
        $class .= "\n\t".' * @param ViewInterface $renderer Rendering instance';
271
        $class .= "\n\t" . ' * @param QueryInterface $query Database query instance';
272
        $class .= "\n\t".' * @param string $locale Localization identifier';
273
        $class .= "\n\t".' */';
274
        $class .= "\n\t" . 'public function __construct(ViewInterface $renderer, QueryInterface $query = null, $locale = null)';
275
        $class .= "\n\t".'{';
276
        $class .= "\n\t\t" . '$this->renderer = $renderer;';
277
        $class .= "\n\t\t" . 'parent::__construct(isset($query) ? $query : new dbQuery(), $locale);';
278
        $class .= "\n\t".'}'."\n";
279
280
        return $class;
281
    }
282
283
    /**
284
     * Create fields table row PHP class code.
285
     *
286
     * @param Metadata $metadata metadata of entity
287
     * @param string $namespace Namespace of generated class
288
     *
289
     * @return string Generated entity query PHP class code
290
     * @throws exception\AdditionalFieldTypeNotFound
291
     */
292
    protected function createTableRowClass(Metadata $metadata, $namespace = __NAMESPACE__)
0 ignored issues
show
Unused Code introduced by
The parameter $namespace is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
293
    {
294
        $this->generator
295
            ->multiComment(array('Class for getting "' . $metadata->entityRealName . '" fields table rows'))
296
            ->defClass($this->entityName($metadata->entityRealName) . 'TableRow', 'Row');
297
298
        $fieldIDs = array();
299
        foreach ($this->navigationFields($metadata->entityID) as $fieldID => $fieldRow) {
300
            $fieldName = $this->fieldName($fieldRow['Name']);
301
302
            // Fill field ids array
303
            $fieldIDs[$fieldName] = $fieldID;
304
305
            $this->generator
306
                ->commentVar($metadata->allFieldTypes[$fieldID], $fieldRow['Description'] . ' Field #' . $fieldID . ' variable name')
307
                ->defClassConst('F_' . strtoupper($fieldName), $fieldName)
308
                ->commentVar($metadata->allFieldTypes[$fieldID], $fieldRow['Description'] . ' Field #' . $fieldID . ' row value')
309
                ->defVar('public $' . $fieldName)
310
                ->text("\n");
311
        }
312
313
        return $this->generator
314
            ->commentVar('array', 'Collection of additional fields identifiers')
315
            ->defClassVar('$fieldIDs', 'public static', $fieldIDs)
316
            ->endClass()
317
            ->flush();
318
    }
319
320
    /**
321
     * Create fields table PHP class code.
322
     *
323
     * @param Metadata $metadata metadata of entity
324
     * @param string $namespace Namespace of generated class
325
     * @return string Generated entity query PHP class code
326
     * @throws exception\AdditionalFieldTypeNotFound
327
     */
328
    protected function createTableClass(Metadata $metadata, $namespace = __NAMESPACE__)
0 ignored issues
show
Unused Code introduced by
The parameter $namespace is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
329
    {
330
        $this->generator
331
            ->multiComment(array('Class for getting "'.$metadata->entityRealName.'" fields table'))
332
            ->defClass($this->entityName($metadata->entityRealName) . 'Table', 'FieldsTable');
333
334
        // Add renderable trait
335
        $this->generateTraitsUsage(array(\samsoncms\api\Renderable::class));
336
337
        // Iterate additional fields
338
        $fields = array();
339
        foreach ($this->navigationFields($metadata->entityID) as $fieldID => $fieldRow) {
340
            $fieldName = $this->fieldName($fieldRow['Name']);
341
342
            $this->generator
343
                ->text($this->generateTableFieldMethod(
344
                    $fieldName,
345
                    $fieldRow[Field::F_PRIMARY],
346
                    $fieldRow[Field::F_TYPE]
347
                ))
348
                ->commentVar($metadata->allFieldTypes[$fieldID], $fieldRow['Description'] . ' Field #' . $fieldID . ' variable name')
349
                ->defClassConst('F_' . $fieldName, $fieldName);
350
351
            // Collection original to new one field names
352
            $fields[$fieldRow['Name']] = $fieldName;
353
        }
354
355
        // TODO: Add generator method generation logic
356
        $constructor = $this->generateConstructorTableClass();
357
358
        $this->generator->text($constructor);
359
360
        return $this->generator
361
            ->commentVar('string', 'Entity database identifier')
362
            ->defClassConst('IDENTIFIER', $metadata->entityID)
363
            ->commentVar('array', 'Collection of real additional field names')
364
            ->defClassVar('$fieldsRealNames', 'public static', $fields)
365
            ->commentVar('array', 'Collection of navigation identifiers')
366
            ->defClassVar('$navigationIDs', 'protected static', array($metadata->entityID))
367
            ->commentVar('string', 'Row class name')
368
            ->defClassVar('$identifier', 'protected', $this->fullEntityName($this->entityName($metadata->entityRealName) . 'TableRow'))
369
            ->endClass()
370
            ->flush();
371
    }
372
373
    /**
374
     * Generate FieldsTable::values() analog for specific field.
375
     *
376
     * @param string $fieldName Field name
377
     * @param string $fieldId   Field primary identifier
378
     * @param string $fieldType Field PHP type
379
     *
380
     * @return string Generated PHP method code
381
     */
382
    protected function generateTableFieldMethod($fieldName, $fieldId, $fieldType)
383
    {
384
        $code = "\n\t" . '/**';
385
        $code .= "\n\t" . ' * Get table column ' . $fieldName . '(#' . $fieldId . ') values.';
386
        $code .= "\n\t" . ' * @return array Collection(' . Field::phpType($fieldType) . ') of table column values';
387
        $code .= "\n\t" . ' */';
388
        $code .= "\n\t" . 'public function ' . $fieldName . '()';
389
        $code .= "\n\t" . "{";
390
        $code .= "\n\t\t" . 'return $this->values(' . $fieldId . ');';
391
392
        return $code . "\n\t" . "}" . "\n";
393
    }
394
395
    /**
396
     * Generate constructor for table class.
397
     */
398 View Code Duplication
    protected function generateConstructorTableClass()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
399
    {
400
        $class = "\n\t" . '/**';
401
        $class .= "\n\t" . ' * @param QueryInterface $query Database query instance';
402
        $class .= "\n\t" . ' * @param ViewInterface $renderer Rendering instance';
403
        $class .= "\n\t" . ' * @param integer $entityID Entity identifier to whom this table belongs';
404
        $class .= "\n\t" . ' * @param string $locale Localization identifier';
405
        $class .= "\n\t" . ' */';
406
        $class .= "\n\t" . 'public function __construct(QueryInterface $query, ViewInterface $renderer, $entityID, $locale = null)';
407
        $class .= "\n\t" . '{';
408
        $class .= "\n\t\t" . 'parent::__construct($query, $renderer, static::$navigationIDs, $entityID, $locale);';
409
        $class .= "\n\t" . '}' . "\n";
410
411
        return $class;
412
    }
413
414
    /**
415
     * Generate classes for entity additional field gallery
416
     *
417
     * @param Metadata $metadata Entity metadata
418
     */
419
    public function createGalleryClass(Metadata $metadata)
420
    {
421
        // Iterate entity additional fields
422
        foreach ($metadata->allFieldCmsTypes as $fieldID => $fieldType) {
423
            // We need only gallery fields
424
            if ($fieldType === Field::TYPE_GALLERY) {
0 ignored issues
show
Coding Style introduced by
Blank line found at start of control structure
Loading history...
425
426
            }
427
            // TODO: Add different method generation depending on their field type
428
            $this->generator->text($this->generateFieldConditionMethod(
429
                $fieldName,
0 ignored issues
show
Bug introduced by
The variable $fieldName does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
430
                $fieldID,
431
                $metadata->allFieldTypes[$fieldID]
432
            ));
433
        }
434
    }
435
436
    /**
437
     * Generate Query::where() analog for specific field.
438
     *
439
     * @param string $fieldName Field name
440
     * @param string $fieldId   Field primary identifier
441
     * @param string $fieldType Field PHP type
442
     *
443
     * @return string Generated PHP method code
444
     */
445
    protected function generateLocalizedFieldConditionMethod($fieldName, $fieldId, $fieldType)
446
    {
447
        $code = "\n\t" . '/**';
448
        $code .= "\n\t" . ' * Add ' . $fieldName . '(#' . $fieldId . ') field query condition.';
449
        $code .= "\n\t" . ' * @param ' . Field::phpType($fieldType) . ' $value Field value';
450
        $code .= "\n\t" . ' * @return $this Chaining';
451
        $code .= "\n\t" . ' * @see Generic::where()';
452
        $code .= "\n\t" . ' */';
453
        $code .= "\n\t" . 'public function ' . $fieldName . '($value)';
454
        $code .= "\n\t" . "{";
455
        $code .= "\n\t\t" . 'return $this->where("' . $fieldName . '", $value);';
456
457
        return $code . "\n\t" . "}" . "\n";
458
    }
459
460
    /**
461
     * Generate constructor for application class.
462
     */
463 View Code Duplication
    protected function generateConstructorApplicationClass()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
464
    {
465
        $class = "\n\t" . '/**';
466
        $class .= "\n\t" . ' * Render materials list with pager';
467
        $class .= "\n\t" . ' *';
468
        $class .= "\n\t" . ' * @param string $navigationId Structure identifier';
469
        $class .= "\n\t" . ' * @param string $search Keywords to filter table';
470
        $class .= "\n\t" . ' * @param int $page Current table page';
471
        $class .= "\n\t" . ' * @return array Asynchronous response containing status and materials list with pager on success';
472
        $class .= "\n\t" . ' * or just status on asynchronous controller failure';
473
        $class .= "\n\t" . ' */';
474
        $class .= "\n\t" . 'public function __async_collection($navigationId = \'0\', $search = \'\', $page = 1)';
475
        $class .= "\n\t" . '{';
476
        $class .= "\n\t\t" . 'return parent::__async_collection(self::$navigation, $search, $page);';
477
        $class .= "\n\t" . '}' . "\n";
478
479
        return $class;
480
    }
481
482
    /**
483
     * Generate constructor for application class.
484
     */
485 View Code Duplication
    protected function generateConstructorApplicationCollectionClass()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
486
    {
487
        $class = "\n\t" . '/**';
488
        $class .= "\n\t" . ' * Generic collection constructor';
489
        $class .= "\n\t" . ' *';
490
        $class .= "\n\t" . ' * @param RenderInterface $renderer View render object';
491
        $class .= "\n\t" . ' * @param QueryInterface $query Query object';
492
        $class .= "\n\t" . ' */';
493
        $class .= "\n\t" . 'public function __async_collection($renderer, $query = null, $pager = null)';
494
        $class .= "\n\t" . '{';
495
        $class .= "\n\t\t" . 'return parent::__async_collection($renderer, $query = null, $pager = null);';
496
        $class .= "\n\t\t" . '$this->fields = array(';
497
        $class .= "\n\t\t\t" . 'new Control(),';
498
        $class .= "\n\t\t" . ');';
499
        $class .= "\n\t" . '}' . "\n";
500
501
        return $class;
502
    }
503
}
504
//[PHPCOMPRESSOR(remove,end)]
505