Oh, I had function startup(&$controller); on prior versions (which
worked until 1.2alpha), removed it after checking component.php's
source code and the init() function. Thanks a lot

On Jan 7, 1:56 pm, rtconner <[EMAIL PROTECTED]> wrote:
> You sure that code ever worked? Or better yet, did you post all of
> your code? That should not have worked on any version of cake that I
> am aware of.
>
> In any case.. add this method to the component, and I think you'll be
> ok.
>
> function initialize(&$controller) {
> $this->controller = $controller;
>
> }
>
> On Jan 7, 8:49 am, guigouz <[EMAIL PROTECTED]> wrote:
>
> > This code was working on cake 1.2alpha. My app manages a lot of sites
> > and have a SiteManager component that handles authentication and
> > authorization. One of the functions lists the sites based on an ACCESS
> > constrant passed via parameters
>
> > class SiteManagerComponent extends Component
> > {
>
> >     /**
> >      * Lists all sites where user has $access
> >      *
> >      * @param unknown_type $access
> >      */
> >     function sites($access = null) {
> >         if(!$this->controller->user || !$access)
> >                 return false;
> >         // here I lookup the sites based on $access and return an
> > array
> >    }
>
> > }
>
> > controller->user is defined on app_controller (that's where I store
> > the current loggedin user). The notice I'm getting on PHP5 (not PHP4)
> > is
> > Notice (8): Trying to get property of non-object [APP/controllers/
> > components/site_manager.php, line 11], which refers to the "if" like
> > then accessing $this->controller... The call is
> >  $this->SiteManager->sites(16); // example access level
> >  and runs on beforeFilter();
>
> > component.php's init function sets $this->controller to the linked
> > controller automatically, so maybe that's happening after
> > beforeFilter(); runs ?
>
> > Thanks a lot in advance
>
> > gui
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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