1

I have a database with two tables and one view, I use propel init for creating a project, now when I just have my two tables on the Propel created files and I can just get query from my tables I don't access to my view for getting the query from it!

I read some of the related issues on their Github repository about views on propel but doesn't find any way to take my view like my tables on PHP,

Anyway for now I want to know is there any way to have my view on the propel and use that class like table normal query class for getting the query from it?

4

1 回答 1

2

A view is just a virtual table, so for your model based on a view, you need to define columns normally, and add readOnly="true" and skipSql="true" attributes on your table element.

The skipSQL tells propel not to generate a DDL SQL statement for the table, and readOnly tells propel suppress mutators/setter, save() and delete() methods. See Propel Documentation.

For a detailed explanation / example, have a look an my response on a similar question here.

于 2016-06-28T10:35:21.093 回答