mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-14 16:44:39 +00:00
prettify attribute access in BaseField type and replace uuid retrieval in ApiMutableModelControllerBase, close https://github.com/opnsense/core/issues/2760
This commit is contained in:
parent
2918fb59d6
commit
8967d76f70
@ -297,7 +297,7 @@ abstract class ApiMutableModelControllerBase extends ApiControllerBase
|
||||
Config::getInstance()->save();
|
||||
$result = array(
|
||||
"result" => "saved",
|
||||
"uuid" => str_replace($path . ".", "", $node->__reference)
|
||||
"uuid" => $node->getAttribute('uuid')
|
||||
);
|
||||
} else {
|
||||
$result["result"] = "failed";
|
||||
|
||||
@ -379,6 +379,20 @@ abstract class BaseField
|
||||
return $this->internalAttributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* get attribute by name
|
||||
* @param string $key attribute key
|
||||
* @return null|string value
|
||||
*/
|
||||
public function getAttribute($key)
|
||||
{
|
||||
if (isset($this->internalAttributes[$key])) {
|
||||
return $this->internalAttributes[$key];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get this nodes children
|
||||
* @return array child items
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user