Unverified Commit 39dcce13 authored by Côme Chilliet's avatar Côme Chilliet
Browse files

:sparkles: feat(errors) Add toArray function for webservice integration

issue #6071
Showing with 25 additions and 0 deletions
+25 -0
...@@ -30,4 +30,13 @@ class FusionDirectoryError extends Error ...@@ -30,4 +30,13 @@ class FusionDirectoryError extends Error
$this->htmlMessage = $htmlMessage; $this->htmlMessage = $htmlMessage;
parent::__construct(htmlunescape(strip_tags($htmlMessage)), $code, $previous); parent::__construct(htmlunescape(strip_tags($htmlMessage)), $code, $previous);
} }
public function toArray (): array
{
return [
'message' => $this->getMessage(),
'line' => $this->getLine(),
'file' => $this->getFile(),
];
}
} }
...@@ -43,6 +43,22 @@ class SimplePluginCheckError extends FusionDirectoryError ...@@ -43,6 +43,22 @@ class SimplePluginCheckError extends FusionDirectoryError
parent::__construct($htmlMessage, $code, $previous); parent::__construct($htmlMessage, $code, $previous);
} }
public function toArray (): array
{
$array = parent::toArray();
if (isset($this->tab)) {
$array['dn'] = $this->tab->parent->getBaseObject()->dn;
$array['tab'] = get_class($this->tab);
}
if (isset($this->attribute)) {
$array['attribute'] = $this->attribute->getLdapName();
}
return $array;
}
public function computeMsgDialogParameters (): array public function computeMsgDialogParameters (): array
{ {
$html = ''; $html = '';
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment