commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
lib
commercetools-api
src
Models
GraphQl
GraphQLResponseModel.php
1
<?php
2
3
declare(strict_types=1);
9
namespace
Commercetools\Api\Models\GraphQl
;
10
11
use
Commercetools\Base\DateTimeImmutableCollection
;
12
use
Commercetools\Base\JsonObject
;
13
use
Commercetools\Base\JsonObjectModel
;
14
use
Commercetools\Base\MapperFactory
;
15
use stdClass;
16
20
final
class
GraphQLResponseModel
extends
JsonObjectModel
implements
GraphQLResponse
21
{
26
protected
$data
;
27
32
protected
$errors
;
33
34
38
public
function
__construct
(
39
$data
=
null
,
40
?
GraphQLErrorCollection
$errors
=
null
41
) {
42
$this->data =
$data
;
43
$this->errors =
$errors
;
44
}
45
50
public
function
getData
()
51
{
52
if
(is_null($this->data)) {
54
$data
= $this->
raw
(self::FIELD_DATA);
55
if
(is_null(
$data
)) {
56
return
null
;
57
}
58
$this->data =
$data
;
59
}
60
61
return
$this->data
;
62
}
63
68
public
function
getErrors
()
69
{
70
if
(is_null($this->errors)) {
72
$data
= $this->
raw
(self::FIELD_ERRORS);
73
if
(is_null(
$data
)) {
74
return
null
;
75
}
76
$this->errors =
GraphQLErrorCollection::fromArray
(
$data
);
77
}
78
79
return
$this->errors
;
80
}
81
82
86
public
function
setData
(
$data
): void
87
{
88
$this->data =
$data
;
89
}
90
94
public
function
setErrors
(?
GraphQLErrorCollection
$errors
): void
95
{
96
$this->errors =
$errors
;
97
}
98
}
Commercetools\Api\Models\GraphQl\GraphQLErrorCollection
Definition:
GraphQLErrorCollection.php:22
Commercetools\Api\Models\GraphQl\GraphQLResponseModel
Definition:
GraphQLResponseModel.php:21
Commercetools\Api\Models\GraphQl\GraphQLResponseModel\setData
setData($data)
Definition:
GraphQLResponseModel.php:86
Commercetools\Api\Models\GraphQl\GraphQLResponseModel\__construct
__construct( $data=null, ?GraphQLErrorCollection $errors=null)
Definition:
GraphQLResponseModel.php:38
Commercetools\Api\Models\GraphQl\GraphQLResponseModel\$errors
$errors
Definition:
GraphQLResponseModel.php:32
Commercetools\Api\Models\GraphQl\GraphQLResponseModel\setErrors
setErrors(?GraphQLErrorCollection $errors)
Definition:
GraphQLResponseModel.php:94
Commercetools\Api\Models\GraphQl\GraphQLResponseModel\getData
getData()
Definition:
GraphQLResponseModel.php:50
Commercetools\Api\Models\GraphQl\GraphQLResponseModel\getErrors
getErrors()
Definition:
GraphQLResponseModel.php:68
Commercetools\Api\Models\GraphQl\GraphQLResponseModel\$data
$data
Definition:
GraphQLResponseModel.php:26
Commercetools\Base\BaseJsonObject\raw
raw(string $field)
Definition:
BaseJsonObject.php:57
Commercetools\Base\DateTimeImmutableCollection
Definition:
DateTimeImmutableCollection.php:21
Commercetools\Base\JsonObjectModel
Definition:
JsonObjectModel.php:15
Commercetools\Base\MapperFactory
Definition:
MapperFactory.php:16
Commercetools\Base\MapperSequence\fromArray
static fromArray(array $data)
Definition:
MapperSequence.php:56
Commercetools\Api\Models\GraphQl\GraphQLResponse
Definition:
GraphQLResponse.php:15
Commercetools\Base\JsonObject
Definition:
JsonObject.php:15
Commercetools\Api\Models\GraphQl
Definition:
GraphQLError.php:9
Generated by
1.9.1