toArray method

Hello, in toArray method says : "We only assign values to the public properties".

Why only public props ? I think it will be more comfortably to set protected attributes to a Model through setters.

afaik toArray uses the info from columnMap, so having setters/getters wont change it's behaviour (at least it hasnt for me)



380

No, it doesnt work if props are protected/private, only if public.



380

It says https://docs.phalconphp.com/en/3.2/db-models#properties-setters-getters that it should be work. But if My class extends from MongoCollection its not working, toArray cant working with protected/private props...

edited Jul '17

Oh so you mean mongocollection then yea i think you need public, i think it's zephir bug :/

Nothing more really ned to add https://github.com/phalcon/zephir/issues/1245

Only fix i see you can add toArray method in php - https://github.com/phalcon/cphalcon/blob/master/phalcon/mvc/collection.zep#L1612



380

Maybe use Reflection in zep ?

Oh so you mean mongocollection then yea i think you need public, i think it's zephir bug :/

Nothing more really ned to add https://github.com/phalcon/zephir/issues/1245

Only fix i see you can add toArray method in php - https://github.com/phalcon/cphalcon/blob/master/phalcon/mvc/collection.zep#L1612

That might be a way or maybe casting it to array could be enough.