I have defined views as tables (i.e. set up a model that points to it) and it 
works great for index/view, but edit/delete is dependent upon the database and 
view structure - views are often based on more than one table, so are more 
complex than a single table.

Jeremy Burns
Class Outfit

[email protected]
http://www.classoutfit.com

On 30 Aug 2010, at 09:08, chargu wrote:

> Hi All,
> 
> Just wondering if there is a way to use database views in CakePHP.
> 
> Say I want to have a view
> 
> CREATE VIEW user_view_{$user_id} AS
>  SELECT *
>  FROM users, comments
>  WHERE users.id = comments.user_id
>  AND users.id = {$user_id} ;
> 
> and I also want to have an adhoc model to CRUD on this view (so that I
> don't actually need to have a condition 'user_id' = {$user_id}
> whenever I need the data. I'm lazy, I know :p but this is just a
> simplified example of my somewhat complicated model).
> 
> Is there a way to achieve this? I found very little useful results in
> Googling for 'cakephp database view', it seems people are quite happy
> the way it is. Or am I being 'academic' and missing the point about
> the whole view business?
> 
> Thanks in advance :)
> 
> Char
> 
> Check out the new CakePHP Questions site http://cakeqs.org and help others 
> with their CakePHP related questions.
> 
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected] For more options, visit this group at 
> http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to