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 based off of view

Hi all -

Is there any way to base a model off of a database view, apart from possibly specifying manual metadata (haven't tried this yet)? The datastore is oracle, which means that the automatic metadata query doesn't find a table for the model given that ALL_TABLES doesn't include views.



16.3k

Just sharing, I have been able to create a model using Phalcon Dev tools based on a view. It creates the class without any problems. Haven't used it in my project though.

Is it an Oracle view? I haven't tried this with any other datastore. It's also worth noting that since you haven't used it, you probably wouldn't have seen the exception that gets thrown when the ORM tries to run the metadata query.



16.3k

Sorry, I didn't mention. I am using MySQL 5.6. Yes, I don't have idea about your error, you didn't mention the details. Just a thought, does the view have insert / update capability.