Skip to content

Commit

Permalink
Updated Phalcon\Mvc\Model::toArray
Browse files Browse the repository at this point in the history
  • Loading branch information
dreamsxin committed Sep 30, 2014
1 parent 2df5248 commit bb465e5
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions ext/mvc/model.c
Original file line number Diff line number Diff line change
Expand Up @@ -6796,13 +6796,6 @@ PHP_METHOD(Phalcon_Mvc_Model, toArray){

PHALCON_GET_HVALUE(attribute);

if (columns && Z_TYPE_P(columns) == IS_ARRAY) {
if (!phalcon_fast_in_array(attribute, columns TSRMLS_CC)) {
zend_hash_move_forward_ex(ah0, &hp0);
continue;
}
}

/**
* Check if the columns must be renamed
*/
Expand All @@ -6819,6 +6812,14 @@ PHP_METHOD(Phalcon_Mvc_Model, toArray){
} else {
PHALCON_CPY_WRT(attribute_field, attribute);
}

if (columns && Z_TYPE_P(columns) == IS_ARRAY) {
if (!phalcon_fast_in_array(attribute_field, columns TSRMLS_CC) && !phalcon_fast_in_array(attribute, columns TSRMLS_CC)) {
zend_hash_move_forward_ex(ah0, &hp0);
continue;
}
}

if (phalcon_isset_property_zval(this_ptr, attribute_field TSRMLS_CC)) {
PHALCON_OBS_NVAR(value);
phalcon_read_property_zval(&value, this_ptr, attribute_field, PH_NOISY TSRMLS_CC);
Expand Down

0 comments on commit bb465e5

Please sign in to comment.