Okay, that works, but it's creating a weird side effect. This is the
line that I've added to my AppointmentsController to import access to
the Template model:

var $uses = array('Appointment','Template');

When I add this, my non-authenticated add function works fine, however
the edit, which checks for access, is broken. I'm doing access this
way:

function beforeFilter()
{
        $this->Auth->authorize = 'controller';
}

function isAuthorized() {
   if ($this->action == 'index' || $this->action == 'add') {
        return true;
   } else {
         if(!empty($this->data)) {
                $appointment = $this->data;
         } else {
                $appointment = $this->Appointment->read();
         }
         if( CHECKING CODE FOR VALID ACCESS ) {
                        return true;
         }
    }
    return false;
}

Now, with the $uses line commented out, everything in these functions
works when I go to /appointments/edit/##. With the $uses line in, this
line:
        $appointment = $this->Appointment->read();
no longer works. It returns false. It's like the id at the end of the
URL is no longer being passed through. Any ideas about why this is
happening?

Thanks for your help,

Wayne.

On Oct 10, 10:12 pm, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote:
> What you're looking for is 
> $uses.http://book.cakephp.org/view/53/components-helpers-and-uses
>
> Or alternatively:
> App::import('Model', 'OtherModel');
> $othermodel = new OtherModel();
>
> On 11 Oct 2008, at 09:56, Wayne wrote:
>
>
>
> > This might be a simple question, but everything I'm trying is not
> > working and it's frustrating the hell out of me.
>
> > I need to do a find() on a model that is not related to the model
> > whose controller I'm currently accessing. I know how to make this work
> > if there's a hasMany or belongsTo sort of relationship between the two
> > models, but in this case, there's not. I've tried creating new
> > instances of the other controller to query, and I've tried to use the
> > static find() method, but neither is working because the model I'm
> > working with doesn't have any knowledge of the existence of the other
> > model. It seems to me there should be some simple way to do this, but
> > I can't find any example of this sort of query in the documentation. I
> > realize that I can use query() to hit the database directly, but I was
> > trying to avoid that, and it seems like CakePHP should be able to find
> > the other model if I could just ask it in the right way.
>
> > Is there some way normal "CakePHP" to do this?
>
> > Thanks for any help you can provide,
> > Wayne Eaker.
--~--~---------~--~----~------------~-------~--~----~
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