I'm modifying a component (othman's SwiftMailer, which seems to have
been abandoned) and I'm confused about startup() and initialize().

First, I can't find any reference to these in the API, for both
Component and Object classes. In this post [1] about Auth, Dieter
says:

-- snip --
initialize(&$controller) seems to be a new ( in 1.2) callback.
Dispatcher calls $controller->_initComponents(), which
(controller.php) in turn calls $component->init($this), which calls
$tempComponent->initialize($controller).

So this function is called automatically, and when that happens
$controller->params are all copied to $this->params (by value). Some
more stuff happens but I don't think it's very important at this time.
The startup(&$controller) callback is familiar to 1.1 users. It is
called in the startup-phase of the component, shortly after the
initialize callback. ...
-- snip --

What I'm trying to do is to have default params within the component
but be able to set some overriding params in a particular controller.
I've been studying several different components and have concluded
that there are myriad ways to do this. I'd like to know what the Cake-
suggested method is.

Do I simply create an array (called "params") with the params I want
to override? Should I call initialize() in the controller or is that
automatic? If yes, do I pass the params, or $this? Do I need to call
extract() in initialize() and write over the defaults or is that
handled elsewhere?

I'd really appreciate a short example.

[1] http://dieter.plaetinck.be/figuring_out_cakephp_new_authcomponent
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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