Re: findAll() when used with order parameter returns nothing
Hi everybody, Maybe it seams that I posted here because nate rejected the patch. But this was not my intention. I only wanted to link this thread with the ticket so the people that read this thread could find one solution. Perhaps I couldn't express exactly what I wanted because I'm from Spain and English is not my language. :-P Also, I want to thank nate for fixing this annoying bug. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: findAll() when used with order parameter returns nothing
Hi, Daneel wrote: In the track site and found one ticket regarding this issue (https://trac.cakephp.org/ticket/733) [...] Yeah, that's probably the way to handle such things. I reopened the bug with the patch, but it was marked as invalid again with the resolution that we have to deal with it. IMHO deal with it is never an appropriate explanation for rejecting a patch - it should at least be stated why accepting the patch would be harmful. I don't think my patch brokes anything and don't understand why they don't apply it, specially when this issue is new to the last version of CakePHP. I don't understand this reaction by gwoo. As long as it's no ambiguous field name, sorting just by just the name is no problem. When I tried to fix that within my pagination methods in the app_controller, this didn't work with the 'Model.modified', I had to use 'tablename.modified' - which makes things more complicated (I have one pagination default for sorting by the 'modified' date used in various tables - but now I have to pass the tablename as an additional parameter). Or I'd have to code som extra glue logic to read the table used for the model into my controller ... . Everybody interested can find the patch in the ticket. Yes, but it's a bit tiresome to do this with every release. And according to the posts here, there are quite a few people stumbling over this issue. Regards, Dominik. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: findAll() when used with order parameter returns nothing
Daneel,I did not see this patch and it was closed without me looking at it.The ticket will be fixed since the way it worked before should still work in the stable version.The deal with it comment is not from me and it will not happen from anyone else on my dev team again, if so it will be dealt with -- /*** @author Larry E. Masters* @var string $userName* @param string $realName* @returns string aka PhpNut* @accesspublic*/ --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: findAll() when used with order parameter returns nothing
IMHO deal with it is never an appropriate explanation for rejecting a patch - it should at least be stated why accepting the patch would beharmful.Lets stop this before it goes any further, I have already stated how this will be handled from now on.As lead developer I have the final say in what goes into the core, and this one will be in the next bug release. Do not let this turn into a flame thread over one not very well thought out comment in a ticket.-- /*** @author Larry E. Masters* @var string $userName* @param string $realName * @returns string aka PhpNut* @accesspublic*/ --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: findAll() when used with order parameter returns nothing
Dominik: https://trac.cakephp.org/ticket/733 . Read my post from 05/06/06 20:20:53. That's just about all I have to say about that. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
findAll() when used with order parameter returns nothing
I'm pretty new to CakePHP (just got it yesterday) and I was following along with the second blog tutorial [http://wiki.cakephp.org/tutorials:blog_tutorial_-_2] and the recent posts page wasn't working for me. I was getting a PHP error (not cake) that said I used an invalid argument in my foreach() loop. Which goes along with the following line from the tutorial: foreach ($RecentPosts as $Post): which is placed within the recent_posts.thtml view element file. What seems to be happening is when the tutorial says to use the findAll() method of the Post controller and if an order is specified, my results come out blank, which causes the foreach() loop to fail. Here are the parameters to use as per the tutorial: $data = $Post-findAll( null, null, 'modified DESC', $number ); Which doesn't return anything, print_r($data) returns blank. However, if I null out the order parameter, the page works and displays the posts (but they're obviously not ordered). $data = $Post-findAll( null, null, null, $number ); That works. I've tried playing around with the string and all sorts of things keep failing DESC modified modified ASC id DESC id ASC and so on. The columns in the database are set up correctly, so I'm not sure what's wrong... Any one have an idea? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: findAll() when used with order parameter returns nothing
try upping the debug setting in config/core.php to 2 and see if any sql errors are reported. On 5/3/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I'm pretty new to CakePHP (just got it yesterday) and I was following along with the second blog tutorial [http://wiki.cakephp.org/tutorials:blog_tutorial_-_2] and the recent posts page wasn't working for me. I was getting a PHP error (not cake) that said I used an invalid argument in my foreach() loop. Which goes along with the following line from the tutorial: foreach ($RecentPosts as $Post): which is placed within the recent_posts.thtml view element file. What seems to be happening is when the tutorial says to use the findAll() method of the Post controller and if an order is specified, my results come out blank, which causes the foreach() loop to fail. Here are the parameters to use as per the tutorial: $data = $Post-findAll( null, null, 'modified DESC', $number ); Which doesn't return anything, print_r($data) returns blank. However, if I null out the order parameter, the page works and displays the posts (but they're obviously not ordered). $data = $Post-findAll( null, null, null, $number ); That works. I've tried playing around with the string and all sorts of things keep failing DESC modified modified ASC id DESC id ASC and so on. The columns in the database are set up correctly, so I'm not sure what's wrong... Any one have an idea? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: findAll() when used with order parameter returns nothing
you need Post.modified in the order parameter --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: findAll() when used with order parameter returns nothing
Hi, gwoo wrote: you need Post.modified in the order parameter Yes. That seems to be a new issue with the final version 1.0 - I had the same problems, when I upgraded my apps. If you don't mention the model, cake inserts a blank into the ORDER BY statement. When you set debug to 2, you can see it in the generated SQL (and an error message that e.g. ` modified` is not a valid column name). Regards, Dominik. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: findAll() when used with order parameter returns nothing
Ah! beautiful, I thank everyone for the quick and accurate replies. Everything works nicely now. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---