public static function createError(Field $field, $type, $message = null)
    {
        $error = new XMLElement($field->get('element_name'), null, array(
            'label' => General::sanitize($field->get('label')),
            'type' => $type,
            'message-id' => ($type === 'missing') ? EventMessages::FIELD_MISSING : EventMessages::FIELD_INVALID,
            'message' => General::sanitize($message)
        ));

        return $error;
    }
public static function createError(Field $field, $type, $message = null)
    {
        $error = new XMLElement($field->get('element_name'), null, array(
            'label' => General::sanitize($field->get('label')),
            'type' => $type,
            'message-id' => ($type === 'missing') ? EventMessages::FIELD_MISSING : EventMessages::FIELD_INVALID,
            'message' => General::sanitize($message)
        ));

        return $error;
    }
public static function createError ( Field $ field , $ type , $ message = null ) { $ error = new XMLElement ( $ field -> get ( 'element_name' ) , null , array ( 'label' => General :: sanitize ( $ field -> get ( 'label' ) ) , 'type' => $ type , 'message-id' => ( $ type === 'missing' ) ? EventMessages :: FIELD_MISSING : EventMessages :: FIELD_INVALID , 'message' => General :: sanitize ( $ message ) ) ) ; return $ error ; }
Given a Field instance, the type of error, and the message, this function
creates an XMLElement node so that it can be added to the `?debug` for the
Event

@since Symphony 2.5.0
@param Field $field
@param string $type
At the moment 'missing' or 'invalid' accepted
@param string $message
@return XMLElement
Given a Field instance the type of error and the message this function creates an XMLElement node so that it can be added to the ?debug for the Event