yeah, better to hack the component into the model layer.
in your model methods probably sth like:
App::import('Core', 'Controller');
App::import('Component', 'Email');
$this->Email = new EmailComponent(null);
$this->Email->initialize(new Controller());
...
and with 2.x you can than refactor it into sth clean :)
Am Donnerstag, 21. Februar 2013 15:39:54 UTC+1 schrieb [email protected]:
>
>
>
> On Thursday, February 21, 2013 2:20:00 PM UTC+2, euromark wrote:
>>
>> Even with Cake1.3 you dont import and abuse controllers this way.
>> You need to refactor those controller methods into clean model methods
>> and only re-use those.
>>
>
> Since we are talking about sending e-mails which uses the Email component
> the only options are to abuse controllers or models (as models are not
> supposed to use components). I can try moving the code into the model and
> using App::Import to get the Email component and see if it is set up
> correctly that way. I have a work around as I showed in the code I
> included originally so I don't have a lot of incentive to reorganize the
> code now.
>
> The primary question is, if you have a facility like App::Import shouldn't
> the result be fully functional?
>
--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.