protected function setupFormErrorContext($action, $error_message, BaseForm $form = null, \Exception $exception = null)
    {
        if ($error_message !== false) {
            // Log the error message
            Tlog::getInstance()->error(
                $this->getTranslator()->trans(
                    "Error during %action process : %error. Exception was %exc",
                    array(
                        '%action' => $action,
                        '%error'  => $error_message,
                        '%exc'    => $exception != null ? $exception->getMessage() : 'no exception'
                    )
                )
            );

            if ($form != null) {
                // Mark the form as errored
                $form->setErrorMessage($error_message);

                // Pass it to the parser context
                $this->getParserContext()->addForm($form);
            }

            // Pass the error message to the parser.
            $this->getParserContext()->setGeneralError($error_message);
        }
    }
protected function setupFormErrorContext($action, $error_message, BaseForm $form = null, \Exception $exception = null)
    {
        if ($error_message !== false) {
            // Log the error message
            Tlog::getInstance()->error(
                $this->getTranslator()->trans(
                    "Error during %action process : %error. Exception was %exc",
                    array(
                        '%action' => $action,
                        '%error'  => $error_message,
                        '%exc'    => $exception != null ? $exception->getMessage() : 'no exception'
                    )
                )
            );

            if ($form != null) {
                // Mark the form as errored
                $form->setErrorMessage($error_message);

                // Pass it to the parser context
                $this->getParserContext()->addForm($form);
            }

            // Pass the error message to the parser.
            $this->getParserContext()->setGeneralError($error_message);
        }
    }
protected function setupFormErrorContext ( $ action , $ error_message , BaseForm $ form = null , \ Exception $ exception = null ) { if ( $ error_message !== false ) { // Log the error message Tlog :: getInstance ( ) -> error ( $ this -> getTranslator ( ) -> trans ( "Error during %action process : %error. Exception was %exc" , array ( '%action' => $ action , '%error' => $ error_message , '%exc' => $ exception != null ? $ exception -> getMessage ( ) : 'no exception' ) ) ) ; if ( $ form != null ) { // Mark the form as errored $ form -> setErrorMessage ( $ error_message ) ; // Pass it to the parser context $ this -> getParserContext ( ) -> addForm ( $ form ) ; } // Pass the error message to the parser. $ this -> getParserContext ( ) -> setGeneralError ( $ error_message ) ; } }
Setup the error context when an error occurs in a action method.

@param string     $action        the action that caused the error (category modification, variable creation, currency update, etc.)
@param BaseForm   $form          the form where the error occured, or null if no form was involved
@param string     $error_message the error message
@param \Exception $exception     the exception or null if no exception
Setup the error context when an error occurs in a action method .