Proyectos de Subversion LeadersLinked - Services

Rev

Rev 550 | Rev 553 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 550 Rev 551
Línea 2128... Línea 2128...
2128
    /**
2128
    /**
2129
     * Creates a standardized JSON error response with a simple message.
2129
     * Creates a standardized JSON error response with a simple message.
2130
     * @param string $errorMessageKey Identifier for the error message (e.g., a translation key or constant).
2130
     * @param string $errorMessageKey Identifier for the error message (e.g., a translation key or constant).
2131
     * @return JsonModel
2131
     * @return JsonModel
2132
     */
2132
     */
2133
    private function _createSimpleErrorResponse(string $errorMessageKey): JsonModel
2133
    private function _createSimpleErrorResponse($errorMessageKey)
2134
    {
2134
    {
2135
        return new JsonModel([
2135
        return new JsonModel([
2136
            'success' => false,
2136
            'success' => false,
2137
            'data'    => $errorMessageKey 
2137
            'data'    => $errorMessageKey 
2138
        ]);
2138
        ]);
2139
    }
2139
    }
Línea 2140... Línea 2140...
2140
 
2140
 
2141
    /**
2141
    /**
2142
     * Creates a JSON response for form validation errors.
2142
     * Creates a JSON response for form validation errors.
2143
     * Extracts messages from the form and structures them for the client.
2143
     * Extracts messages from the form and structures them for the client.
2144
     * @param \\Laminas\\Form\\FormInterface $form The form instance containing validation messages.
2144
     * @param \Laminas\Form\FormInterface $form The form instance containing validation messages.
2145
     * @return JsonModel
2145
     * @return JsonModel
2146
     */
2146
     */
2147
    private function _createFormErrorResponse(\\Laminas\\Form\\FormInterface $form): JsonModel
2147
    private function _createFormErrorResponse($form)
2148
    {
2148
    {
2149
        $messages = [];
2149
        $messages = [];
2150
        $form_messages = (array) $form->getMessages(); // Get all error messages from the form
2150
        $form_messages = (array) $form->getMessages(); // Get all error messages from the form
2151
        foreach ($form_messages as $fieldname => $field_messages_for_field) {
2151
        foreach ($form_messages as $fieldname => $field_messages_for_field) {