kuvalda-api/GraphQLResultSaveHalper.php

25 lines
574 B
PHP
Raw Permalink Normal View History

2024-11-20 15:32:19 +03:00
<?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';
}
}