Graham, thanks for your answer. The RemotingController class is loaded fine with:
App::import('Controller', 'Remoting'); but components don't get initialized, it throws the same error. I also tried adding after the App::import(): ClassRegistry::init('RemotingController'); But didn't initialized components. Cheers. On 15 ene, 18:54, Graham Weldon <gra...@grahamweldon.com> wrote: > Hey, > > Better than including php files, use the CakePHP App::import() and > ClassRegistry::init() methods. > These locate, include and in the case of the ClassRegistry, instantiate and > return the object for you. > > You would in this case, do something like: > > App::import('Controller', 'RemotingController'); > class RemotingUsersController extends RemotingController { > /// implementation > > } > > Run a few tests with that, but its my understanding that this method should > make the components available for the RemotingUsersController class. > If not, ensuring that the __construct() passes back to the parent should > ensure that the parent class is processed properly, but this should happen > by default. > > Try the App::import() and let me know how you go with the components. > > Cheers, > Graham > > On Thu, 15 Jan 2009 12:47:58 -0800 (PST), caminante > > <running.ba...@gmail.com> wrote: > > Being released 1.2 final version of CakePHP, I opened this discussion > > to try to bring some light together to this issue. > > > My need: > > What's in the subject of this discussion; I have a couple of "special" > > controllers to be called from flash (through cakeswxphp). What I need > > is those controllers extending a "RemotingController" (with it's set > > of thingies for communication with flash) which in turn extends > > AppController. Sounded easy when I thought it, it's a common practice > > in OOP and I cannot see why it wouldn't be implemented in an OOP > > framework as CakePHP. Let's see: > > > 1) class RemotingController extends AppController {} // dir: app/ or > > app/controllers/ > > 2) class RemotingUsersController extends RemotingController {} // > > dir: app/controllers/ > > > When I make a request to an action in RemotingUsersController, "Class > > 'RemotingController' not found", either putting it at app/ or app/ > > controllers/. Ok, CakePHP didn't noticed RemotingController class > > existed. > > > There are a couple of (old or even antique) discussions on the > > subject: > > http://groups.google.com/group/cake-php/browse_thread/thread/83bad7a3...> > (from 2005) > > and a more recent one: > > http://groups.google.com/group/cake-php/browse_thread/thread/f3c62f08... > > > (from mid 2007) > > > Neither seemed to found a (nice?) way to do this and according to > > dates, they were discussing on different stages in the evolution of > > the framework. > > I applied something said in the first one, suggesting the following: > > > require_once('parent_controller.php'); > > class ChildController extends ParentController {} > > > The requirement for the php file with my RemotingController class > > would work fine (though not being a pretty/frameworkian solution, but > > I can live with that). Now my class seems to be recognized by Cake but > > I have another problem: The components I declare for this class don't > > work ("Call to a member function requestedWith() on a non-object", for > > example). Seems that leaving a little bit the CakePHP "rigorous- > > mechanics/convention-over-configuration" of Cake, there are some > > things that stop working "automagically", such as automatic components > > initialization. > > > My questions: > > How, then, can I initialize components? (and maybe why there's nothing > > in the book on this subject?) > > What can be the most practical and conventional way of doing what I > > need? > > Are others there that achieved good results with this? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---