Programming Language PHP

Namespace Oro\Component\Action\Event

Class ExtendableConditionEvent

Method/Function getErrors

Total Examples 1

1 code examples of PHP Oro\Component\Action\Event\ExtendableConditionEvent::getErrors extracted from open source projects

Was this example useful?
0
                                                    protected function processErrors(ExtendableConditionEvent $event)
    {
        $errors = [];
        foreach ($event->getErrors() as $error) {
            $errors[] = $this->translator->trans($error['message']);
        }

        if ($this->options['showErrors'] instanceof PropertyPath) {
            $showErrors = $this->contextAccessor->getValue($event->getContext(), $this->options['showErrors']);
        } else {
            $showErrors = $this->options['showErrors'];
        }

        if ($showErrors) {
            foreach ($errors as $error) {
                $this->flashBag->add($this->options['messageType'], $error);
            }
        }

        if ($event->getContext() instanceof \ArrayAccess) {
            $event->getContext()->offsetSet('errors', $errors);
        }
    }
                                            
ExtendableConditionEvent's Other Methods