We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Disabled "dependencyInjector" Output on Model Object

Hello folks,

I have a question:

When using MyModel::findFirst() I get an object of MyModel. When doing print_r(MyModel::findFirst()) I get the attributes I defined and so many more stuff in [_dependencyInjector:protected] => Phalcon\Di\FactoryDefault Object

Can I disable the output of [_dependencyInjector:protected] => Phalcon\Di\FactoryDefault Object for all models so that only the attributes will be returned?

Thanks for your help!



145.0k
Accepted
answer

Yes. You just need to call ->toArray()



919

Awesome! Thanks very much!