Skip to content

Instantly share code, notes, and snippets.

@Pictor13
Last active July 11, 2018 19:17
Show Gist options
  • Save Pictor13/6bbdda8d43df8cbb0db45f4a60b5c6ab to your computer and use it in GitHub Desktop.
Save Pictor13/6bbdda8d43df8cbb0db45f4a60b5c6ab to your computer and use it in GitHub Desktop.
Override of AgaviValidationManager->getErrorNames() [that probably was forgotten to be implemented... ... anyway was deprecated]. Useful for retrieving the errors by the name that was used with 'throwError()' in the Validator or that is used for translations in the 'validate.xml'.
<?php
/**
* Retrieve an array of error names.
*
* @return array An indexed array of error names.
*
* @author Igor Pellegrini <[email protected]>
* @author Sean Kerr <[email protected]>
* @author Dominik del Bondio <[email protected]>
* @since 0.9.0
*
* @deprecated 1.0.0
*/
public function getErrorNames($minSeverity = null)
{
$errors = array();
foreach($this->getIncidents($minSeverity) as $incident) {
foreach ($incident->getErrors() as $error) {
$errors[] = $error->getName();
}
}
return array_values(array_unique($errors));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment