Erm... yes that will work, kind of, but then initialize(), startup()
and shutdown() will not be called in the component (at least I don't
see how they could... am I wrong?).

I did not do any speed tests, but I would not like components to be
instantiated unless needed (for instance what if the email component
had a very heavy startup() method?  I am trying to develop good
practices).

My code seems more logical this way.  Here is a pseudocode code
example

register action:
--if registration data validates {
----save user
----load email component
----send email to confirm given email address
--}

This way the email component is not loaded until the app is 100% sure
it will even be sure.

...unless maybe cake will handle this potential speed problem for me
in some way I can not imagine? I am in doubt but anyone is free to
inform me.

On Oct 27, 2:35 pm, teknoid <[EMAIL PROTECTED]> wrote:
> Well, it does... but did you remember to:
> $email = new EmailComponent; ?
>
> p.s. what "speed reasons" did you run into?
>
> On Oct 27, 5:21 pm, "Turnquist, Jonah" <[EMAIL PROTECTED]> wrote:
>
> > I've come across a need to load a component via the action for speed
> > reasons.
>
> > My case:
> > I have a user controller with view(), login(), and register()
> > actions.  I need the email component in, and only in, the register()
> > action.  So using var $components = array(etc); is not something I
> > want to do for speed reasons.  I do not want the component loaded for
> > actions that do not use it.
>
> > Looking at the docs it looks like this should work:
> > App::import('Component', 'Email');
>
> > But it doesn't. (??)
>
> > So how can this be done?
>
> > Thanks,
> > Jonah
--~--~---------~--~----~------------~-------~--~----~
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