getRequest()->get($identity, null);
}else if( $primaryKeyFromMethod == "POST" ){
$primaryKeys[] = Yii::$app->getRequest()->post($identity, null);
}else{
throw new Exception('primaryKeyFromMethod must be GET or POST');
}
}
}
return $primaryKeys;
}
public static function getErrorString($result)
{
if( !is_array($result) ){
$results = [$result];
}else{
$results = $result;
}
$error = "";
foreach ($results as $result) {
if ($result instanceof Model) {//if returns a model, will call getErrors() get the error description string
$items = $result->getErrors();
foreach ($items as $item) {
foreach ($item as $e) {
$error .= $e . "
";
}
}
$error = rtrim($error, "
");
} else if (is_string($result)) {//if returns a string, they will be the error description
$error = $result;
} else {
throw new Exception("doCreate/doUpdate/doDelete/doSort closure must return boolean, yii\base\Model or string");
}
}
return $error;
}
}