try something like this: implement beforeFind() and set a condition:

class Celebrity extends AppModel {
  var $name = 'Celebrity';
  var $useTable = 'people';

  function beforeFind($query) {
    if (empty($query['conditions'])) {
      $query['conditions'] = array($this->alias . '.type' => 2);
    }
    else {
      $query['conditions'] = array(array($this->alias . '.type' => 2),
$query['conditions']);
    }
    return $query;
  }
}

Might be worth moving this logic into a behavior for easy reuse...

hth
grigri

On Sep 8, 2:38 pm, jmmg77 <[EMAIL PROTECTED]> wrote:
> I have 2 models I'd like to be based on the same table, but I need
> them to be filtered.
>
> Ex.
> table: 'people'
>
> model1: 'celebrities' (where type = 2)
> model2: 'littlepeople'  (where type = 1)
>
> I'm not talking about associations, just models based on filtered
> results.
>
> Is this possible at the model level?  So if I do $this->celebrities-
>
> >findAll("") it won't bring up any little people?
>
> There is a reason why I need this in my particular case, although
> normally this is not necessary.
>
> Thank You.
--~--~---------~--~----~------------~-------~--~----~
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