Monday, February 2, 2009

Use the dreaded requestAction()... or use something else?

Hello all

What's an appropriate use of requestAction()?

I have 3 controllers:
* UsersController
* SiteController
* SitePagesController

Within the add() function of UsersController, I want to (a) create a
new user (b) create a new site for that user with (c) one new page for
that site.

What's the best way to do this?

I was thinking of:

######

if ($this->User->save($this->data))
{
# create site
$this->requestAction('/sites/add');

# add a page (homepage) for this site
$this->requestAction('/sitepages/add');

# Login the user and redirect to the dashboard
// login code here
$this->Session->setFlash(SOTF_MSG_USER_WELCOME);
$this->redirect(array('controller' => 'users' ,'action' =>
'dashboard'));
}

######

While the code for this looks clean, what I've read seems to indicate
this isn't such a good idea due to performance issues.

What else would I do?

Thanks
Turgs
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: