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

Model without Table

Hi all,

I'm working on a project that uses a remote RESTful API as data source. So, I don't have/need a database in my project. Is it possible to create model without database table in Phalcon?

Similar Project: https://maurodonadio.wordpress.com/2014/08/08/restful-client-server-with-mvc-design-pattern/

edited Jul '17

You can define your db service in such a way that will offer such functionality, that's for models' connection, and for actual tables - I think you'd need to override default model's classes for that. Generally speaking, you don't need much of the models' functionalities when working with remote API's, so you can simply build your own layer of models using Phalcon interfaces.

If you're not interacting with a table, I'm not sure there's a lot of functionality in Phalcon's base model class that your really need. I'd suggest just making your model a plain PHP class.