25 lines
574 B
PHP
25 lines
574 B
PHP
<?php
|
|
namespace dominion\api;
|
|
|
|
use Yii;
|
|
|
|
|
|
class GraphQLResultSaveHalper
|
|
{
|
|
public static function setResultValue($model, $value)
|
|
{
|
|
$model->id = isset($value["id"]) ? $value["id"] : 0;
|
|
if(isset($value["errors"]))
|
|
{
|
|
foreach ($value["errors"] as $errors)
|
|
{
|
|
foreach ($errors['messages'] as $message)
|
|
{
|
|
$model->addError($errors['code'], $message);
|
|
}
|
|
}
|
|
}
|
|
return isset($value['status']) && $value['status'] == 'success';
|
|
}
|
|
}
|