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

Can you create a model of a view?

I have created a view on my system, to access it I create a model?



43.9k

hi,

are you meaning a mysql view ?



11.6k

and a controller...(take a look at the MVC concepts first...Models handle datas representation (from database or object), controller process datas and prepare the presentation, view display that)



81.1k

YES, I want to create a model from a view in the database. But when you run the command "Phalcon model vistakardex" you return me an error message that the table does not exist

hi,

are you meaning a mysql view ?



81.1k

Yes I already know that. I think models of a table but when I do so with a view error that view does not exist. What is the correct procedure for access this view? A model?

and a controller...(take a look at the MVC concepts first...Models handle datas representation (from database or object), controller process datas and prepare the presentation, view display that)



43.9k

That's strange. I know that this feature was working (model generation from a postgres db view with devtools) with phalcon.

I will try with new 3.0.0 ....

YES, I want to create a model from a view in the database. But when you run the command "Phalcon model vistakardex" you return me an error message that the table does not exist

hi,

are you meaning a mysql view ?



11.6k

Sorry, I missed the point that you're talking about db view..what say your postgres log? does the connection work fine?

Yes I already know that. I think models of a table but when I do so with a view error that view does not exist. What is the correct procedure for access this view? A model?

and a controller...(take a look at the MVC concepts first...Models handle datas representation (from database or object), controller process datas and prepare the presentation, view display that)



81.1k

I do not use postgres I use Oracle version 2.1 does not actualize the 3.0 because that version does not support Oracle

edited Jun '18

Hi jeiel, did you find any solution? same problem found when I access Oracle view. The following initialize() function declared in model

public function initialize()

{
    $this->setConnectionService('dbBznes');
    $this->setSchema('POLICY');
    $this->setSource("BUSINESS_ALL"); 
    // view name
}
Return error message : 
Table 'POLICY'.'BUSINESS_ALL' doesn't exist in database