Re: SQL? Why
On 9/21/07, AD7six <[EMAIL PROTECTED]> wrote: > > An apt solution would be to extend the component which you are using. > > > > Controller like functionality which needs to be used in several > > controllers === Component > > Indeed :)! > > And using a component with the same name as a model == component gets > overwritten by model and you get these wierd sql error messages which > correspond to component methods being called on a Model instance. Ah yes! i should have looked a bit lower ;) Tarique -- = Cheesecake-Photoblog: http://cheesecake-photoblog.org PHP for E-Biz: http://sanisoft.com = --~--~-~--~~~---~--~~ 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: SQL? Why
On Sep 21, 1:43 pm, "Dr. Tarique Sani" <[EMAIL PROTECTED]> wrote: > On 9/21/07, deepc <[EMAIL PROTECTED]> wrote: > > > the idea was that any controller should be able to send emails with > > one line of code, and without the necessity of defining text or > > anything else. > > just the userid and a type of mail. the rest should be held in > > database. > > An apt solution would be to extend the component which you are using. > > Controller like functionality which needs to be used in several > controllers === Component Indeed :)! And using a component with the same name as a model == component gets overwritten by model and you get these wierd sql error messages which correspond to component methods being called on a Model instance. If you don't know what I mean, write how to do the following from a controller: Call the send method in the Email component Call the findAll method in your Email model. Call the send method in your Email model. Hopefully that should cause an "Oh yeah..." hth, AD --~--~-~--~~~---~--~~ 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: SQL? Why
Sounds like you've got a problem with the naming of your models and components. If you are using the EmailComponent to send mails, you need to use $this->Email->send() in your controller. However, if your controller has a model called Email, then $this->Email will be the model instead of the component (arguably a design flaw in cake, but we'll let it slide :) ). The easiest solution (given that the component is part of base 1.2) would be to assume that Email is a reserved name when created Models, and change the name of you model to EmailTemplate or something like that. simon --~--~-~--~~~---~--~~ 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: SQL? Why
On 9/21/07, deepc <[EMAIL PROTECTED]> wrote: > the idea was that any controller should be able to send emails with > one line of code, and without the necessity of defining text or > anything else. > just the userid and a type of mail. the rest should be held in > database. An apt solution would be to extend the component which you are using. Controller like functionality which needs to be used in several controllers === Component T -- = Cheesecake-Photoblog: http://cheesecake-photoblog.org PHP for E-Biz: http://sanisoft.com = --~--~-~--~~~---~--~~ 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: SQL? Why
No, i just create the content in a central place. I use one of the bakery mail components. The situation is the following. I have template for a lot of emails in the database (table emails). in my emails controller i wanted to replace the variables with real life content and let the mail component handle the delivery. the idea was that any controller should be able to send emails with one line of code, and without the necessity of defining text or anything else. just the userid and a type of mail. the rest should be held in database. On 21 Sep., 13:27, "Dr. Tarique Sani" <[EMAIL PROTECTED]> wrote: > On 9/21/07, deepc <[EMAIL PROTECTED]> wrote: > > > OK, i see. > > if i move it to the model, is it still posible to access other models. > > for example i have to get some data from my users table. > > let me guess - you are getting the data which you want to send in the > email in the send() method? > > I would suggest that you refactor the send method to do precisely one > thing - send emails > > Everything else should be done somewhere else - most likely the > associated controller action from where send is being called > > send() method can accept a number of parameters > > Better still grab one of the email components from Bakery and save > yourself the hassle of reinventing the wheel > > T > > -- > = > Cheesecake-Photoblog:http://cheesecake-photoblog.org > PHP for E-Biz:http://sanisoft.com > = --~--~-~--~~~---~--~~ 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: SQL? Why
On 9/21/07, deepc <[EMAIL PROTECTED]> wrote: > OK, i see. > if i move it to the model, is it still posible to access other models. > for example i have to get some data from my users table. > let me guess - you are getting the data which you want to send in the email in the send() method? I would suggest that you refactor the send method to do precisely one thing - send emails Everything else should be done somewhere else - most likely the associated controller action from where send is being called send() method can accept a number of parameters Better still grab one of the email components from Bakery and save yourself the hassle of reinventing the wheel T -- = Cheesecake-Photoblog: http://cheesecake-photoblog.org PHP for E-Biz: http://sanisoft.com = --~--~-~--~~~---~--~~ 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: SQL? Why
OK, i see. if i move it to the model, is it still posible to access other models. for example i have to get some data from my users table. --~--~-~--~~~---~--~~ 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: SQL? Why
On 9/21/07, deepc <[EMAIL PROTECTED]> wrote: > messages_controller > In my emails_controller is a function send() which should handle what If this is correct > $this->Email->send(); then this is wrong - the 'Email' here is the Model not the controller > i got: > Warning: SQL Error: 1064: You have an error in your SQL syntax; check the error is a quirk of all the automagic in CakePHP - if you call a method in a model which is non existent it gets passed to the database as an SQL query Solution is to move the send method to Email model T -- = Cheesecake-Photoblog: http://cheesecake-photoblog.org PHP for E-Biz: http://sanisoft.com = --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
SQL? Why
Hello, I have following models: Email Message and controllers emails_controller messages_controller In my emails_controller is a function send() which should handle what type of email should be send. If i call it from messags $this->Email->send(); i got: Warning: SQL Error: 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'send' at line 1 in /var/www/dev/saj/cake/libs/ model/datasources/dbo_source.php on line 463 I have no idea why SQL! I only call a function! Can anybody help me pleace THX DC --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---