"It's an existing site, so I don't want to rewrite conditions for all
find queries. "
ahh thats why we should be using fat models instead of fat
controllers.
the most direct way to achieve this would be to put it in each find
call.
the best way would be to set up a function in your model, lets call it
findApproved()
so in you model you put
function findApproved(){
$data = $this->find('all', array('conditions'=>array
('Model.approved'=>1,
more conditions etc etc)));
return $data;
}
in your controller just put
$this->Model->findApproved() in place of those old rusty controller
find calls.
On Jul 29, 1:38 am, park <[email protected]> wrote:
> Hi,
>
> Would like to add an "approved" field for a model. Users can only see
> entries whose Model.approved = 1. Only in admin section can unapproved
> entries be retrieved.
>
> It's an existing site, so I don't want to rewrite conditions for all
> find queries.
>
> Is there a centralized method (presumably in Model) of achieving this?
>
> Many thanks!
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---