Re: Extending Email Component
On Jan 29, 12:55 pm, "Matias Lespiau" <[EMAIL PROTECTED]> wrote: > Haven't tested it, but in the send function of the EmailComponent I see this > code: > function send() > // lot of code > $__method = '__'.$this->delivery; > return $this->$__method(); > } > So I think it should call the db method. Well, I guess I should have tested it rather then going my assumptions :) Yes, extending the component and creating the __db() method will work. I'm quite surprised that it'll work but ... that's just what I wanted so I'm happy. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: Extending Email Component
Haven't tested it, but in the send function of the EmailComponent I see this code: function send() // lot of code $__method = '__'.$this->delivery; return $this->$__method(); } So I think it should call the db method. Good luck -- Matias Lespiau http://www.gignus.com/ On Jan 29, 2008 3:52 PM, Jeraimee <[EMAIL PROTECTED]> wrote: > > On Jan 29, 12:09 pm, "Matias Lespiau" <[EMAIL PROTECTED]> wrote: > > I would do something like this: > > custom_email_component.php in my controllers/components > > App::import('Component', 'Email'); > > class CustomEmailComponent extends EmailComponent { > >function __db() { > > // your code > >} > > } > > By setting $this->delivery to 'db' you method would be called instead of > the > > others. > > That was what I was going to do first however I didn't even try it > after realizing EmailComponent wouldn't call the __db method > (parent::__db()) due to it's construction. > > I may be wrong in this assumption and I'll do a test after I finish my > pizza to verify. > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: Extending Email Component
On Jan 29, 12:09 pm, "Matias Lespiau" <[EMAIL PROTECTED]> wrote: > I would do something like this: > custom_email_component.php in my controllers/components > App::import('Component', 'Email'); > class CustomEmailComponent extends EmailComponent { > function __db() { > // your code > } > } > By setting $this->delivery to 'db' you method would be called instead of the > others. That was what I was going to do first however I didn't even try it after realizing EmailComponent wouldn't call the __db method (parent::__db()) due to it's construction. I may be wrong in this assumption and I'll do a test after I finish my pizza to verify. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: Extending Email Component
Hi i approached the problem diffrently - i have a Email model that acts just like Email component (same api) but it doesnt render anything (faster) only saves the data( the seted data for the view , template , to ,from etc) in the db. I also have a custom shell with a task that reads a batch of emails every couple of minutes and sends them using the email component ( also extended to use swift mailer but thats another thing). Look at the bakery about using the email component in a cake shell - Jippi made a great article about it. HTH, On Jan 29, 2008 6:09 PM, Matias Lespiau <[EMAIL PROTECTED]> wrote: > I would do something like this: > > custom_email_component.php in my controllers/components > > App::import('Component', 'Email'); > > class CustomEmailComponent extends EmailComponent { > > > function __db() { > // your code >} > } > > By setting $this->delivery to 'db' you method would be called instead of the > others. > > Is that what you need? > > This way you can extend the component while keeping the core clean. > > Cheers, > > -- > Matias Lespiau > http://www.gignus.com/ > > > > > > On Jan 29, 2008 2:49 PM, Jeraimee <[EMAIL PROTECTED]> wrote: > > > > In our project when we need to send email we actually input it into a > > database queue to be sent later via cron (a cake console app). We want > > to keep the functionality of the email component but need to add a > > __db (or whatever you would like to call it) method so we can choose > > between 'mail', 'smtp' and 'db' (or whatever). > > > > My first plan was to patch email.php so it would first see if $this- > > >delivery was defined, if not check parent:: however this can't be > > done (AFAIK) due so the way components are instantiated. > > > > Does anyone have any suggestions that don't involve me copying > > email.php into my components directory and potentially going out of > > sync with cake? > > > > > > > -- Marcin Domanski http://kabturek.info --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: Extending Email Component
I would do something like this: custom_email_component.php in my controllers/components App::import('Component', 'Email'); class CustomEmailComponent extends EmailComponent { function __db() { // your code } } By setting $this->delivery to 'db' you method would be called instead of the others. Is that what you need? This way you can extend the component while keeping the core clean. Cheers, -- Matias Lespiau http://www.gignus.com/ On Jan 29, 2008 2:49 PM, Jeraimee <[EMAIL PROTECTED]> wrote: > > In our project when we need to send email we actually input it into a > database queue to be sent later via cron (a cake console app). We want > to keep the functionality of the email component but need to add a > __db (or whatever you would like to call it) method so we can choose > between 'mail', 'smtp' and 'db' (or whatever). > > My first plan was to patch email.php so it would first see if $this- > >delivery was defined, if not check parent:: however this can't be > done (AFAIK) due so the way components are instantiated. > > Does anyone have any suggestions that don't involve me copying > email.php into my components directory and potentially going out of > sync with cake? > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---