Re: OR queries on the same field
That's not entirely equivalent though. On Wed, Mar 25, 2009 at 11:26 PM, Dr. Loboto wrote: > > Or replace "OR" by "IN": > 'conditions' => array('Vote.user_id' => array(1, 2, 3)) > > On Mar 26, 1:47 am, RyOnLife wrote: > > Got it: > > > > 'conditions' => array('or' => > > array( > > array('Vote.user_id' => 1), > > array('Vote.user_id' => 2) > > ) > > ) > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: With debug 0 routes stop working and all pages not found
Good point. But wouldn't a 500 be better than a 404? Not that big a deal, but the 404 just had me all hung up looking for routing mistakes when that was nowhere near the problem. \\Ryan Sent from my iPhone On Dec 19, 2008, at 9:08 PM, mark_story wrote: > > Well you did put the debug off, so all nice error messages turn into > 404's. Wouldn't be a good idea to leave all the nice errors so an > site visitor/attacker could see your mistakes :) > > -Mark > > On Dec 19, 5:52 pm, RyOnLife wrote: >> Go figure. 3 hours of trying and the moment send my previous message: >> it hits me. Clear the models cache. I'd added a new table. That fixed >> it. Wish Cake had some better error handling in that case. Would >> opening a ticket for that "issue" be appropriate? >> >> On Dec 19, 5:41 pm, RyOnLife wrote: >> >>> My app suddenly went haywire. When I set debug to 0, I get 404 not >>> found errors (from Cake, not Apache) on all pages. With the debug >>> setting at 1 or 2 there are no problems. I've been working on this >>> app >>> for months and have never had a problem when changing debug mode >>> to 0. >>> I haven't made any edits to routes.php, any .htaccess files or to >>> Apache configuration. >> >>> Any ideas? Does Cake inherently handle routes differently when debug >>> is on/off? > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: executing shell scripts
Martin, thanks for the continued help. David, wow. That was it. Think I subconsciously omitted them since it's not going to run through the web server. Thank you. On Wed, Oct 8, 2008 at 2:54 AM, David C. Zentgraf <[EMAIL PROTECTED]> wrote: > > Just to make sure: > Your code is inside tags, is it? > > On 7 Oct 2008, at 21:53, Ryan McKillen wrote: > > > I am using cloud.php as the filename. And just to be safe, I changed > > to var > > $uses = array(); in case there was a problem with my model. Am I > > executing > > the shell properly? > > > > cd ~/cake/console > > ./cake cloud > > > > class CloudShell extends Shell { > >var $uses = array(); > >function main() { > > $this->out("test\n"); > >} > > }Error: Class CloudShell could not be loaded > > > > > > > > > > On Tue, Oct 7, 2008 at 2:16 AM, [EMAIL PROTECTED] < > > [EMAIL PROTECTED]> wrote: > > > >> > >> Another basic thing to double-check is the filename. It should be > >> cloud.php in your case. > >> > >> /Martin > >> > >> On Oct 7, 2:54 am, Ryan <[EMAIL PROTECTED]> wrote: > >>> Sorry, it is in ~/vendors/shells > >>> > >>> On Oct 6, 1:41 pm, "dr. Hannibal Lecter" <[EMAIL PROTECTED]> > >>> wrote: > >>> > >>>> Is it in ~/vendors or ~/vendors/shells ? > >>> > >>>> On Oct 6, 7:30 pm, Ryan <[EMAIL PROTECTED]> wrote: > >>> > >>>>> I am trying to create my first shell script. The shell script is > >>>>> in / > >>>>> vendors and when I run, I get this: > >>> > >>>>> class CloudShell extends Shell { > >>>>> var $uses = array('Item'); > >>>>> function main() { > >>>>> $this->out("test\n"); > >>>>> } > >>> > >>>>> }Error: Class CloudShell could not be loaded > >>> > >>>>> What am I missing? Thanks! > >>> > >> > > > > > > > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" 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: executing shell scripts
I am using cloud.php as the filename. And just to be safe, I changed to var $uses = array(); in case there was a problem with my model. Am I executing the shell properly? cd ~/cake/console ./cake cloud class CloudShell extends Shell { var $uses = array(); function main() { $this->out("test\n"); } }Error: Class CloudShell could not be loaded On Tue, Oct 7, 2008 at 2:16 AM, [EMAIL PROTECTED] < [EMAIL PROTECTED]> wrote: > > Another basic thing to double-check is the filename. It should be > cloud.php in your case. > > /Martin > > On Oct 7, 2:54 am, Ryan <[EMAIL PROTECTED]> wrote: > > Sorry, it is in ~/vendors/shells > > > > On Oct 6, 1:41 pm, "dr. Hannibal Lecter" <[EMAIL PROTECTED]> wrote: > > > > > Is it in ~/vendors or ~/vendors/shells ? > > > > > On Oct 6, 7:30 pm, Ryan <[EMAIL PROTECTED]> wrote: > > > > > > I am trying to create my first shell script. The shell script is in / > > > > vendors and when I run, I get this: > > > > > > class CloudShell extends Shell { > > > >var $uses = array('Item'); > > > >function main() { > > > > $this->out("test\n"); > > > >} > > > > > > }Error: Class CloudShell could not be loaded > > > > > > What am I missing? Thanks! > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" 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: confusion over queries
Once I get it down, I'll be glad to. On Mon, Oct 6, 2008 at 4:45 PM, teknoid <[EMAIL PROTECTED]> wrote: > > And I will log a vote, that once you get it figured out by looking at > test cases, you add the required samples to the book (using the 'edit' > feature) :) > > On Oct 6, 2:00 pm, "Ryan McKillen" <[EMAIL PROTECTED]> wrote: > > Martin, thanks. That was a big help. I was working inside a foreach loop, > so > > I imagine you saved me a big headache with the create() tip. This helped > out > > on updating an individual record, but what about changing that field > value > > to 0 for all records? > > > > teknoid, thanks as well for the link. I'll spend some time in there, but > > will still log a vote for a set of examples in the Cookbook. > > > > On Mon, Oct 6, 2008 at 1:33 PM, [EMAIL PROTECTED] < > > > > [EMAIL PROTECTED]> wrote: > > > > > Hi Ryan, > > > > > 1: Not that I am aware of. It is a very good idea for a page in the > > > cookbook, though. > > > > > 2: This is usually very simple. Sometimes you have to watch out > > > though. > > > Usually this is totally automatic. > > > > > $one = $this->ExampleModel->findById($id); > > > $one['ExampleModel']['example_field'] = 0; > > > $this->ExampleModel->save($one); > > > > > Cake will know to use update in most cases like in the example above. > > > Sometimes, though you will have to help out a little. Like when you > > > are looping a number of records and saving each in turn, you must call > > > create before each save to avoid saving over the same record each > > > time. > > > > > There is also sometimes call for these drastic measuers. > > > You may not always be sure wether insert of create should be used: > > > > > $one = $this->ExampleModel->findById($id); > > > > > if ( empty($one) ) { > > > $one = array('ExampleModel'=>array()); > > > } > > > > > $one['ExampleModel']['example_field'] = 0; > > > > > $this->ExampleModel->create(); > > > $this->ExampleModel->set($one); > > > $this->ExampleModel->save($one); > > > > > That is, I think, it. Some people prefer setting the id of a Model > > > before using set(). I have seen tests in the core using both methods > > > so I guess both work fine. When I have done similar saves I have not > > > found it necessary setting Model->id before using set(). It may depend > > > on circumstances I am not fully aware of. > > > > > /Martin > > > > > On Oct 6, 6:51 pm, Ryan <[EMAIL PROTECTED]> wrote: > > > > As a new Cake user, I am having a bit of trouble transitioning from > > > > writing my own MySQL queries, to letting Cake do the heavy lifting > for > > > > me. I think I have SELECT and INSERT down, but am still struggling > > > > with UPDATE. Two questions: > > > > > > 1.) Is there a good resource I can refer to that shows examples of > raw > > > > SQL with the cake equivalent? This would really help my learning. > > > > > > 2.) The specific issue I am having that prompted this thread... I've > > > > got a primary key id number for a record in a table, and for that > > > > record, I want to update change the value of a given field from 1 to > > > > 0. How can I perform that simple operation with a Cake query? > > > > > > Thanks > > > > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" 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: confusion over queries
Martin, thanks. That was a big help. I was working inside a foreach loop, so I imagine you saved me a big headache with the create() tip. This helped out on updating an individual record, but what about changing that field value to 0 for all records? teknoid, thanks as well for the link. I'll spend some time in there, but will still log a vote for a set of examples in the Cookbook. On Mon, Oct 6, 2008 at 1:33 PM, [EMAIL PROTECTED] < [EMAIL PROTECTED]> wrote: > > > Hi Ryan, > > 1: Not that I am aware of. It is a very good idea for a page in the > cookbook, though. > > 2: This is usually very simple. Sometimes you have to watch out > though. > Usually this is totally automatic. > > $one = $this->ExampleModel->findById($id); > $one['ExampleModel']['example_field'] = 0; > $this->ExampleModel->save($one); > > Cake will know to use update in most cases like in the example above. > Sometimes, though you will have to help out a little. Like when you > are looping a number of records and saving each in turn, you must call > create before each save to avoid saving over the same record each > time. > > There is also sometimes call for these drastic measuers. > You may not always be sure wether insert of create should be used: > > $one = $this->ExampleModel->findById($id); > > if ( empty($one) ) { > $one = array('ExampleModel'=>array()); > } > > $one['ExampleModel']['example_field'] = 0; > > $this->ExampleModel->create(); > $this->ExampleModel->set($one); > $this->ExampleModel->save($one); > > That is, I think, it. Some people prefer setting the id of a Model > before using set(). I have seen tests in the core using both methods > so I guess both work fine. When I have done similar saves I have not > found it necessary setting Model->id before using set(). It may depend > on circumstances I am not fully aware of. > > /Martin > > > On Oct 6, 6:51 pm, Ryan <[EMAIL PROTECTED]> wrote: > > As a new Cake user, I am having a bit of trouble transitioning from > > writing my own MySQL queries, to letting Cake do the heavy lifting for > > me. I think I have SELECT and INSERT down, but am still struggling > > with UPDATE. Two questions: > > > > 1.) Is there a good resource I can refer to that shows examples of raw > > SQL with the cake equivalent? This would really help my learning. > > > > 2.) The specific issue I am having that prompted this thread... I've > > got a primary key id number for a record in a table, and for that > > record, I want to update change the value of a given field from 1 to > > 0. How can I perform that simple operation with a Cake query? > > > > Thanks > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" 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: dealing with curly quotes
Thanks. So now that I've got everything configured correctly, I shouldn't have to worry about curly quotes because Cake will convert them to straight for me? No string manipulation needed inside of my app? On Sun, Oct 5, 2008 at 10:12 PM, David C. Zentgraf <[EMAIL PROTECTED]> wrote: > > class DATABASE_CONFIG { >var $default = array( >'driver' => 'mysql', >... >'encoding' => 'utf8' >); > } > > I forget to put that in on a regular basis and it always costs my a > few minutes of debugging. ;-) > Not sure why it's not in the default template. > > On 6 Oct 2008, at 10:24, Ryan wrote: > > > > > Hey Adam, thanks. Here's how I'm setup: > > > > core.php > > Configure::write('App.encoding', 'UTF-8') > > > > database.php > > (I don't see a place to specify UTF-8) > > > > MySQL > > utf8_general_ci > > > > default.ctp (head section) > > charset('UTF-8') ?> > > > > Am I missing anything? > > > > When you say to make sure all of my code is utf8 compliant (eg string > > conversions), what do you mean? Can you be more specific? > > > > I think users of my site are entering curly quotes, which are saved to > > the db, then come out as garbage when displayed in HTML. > > > > -Ryan > > > > > > On Sep 30, 9:05 pm, Adam Royle <[EMAIL PROTECTED]> wrote: > >> If your database is correctly setup as utf8, cakephp db settings as > >> utf8 and your html is output as utf8, and make sure all of your code > >> is utf8 compliant (eg string conversion, etc) then you shouldn't have > >> any issues. Unless you just don't like the look of curly quotes? > >> > >> Cheers, > >> Adam > >> > >> On Oct 1, 8:39 am, Ryan <[EMAIL PROTECTED]> wrote: > >> > >>> I'm using a UTF-8 character set and the curly single and double > >>> quotes > >>> are causing some problems with my app. I have a couple of questions > >>> regarding the best way to deal with (eliminate) them: > >> > >>> Allow the curly quotes to go into the database, but convert them to > >>> straight quotes before display? Or convert them into straight quotes > >>> before going into the database? > >> > >>> And beyond that fundamental issue, what is the best way to convert > >>> from curly to straight? I've dealt with similar issues in some of my > >>> non-Cake PHP applications and am wondering if Cake has any built-in > >>> functionality for dealing. > >> > >>> Thanks! > > > > > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" 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: Haml and Sass for CakePHP
Mark, thanks for the perspective. I underestimated the Haml benefits/ gain but after putting in a solid 3 weeks on the views for the front end of a Rails project, I'm just enamored with it. You can't write markup that doesn't validate, it's highly readable and you can do it in half the time. I can imagine that it would be a lot of work to male it Cake ready. So in lieu of Haml, what do you reccomend? Stick with the Cake templating or use something else? -Ryan Sent from my iPhone On Sep 6, 2008, at 10:04 AM, mark_story <[EMAIL PROTECTED]> wrote: > > Using Haml / Sass and the core helpers would either need a rewrite for > all the helpers so they create haml, or the haml parser would need to > know not to mess with the HTML made by the core helpers. It seems > like a lot of work up front for not a ton of gain. I like the sass > conventions but it would be a ton of work to get it integrated into > cakePHP which is probably why no one has done it. > > -Mark > > On Sep 5, 4:30 pm, Ryan <[EMAIL PROTECTED]> wrote: >> Thanks for the link. I'd come across it in my early search. Yeah, >> seems old (Haml has been updated significantly over the last year) >> and >> no Sass. >> >> Has anyone worked with it before on an RoR project? I love it so much >> I shudder to think about going without. >> >> On Sep 5, 6:56 am, "Marcin Domanski" <[EMAIL PROTECTED]> wrote: >> >>> http://bakery.cakephp.org/articles/view/haml-markup-haiku >>> its old but you get a general idea. >>> i dont know about sass. i dont think phphaml has support for it. >>> HTH, >>> -- >>> Marcin Domanskihttp://kabturek.info >> >>> On Fri, Sep 5, 2008 at 5:57 AM, Ryan <[EMAIL PROTECTED]> >>> wrote: >> Hello all, >> I am working with CakePHP for the first time. I recently collaborated with another developer on a Ruby on Rails project, for which I wrote most of the views. I usedHamland Sass (http:// haml.hamptoncatlin.com), and after about five minutes of learning, swore I'd never write XHTML and CSS the hard way again. >> So as soon as I got a fresh new CakePHP app running, I went to set it up forHamland Sass. I was disappointed to see that any mention of Hamlseems to be around a year old, and I found no mention of support for Sass. >> Are there viable options forHamland Sass with CakePHP? Which is the best? Or has theHamland Sass effort for Cake lost steam? >> Thanks, Ryan > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" 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 -~--~~~~--~~--~--~---