Love Fuel?
Donate
About
Forums
Discussions
Login
FuelPHP Forums
Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Orm
[ORM] How to use view tables
abarcenas
March 2013
Is it possible to use table views in ORM? I tried it by using $_table_name but it doesn't work.
Harro
March 2013
Yes, you can.
You define your views in the model:
protected $_views = array(
'viewname' => array(
'columnA',
'columnB',
'columnC',
),
);
Then in the query you use
Model_This::query()->use_view('viewname')-> ...
or
Model_This::find('all', array('use_view' => 'viewname));
Harro
March 2013
Accepted Answer
Note that you can only SELECT from a view, INSERT/UPDATE are not supported.
abarcenas
May 2015
Does this also accept relationships?
Add a Comment
Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
Sign In
Apply for Membership
Categories
All Discussions
5,088
General
↳ General
3,364
↳ Job Board
13
↳ Installation & Setup
214
Packages
↳ Oil
213
↳ Orm
700
↳ Auth
260
Development
↳ Tips and Tutorials
126
↳ Code share
145
↳ Applications
52
In this Discussion
abarcenas
May 2015
Harro
March 2013