-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathExportFolderDataRequestBody.php
More file actions
88 lines (83 loc) · 2.98 KB
/
Copy pathExportFolderDataRequestBody.php
File metadata and controls
88 lines (83 loc) · 2.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<?php
declare(strict_types=1);
/**
* This source file is available under the terms of the
* Pimcore Open Core License (POCL)
* Full copyright and license information is available in
* LICENSE.md which is distributed with this source code.
*
* @copyright Copyright (c) Pimcore GmbH (https://www.pimcore.com)
* @license Pimcore Open Core License (POCL)
*/
namespace Pimcore\Bundle\StudioBackendBundle\Export\Attribute\Request;
use Attribute;
use OpenApi\Attributes\Items;
use OpenApi\Attributes\JsonContent;
use OpenApi\Attributes\Property;
use OpenApi\Attributes\RequestBody;
use Pimcore\Bundle\StudioBackendBundle\ExecutionEngine\Util\StepConfig;
use Pimcore\Bundle\StudioBackendBundle\Export\Schema\ExportAllFilter;
use Pimcore\Bundle\StudioBackendBundle\Grid\Schema\Column;
use Pimcore\Bundle\StudioBackendBundle\Util\Constant\ElementTypes;
/**
* @internal
*/
#[Attribute(Attribute::TARGET_METHOD)]
final class ExportFolderDataRequestBody extends RequestBody
{
public function __construct(bool $addDelimiter = true)
{
$configProperties = [
new Property(
property: StepConfig::SETTINGS_HEADER->value,
type: 'string',
enum: StepConfig::values(),
example: StepConfig::SETTINGS_HEADER_TITLE->value
),
];
if ($addDelimiter) {
$configProperties[] = new Property(
property: StepConfig::SETTINGS_DELIMITER->value,
type: 'string',
example: ';'
);
} else {
$configProperties[] = new Property(
property: StepConfig::SETTINGS_SHEET_NAME->value,
type: 'string',
example: 'Sheet1'
);
}
parent::__construct(
content: new JsonContent(
properties: [
new Property(property: 'folders', type: 'array', items: new Items(type: 'integer'), example: [1]),
new Property(
property: 'columns',
type: 'array',
items: new Items(ref: Column::class)
),
new Property(
property: 'filters',
ref: ExportAllFilter::class,
type: 'object'
),
new Property(property: 'config', properties: $configProperties, type: 'object'),
new Property(
property: 'elementType',
type: 'string',
enum: ElementTypes::ALLOWED_TYPES,
example: ElementTypes::TYPE_ASSET
),
new Property(
property: 'classId',
type: 'string',
example: 'CAR',
nullable: true
),
],
type: 'object'
)
);
}
}