Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
(cherry picked from commit 56bbf0e)

Conflicts:
	ext/forms/form.c
  • Loading branch information
sjinks committed Oct 9, 2013
1 parent a66ce16 commit 1009a3d
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions ext/forms/form.c
Original file line number Diff line number Diff line change
Expand Up @@ -560,8 +560,7 @@ PHP_METHOD(Phalcon_Forms_Form, isValid){
*/
PHP_METHOD(Phalcon_Forms_Form, getMessages){

zval *by_item_name = NULL, *messages, *group, *element_messages = NULL;
zval *element = NULL;
zval *by_item_name = NULL, *messages;
HashTable *ah0;
HashPosition hp0;
zval **hd;
Expand All @@ -588,23 +587,20 @@ PHP_METHOD(Phalcon_Forms_Form, getMessages){
RETURN_CCTOR(messages);
}

PHALCON_INIT_VAR(group);
object_init_ex(group, phalcon_validation_message_group_ce);
phalcon_call_method_noret(group, "__construct");

phalcon_is_iterable(messages, &ah0, &hp0, 0, 0);

while (zend_hash_get_current_data_ex(ah0, (void**) &hd, &hp0) == SUCCESS) {
object_init_ex(return_value, phalcon_validation_message_group_ce);
phalcon_call_method_noret(return_value, "__construct");

PHALCON_GET_HKEY(element, ah0, hp0);
PHALCON_GET_HVALUE(element_messages);
if (Z_TYPE_P(messages) == IS_ARRAY) {
phalcon_is_iterable(messages, &ah0, &hp0, 0, 0);

phalcon_call_method_p1_noret(group, "appendmessages", element_messages);
while (zend_hash_get_current_data_ex(ah0, (void**) &hd, &hp0) == SUCCESS) {

zend_hash_move_forward_ex(ah0, &hp0);
phalcon_call_method_p1_noret(return_value, "appendmessages", *hd);
zend_hash_move_forward_ex(ah0, &hp0);
}
}

RETURN_CTOR(group);
PHALCON_MM_RESTORE();
}

/**
Expand Down

0 comments on commit 1009a3d

Please sign in to comment.