QuickForm: get unique error helpers from DOF

This commit is contained in:
Thomas Gelf 2017-09-11 15:18:45 +02:00
parent e752d7f7ae
commit 313dba50cb
2 changed files with 20 additions and 20 deletions

View File

@ -962,26 +962,6 @@ abstract class DirectorObjectForm extends DirectorForm
return $default;
}
protected function addUniqueErrorMessage($msg)
{
if (! in_array($msg, $this->getErrorMessages())) {
$this->addErrorMessage($msg);
}
return $this;
}
protected function addUniqueException(Exception $e)
{
$msg = $this->getErrorMessageForException($e);
if (! in_array($msg, $this->getErrorMessages())) {
$this->addErrorMessage($msg);
}
return $this;
}
public function loadObject($id)
{
/** @var DbObject $class */

View File

@ -406,6 +406,26 @@ abstract class QuickForm extends QuickBaseForm
}
}
public function addUniqueErrorMessage($msg)
{
if (! in_array($msg, $this->getErrorMessages())) {
$this->addErrorMessage($msg);
}
return $this;
}
public function addUniqueException(Exception $e)
{
$msg = $this->getErrorMessageForException($e);
if (! in_array($msg, $this->getErrorMessages())) {
$this->addErrorMessage($msg);
}
return $this;
}
protected function getErrorMessageForException(Exception $e)
{
$file = preg_split('/[\/\\\]/', $e->getFile(), -1, PREG_SPLIT_NO_EMPTY);