Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

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!


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


Awesome! Thanks very much!