Re: Book software like on book.cakephp.org
In Linux create a script with this line wkhtmltopdf http://book.cakephp.org/complete/876/The-Manual cakemanual.pdf and run it every night via cron. On Mon, Nov 15, 2010 at 5:18 PM, Saša sasa.eb...@gmail.com wrote: Hey guys, (Maybe a little off-topic) I was just browsing through http://book.cakephp.org/view/875/x1-3-Collection and marveling at the implementation of the book software. Is this open? And if not do you know of any similar web apps that allow a community of contributors to create a book together? I would like to be able to auto generate a nightly PDF from the book pages. Will I need to implement this from scratch? -sasa Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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.comcake-php%2bunsubscr...@googlegroups.comFor more options, visit this group at http://groups.google.com/group/cake-php?hl=en -- Regards, Zaky Katalan-Ezra QA Administrator www.IGeneriX.com Sites.IGeneriX.com 054-7762312 Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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: Why only pass $data to view instead of model instance?
Also an interesting idea, Miles. Thanks for mentioning it. On Fri, Nov 12, 2010 at 8:00 PM, Miles J mileswjohn...@gmail.com wrote: I dislike this also. Cake really should have more than 1 model type: DAOModel and DataModel. One deals with database interactions, while the other manipulates a dataset for the view. However, there is nothing stopping you creating these extra models. $this-set('data', new UserDataModel($this-User-find())); On Nov 12, 5:23 am, Joshua Muheim psybea...@gmail.com wrote: I'd like to warm up this topic again. :-) I decided to pass model instances to the views instead of just their $data attributes. So is there a way to tweak the paginator to do exactly this? Thanks, Josh On Thu, Oct 28, 2010 at 8:26 PM, euromark dereurom...@googlemail.com wrote: i tend to do those things on demand using a behavior to add new keys or even doing it in the model afterFind() etc often results in additional work without actually needing this information but of course this depends on the particular case On 28 Okt., 20:10, cricket zijn.digi...@gmail.com wrote: On Thu, Oct 28, 2010 at 10:03 AM, euromark dereurom...@googlemail.com wrote: thats not correct for PHP5 anymore in PHP4 you needed to do this but in PHP5 it is passed by reference by default, afaik Agreed on passing the model to the view. But this could also be accomplished in afterFind(), adding new key = value to the data array. Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with their CakePHP related questions. 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 athttp://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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 Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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: CakePHP should be more strict with unclean configuration, e.g. when specifying missing components! --psybear
Thank you for your replies. I was not aware that false is returned, so I'm taking back my accusation that CakePHP is lazy. Still I'd like to have an option that CakePHP automatically cries when in development mode... On Sat, Nov 13, 2010 at 5:32 PM, mark_story mark.st...@gmail.com wrote: Also App::import() returns false when an import fails. If you are interested in whether or not things succeed, you could check the return value of the method. -Mark On Nov 12, 5:05 am, psybear83 psybea...@gmail.com wrote: Hi all I don't get it why CakePHP doesn't complain about stuff like when one specifies missing components or fixtures: var $components = array('SomeNotExistingComponent'); var $fixtures = array('app.this_fixture_does_not_exist'); App::import('Lib', 'TheresNoSuchFileInLib'); All the three lines do not result in any error, and I guess there's more of that like $uses or stuff, but I didn't investigate this any further. Can anyone tell me why CakePHP just doesn't care about stuff like that? Seems vry unresponsible to me... Thanks for any hints Josh Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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 Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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: Is there a reason why I shouln't make $this-Html available in views as $html? --psybear
Thank you for the explanations, guys. I have no problems accepting a solution that seems to be suboptimal in my opinion when can comprehend your motivations behind it. :-) On Sat, Nov 13, 2010 at 5:36 PM, mark_story mark.st...@gmail.com wrote: One of the main reasons it was changed to a view property, was that people had the propensity to make view variables that shared the name of their helpers. Bad things ensued. There were frequent enough issues that it was changed. Unlike PHP and CakePHP rails benefits from ruby magic, in the form of mixins. Since PHP has no mixins, we can't really do the same things as rails can. Moving helpers to view properties, has also enabled runtime loading of helpers and lazy loading of helpers for 2.0, which was another motivation to change things. As for a decision log, its mostly in the form of tickets on lighthouse, as well as some discussion on the mailing list, and wiki pages that existed while 1.3 was being developed. -Mark On Nov 12, 8:18 am, Joshua Muheim psybea...@gmail.com wrote: I'd really like to know why it has switched to $this-Html. Is there a decision log or something for CakePHP? Coming from the RoR world (which is far more widespread in the webworld than CakePHP, I guess) I like things as simple as anyhow possible, even if you have to stick to some conventions for its sake. I haven't worked with RoR since 2 years or so, so maybe things have changed now, but up then as far as I remember things like helper methods had been mixed right into the view *without* anything like a $helper method or so. E.g. a helper Bla with methods abc and xyz were accessible in the view directly by calling abc and xyz, so you had to see for yourself that no collisions appeared (and if one did, I guess you would still have been able to distinguish your helpers by prepending the helper's name, e.g. Bla.abc or Foo.abc). So RoR went the way that's the most convenient to use, and by having a good test battery in the background conflicts like the mentioned above were located and fixed easily while still having all the convenience in those spots that didn't have collisions (which are in most cases many more than the ones that do). Well, just writing some thoughts down here, no intention to blame CakePHP or something... I'm just curious about some stuff... ;-) On Fri, Nov 12, 2010 at 1:41 PM, euromark dereurom...@googlemail.com wrote: actually its the other way around it used to be $html and NOW is $this-Html (cake =1.3) and yes, there are plenty reasons why this is now a view object (and not just an object variable) it is a bad idea to want to go back to the old syntax and your argument is bad: For the sake of simplicity $this-Html makes more sense (no collisions in the view anymore) hope that clears things up On 12 Nov., 11:42, psybear83 psybea...@gmail.com wrote: Hi everybody For the sake of simplicity I'd like to make my helpers available in my views not as $this-Helper but as $helper using the set(...) method in the controller. Is there any reason why this could be a bad idea? Or is there already an option to tell CakePHP to make the helpers available this way? Thanks for help Josh Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with their CakePHP related questions. 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 athttp://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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 Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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: yahoo web hosting problem
sorry my english is bad. :( but i will try again to explain it for you. i hope u understand this time. I built a website and use apache as a web server on my computer. then I have to upload it to yahoo web hosting. in yahoo web hosting does not allow to upload . htaccess files (so i think they use IIS as web server) then I followed this tuturial: http://book.cakephp.org/view/1533/A-Note-on-mod_rewrite, and make my URLs look like www.example.com/index.php/controllername/actionname/param rather Than www.example.com/controllername/actionname/param. after i run in yahoo web hosting. i found some new problems. my tinyMCE does not work like on my computer (apache web server). other than that I can't upload pictures using my application. I do not know where he had gone but the session said that the file uploaded successfully. then I try to display the source in my webbrowser. the result between 2 webserver is different. use and not use prety URLs. when I dont use prety ULRs the link for javascript URLs look like script type=text/javascript src=/x/app/webroot/js/tiny_mce/tiny_mce.js/ script and when i use prety ULRs, link to the javascript URLs like this : script type=text/javascript src=/x/js/tiny_mce/tiny_mce.js/ script then i think the main problem is i have to use prety URLs and find tutorial http://book.cakephp.org/view/1636/URL-Rewrites-on-IIS7-Windows-hosts and this http://blog.knightdna.net/2010/07/enabling-cakephp-pretty-urls-on-iis.html , i've follow the tutorials but I do not know where is my fault that make my website cant run prety URLs well. or this way this way cant be used in yahoo webhosting? or are there other ways I can use? i cant change my webhost. On Tue, Nov 16, 2010 at 1:14 PM, whmeroe whme...@gmail.com wrote: Please describe what is occurring vs. what you think should be. Stating it doesn't work doesn't help us help you. *From:* cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] *On Behalf Of *fadhli *Sent:* Tuesday, November 16, 2010 12:16 AM *To:* cake-php@googlegroups.com *Subject:* yahoo web hosting problem hello everybody I had a problem about hosting at yahoo web hosting. i can't upload .htaccess files (i think They Used IIS becauce IIS do not support .htaccess, CMIIW) so I use the way in http://book.cakephp.org/view/1533/A-Note-on-mod_rewrite to fix the problem. it's works. but now, i have new problem. i can't upload image. (I use jqimagecrop component), and TinyMCE does not work too, I have tried the tutorial on http://blog.knightdna.net/2010/07/enabling-cakephp-pretty-urls-on-iis.htmland http://book.cakephp.org/view/1636/URL -Rewrites-on-IIS7-Windows-hosts but failed. Is there someone who knows how to solve this problem? please help me. thanks before :) Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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.comcake-php%2bunsubscr...@googlegroups.comFor more options, visit this group at http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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.comcake-php%2bunsubscr...@googlegroups.comFor more options, visit this group at http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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: Problem with Cake session time out and security level
Hi, I know that but my problem is not this one. I want to know how to have these 3 conditions fullfilled: 1) Security level to medium (and not high) 2) A given time-out of 90 seconds 3) An automatic log-out after browser closing So far, I can't find a way to do it! On Nov 16, 5:56 am, Amit Badkas amit.sanis...@gmail.com wrote: Hi, If you want custom session settings then change configuration to something like Configure::write('Session.save', 'my_session'); and after that create app/config/my_session.php where you can define your own session settings, something like ini_set('session.use_trans_sid', 0); ini_set('session.name', Configure::read('Session.cookie')); ini_set('session.cookie_lifetime', 0); ini_set('session.cookie_path', $this-path); Hope this helps. Amit Badkas PHP Applications for E-Biz:http://www.sanisoft.com On Tue, Nov 16, 2010 at 12:41 AM, thomaus tho...@saimiris.com wrote: Hi, My question is simple. Is it possible to have these 3 things set-up for my project: 1) Security level to medium (and not high) 2) A given time-out of 90 seconds 3) An automatic log-out after browser closing ??? From what I understood, if I want 3, then I need to set the Security level to high, which I don't want. Now, I can set manually 3 by writing ini_set('session.cookie_lifetime', 0); in a session config file, but then how can I set a number of seconds for the session time-out??? So it seems like my request is impossible. Is it? That would be completely incredible! Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with their CakePHP related questions. 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.comcake-php%2bunsubscr...@googlegroups.comFor more options, visit this group at http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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: Problem with Cake session time out and security level
Hi, I think following code will do the trick alongwith custom session settings, try Configure::write('Session.timeout', 0.9); Amit Badkas PHP Applications for E-Biz: http://www.sanisoft.com On Tue, Nov 16, 2010 at 6:04 PM, thomaus tho...@saimiris.com wrote: Hi, I know that but my problem is not this one. I want to know how to have these 3 conditions fullfilled: 1) Security level to medium (and not high) 2) A given time-out of 90 seconds 3) An automatic log-out after browser closing So far, I can't find a way to do it! On Nov 16, 5:56 am, Amit Badkas amit.sanis...@gmail.com wrote: Hi, If you want custom session settings then change configuration to something like Configure::write('Session.save', 'my_session'); and after that create app/config/my_session.php where you can define your own session settings, something like ini_set('session.use_trans_sid', 0); ini_set('session.name', Configure::read('Session.cookie')); ini_set('session.cookie_lifetime', 0); ini_set('session.cookie_path', $this-path); Hope this helps. Amit Badkas PHP Applications for E-Biz:http://www.sanisoft.com On Tue, Nov 16, 2010 at 12:41 AM, thomaus tho...@saimiris.com wrote: Hi, My question is simple. Is it possible to have these 3 things set-up for my project: 1) Security level to medium (and not high) 2) A given time-out of 90 seconds 3) An automatic log-out after browser closing ??? From what I understood, if I want 3, then I need to set the Security level to high, which I don't want. Now, I can set manually 3 by writing ini_set('session.cookie_lifetime', 0); in a session config file, but then how can I set a number of seconds for the session time-out??? So it seems like my request is impossible. Is it? That would be completely incredible! Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with their CakePHP related questions. 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.comcake-php%2bunsubscr...@googlegroups.com cake-php%2bunsubscr...@googlegroups.comcake-php%252bunsubscr...@googlegroups.comFor more options, visit this group at http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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.comcake-php%2bunsubscr...@googlegroups.comFor more options, visit this group at http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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: Solved: Submit button label in e.g. swedish
thats strange i would have thought the problem is that your file is not saved as utf8... On 16 Nov., 15:39, Björn N edtb...@gmail.com wrote: Thank you Amit and cricket. Either of these does work. echo $form-end(array('label' = 'Lägg till', 'escape' = false)); Amit Badkas Try: echo $form-submit('Lägg till', array(escape' = false)); echo $form-end(); Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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
CakePHP Model uses the wrong fields in SQL statements!
Hi, I have a bunch of models with various associations set up between them and seems like Cakephp at times executes incorrect SQL statement and cause MySQL to barf. Please refer the the EDIT followed by this to see some examples of the problem. It doesn't happen all the time but it eventually happens since I am doing everything in a tight loop. Please help. This really makes me question my decision to go with Cake since this sounds bad. Thanks. EDIT 1 I just ran into the problem and here is the faulty SQL: SELECT COUNT(*) AS `count` FROM `albums_songs` AS `AlbumSong` WHERE `ArtistGenre`.`id` = 26482 AlbumSong and ArtistGenre are two completely separate tables and they are not related at all. EDIT 2 Just ran into another failure. The code is: $this-Song-find('first', array('conditions' = array('Song.artist_id' = 30188, 'Song.name' = 'Pal Pal (By.Tarkhanz)'), 'fields' = array('Song.id'))) While the generated SQL is: SELECT `Song`.`id` FROM `songs` AS `Song` WHERE `Artist`.`name` = 'Annie Villeneuve'LIMIT 1 As you can see no were in the conditions do I specify an Artist.name yet the SQL generated is looking at it. EDIT 3 Another example failure. Call is as followed: $this-Song-id = $song_id; $library_count = $this-Song-field('Song.library_count'); Yet the SQL is: SELECT `Song`.`library_count` FROM `songs` AS `Song` WHERE `Artist`.`name` = 'Mazikana_Ragheb_Allama'LIMIT 1 where Artist.name is not a column of Song as it belongs to the Artist model. Thanks. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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: CakePHP Model uses the wrong fields in SQL statements!
On Tue, Nov 16, 2010 at 12:50 PM, qua...@gmail.com qua...@gmail.com wrote: Hi, I have a bunch of models with various associations set up between them and seems like Cakephp at times executes incorrect SQL statement and cause MySQL to barf. Please refer the the EDIT followed by this to see some examples of the problem. It doesn't happen all the time but it eventually happens since I am doing everything in a tight loop. Difficult to say without seeing more code (and your model relations) but my first guess is that you're not calling Model-create() during each iteration. But I suppose this could be due to some incorrect associations, also. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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: CakePHP Model uses the wrong fields in SQL statements!
I think there is an explanation to this. To me it seems just imposibile to generate this. Something somewhere is certainly wrong. And I don't thing cake is. Why not check the core ? For example try: recursive = -1 See if happens again. Does this happens on every call ? On Tue, Nov 16, 2010 at 7:50 PM, qua...@gmail.com qua...@gmail.com wrote: Hi, I have a bunch of models with various associations set up between them and seems like Cakephp at times executes incorrect SQL statement and cause MySQL to barf. Please refer the the EDIT followed by this to see some examples of the problem. It doesn't happen all the time but it eventually happens since I am doing everything in a tight loop. Please help. This really makes me question my decision to go with Cake since this sounds bad. Thanks. EDIT 1 I just ran into the problem and here is the faulty SQL: SELECT COUNT(*) AS `count` FROM `albums_songs` AS `AlbumSong` WHERE `ArtistGenre`.`id` = 26482 AlbumSong and ArtistGenre are two completely separate tables and they are not related at all. EDIT 2 Just ran into another failure. The code is: $this-Song-find('first', array('conditions' = array('Song.artist_id' = 30188, 'Song.name' = 'Pal Pal (By.Tarkhanz)'), 'fields' = array('Song.id'))) While the generated SQL is: SELECT `Song`.`id` FROM `songs` AS `Song` WHERE `Artist`.`name` = 'Annie Villeneuve'LIMIT 1 As you can see no were in the conditions do I specify an Artist.name yet the SQL generated is looking at it. EDIT 3 Another example failure. Call is as followed: $this-Song-id = $song_id; $library_count = $this-Song-field('Song.library_count'); Yet the SQL is: SELECT `Song`.`library_count` FROM `songs` AS `Song` WHERE `Artist`.`name` = 'Mazikana_Ragheb_Allama'LIMIT 1 where Artist.name is not a column of Song as it belongs to the Artist model. Thanks. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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.comcake-php%2bunsubscr...@googlegroups.comFor more options, visit this group at http://groups.google.com/group/cake-php?hl=en -- Thanks, Bogdan Iulian Bursuc Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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: CakePHP should be more strict with unclean configuration, e.g. when specifying missing components! --psybear
Well you're going to hate Cake 2.0 which is getting rid of the error system in place of exceptions :P On Nov 16, 12:47 am, Joshua Muheim psybea...@gmail.com wrote: Thank you for your replies. I was not aware that false is returned, so I'm taking back my accusation that CakePHP is lazy. Still I'd like to have an option that CakePHP automatically cries when in development mode... On Sat, Nov 13, 2010 at 5:32 PM, mark_story mark.st...@gmail.com wrote: Also App::import() returns false when an import fails. If you are interested in whether or not things succeed, you could check the return value of the method. -Mark On Nov 12, 5:05 am, psybear83 psybea...@gmail.com wrote: Hi all I don't get it why CakePHP doesn't complain about stuff like when one specifies missing components or fixtures: var $components = array('SomeNotExistingComponent'); var $fixtures = array('app.this_fixture_does_not_exist'); App::import('Lib', 'TheresNoSuchFileInLib'); All the three lines do not result in any error, and I guess there's more of that like $uses or stuff, but I didn't investigate this any further. Can anyone tell me why CakePHP just doesn't care about stuff like that? Seems vry unresponsible to me... Thanks for any hints Josh Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with their CakePHP related questions. 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 athttp://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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: Saving Loading Session Data
On Tue, Nov 16, 2010 at 9:23 AM, Stephen step...@ninjacodermonkey.co.uk wrote: Hi There I need to give my customers the ability to save incomplete orders and restore them at a later date. The orders are quite intricate and can sometimes contain a lot of data (this is another reason why I need save and load). The data is contained within $this-Session-read('Order'); Any hints on how I can achieve this? I don't want to save other session data including auth session data. You could create a SavedOrder model, complete with associations to all other data models involved. I've done something similar. Or, I guess you could save the Order, but leave some flag column set to 0 (incomplete), for example. Are the users logged in? Having a user_id would make it a bit simpler but it's not strictly necessary. You could simply save a long-term cookie with the SavedOrder.id (I'd suggest to use UUID for that). If the cookie expires before they return, too bad. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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: CakePHP Model uses the wrong fields in SQL statements!
No, it doesn't happen to every calls. I start the loop, and eventually it will fail due to incorrect SQL statement executed. And it happens all over the places as you can see from my examples. Thanks. On Nov 16, 10:20 am, Bogdan Bursuc bogdanbursu...@gmail.com wrote: I think there is an explanation to this. To me it seems just imposibile to generate this. Something somewhere is certainly wrong. And I don't thing cake is. Why not check the core ? For example try: recursive = -1 See if happens again. Does this happens on every call ? On Tue, Nov 16, 2010 at 7:50 PM, qua...@gmail.com qua...@gmail.com wrote: Hi, I have a bunch of models with various associations set up between them and seems like Cakephp at times executes incorrect SQL statement and cause MySQL to barf. Please refer the the EDIT followed by this to see some examples of the problem. It doesn't happen all the time but it eventually happens since I am doing everything in a tight loop. Please help. This really makes me question my decision to go with Cake since this sounds bad. Thanks. EDIT 1 I just ran into the problem and here is the faulty SQL: SELECT COUNT(*) AS `count` FROM `albums_songs` AS `AlbumSong` WHERE `ArtistGenre`.`id` = 26482 AlbumSong and ArtistGenre are two completely separate tables and they are not related at all. EDIT 2 Just ran into another failure. The code is: $this-Song-find('first', array('conditions' = array('Song.artist_id' = 30188, 'Song.name' = 'Pal Pal (By.Tarkhanz)'), 'fields' = array('Song.id'))) While the generated SQL is: SELECT `Song`.`id` FROM `songs` AS `Song` WHERE `Artist`.`name` = 'Annie Villeneuve' LIMIT 1 As you can see no were in the conditions do I specify an Artist.name yet the SQL generated is looking at it. EDIT 3 Another example failure. Call is as followed: $this-Song-id = $song_id; $library_count = $this-Song-field('Song.library_count'); Yet the SQL is: SELECT `Song`.`library_count` FROM `songs` AS `Song` WHERE `Artist`.`name` = 'Mazikana_Ragheb_Allama' LIMIT 1 where Artist.name is not a column of Song as it belongs to the Artist model. Thanks. Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with their CakePHP related questions. 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.comcake-php%2bunsubscr...@googlegroups.comFor more options, visit this group at http://groups.google.com/group/cake-php?hl=en -- Thanks, Bogdan Iulian Bursuc Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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: CakePHP Model uses the wrong fields in SQL statements!
I do call Create() before any Save operation. You think I need to do that even for Read operation? Thanks. On Nov 16, 10:18 am, cricket zijn.digi...@gmail.com wrote: On Tue, Nov 16, 2010 at 12:50 PM, qua...@gmail.com qua...@gmail.com wrote: Hi, I have a bunch of models with various associations set up between them and seems like Cakephp at times executes incorrect SQL statement and cause MySQL to barf. Please refer the the EDIT followed by this to see some examples of the problem. It doesn't happen all the time but it eventually happens since I am doing everything in a tight loop. Difficult to say without seeing more code (and your model relations) but my first guess is that you're not calling Model-create() during each iteration. But I suppose this could be due to some incorrect associations, also. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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: Book software like on book.cakephp.org
On Mon, Nov 15, 2010 at 10:18 AM, Saša sasa.eb...@gmail.com wrote: Hey guys, (Maybe a little off-topic) I was just browsing through http://book.cakephp.org/view/875/x1-3-Collection and marveling at the implementation of the book software. Is this open? And if not do you know of any similar web apps that allow a community of contributors to create a book together? I would like to be able to auto generate a nightly PDF from the book pages. Will I need to implement this from scratch? I recall seeing mention on the list that the code and data for the manual can be downloaded, but from where I don't know. Myself and others haven't been able to log in for some time now, although that's apparently being fixed. Personally, I find the manual/cookbook to be sorely in need of some sprucing up and have been pondering for a while now jumping in to do just that. While it's gotten a lot better it's still not organised in a practical way, IMHO. I find it cumbersome to drill down through many levels every time I'm looking for something, usually to learn that the page I need is in fact buried several levels down in an adjacent branch. That may be due, in part, to the many hands approach to building it. It would also benefit from making proper use of slugs. The request, /view/875/x1-3-Collection doesn't use the slug to best advantage. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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: CakePHP Model uses the wrong fields in SQL statements!
On Tue, Nov 16, 2010 at 1:37 PM, qua...@gmail.com qua...@gmail.com wrote: I do call Create() before any Save operation. You think I need to do that even for Read operation? Possibly. Are you reading inside a loop? But I won't speculate without seeing more code. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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: Why only pass $data to view instead of model instance?
The whole point of the MVC pattern is to separate the Model from the View through the use of a Controller. On Tue, Nov 16, 2010 at 3:45 AM, Joshua Muheim psybea...@gmail.com wrote: Also an interesting idea, Miles. Thanks for mentioning it. On Fri, Nov 12, 2010 at 8:00 PM, Miles J mileswjohn...@gmail.com wrote: I dislike this also. Cake really should have more than 1 model type: DAOModel and DataModel. One deals with database interactions, while the other manipulates a dataset for the view. However, there is nothing stopping you creating these extra models. $this-set('data', new UserDataModel($this-User-find())); On Nov 12, 5:23 am, Joshua Muheim psybea...@gmail.com wrote: I'd like to warm up this topic again. :-) I decided to pass model instances to the views instead of just their $data attributes. So is there a way to tweak the paginator to do exactly this? Thanks, Josh On Thu, Oct 28, 2010 at 8:26 PM, euromark dereurom...@googlemail.com wrote: i tend to do those things on demand using a behavior to add new keys or even doing it in the model afterFind() etc often results in additional work without actually needing this information but of course this depends on the particular case On 28 Okt., 20:10, cricket zijn.digi...@gmail.com wrote: On Thu, Oct 28, 2010 at 10:03 AM, euromark dereurom...@googlemail.com wrote: thats not correct for PHP5 anymore in PHP4 you needed to do this but in PHP5 it is passed by reference by default, afaik Agreed on passing the model to the view. But this could also be accomplished in afterFind(), adding new key = value to the data array. Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with their CakePHP related questions. 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 athttp://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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 Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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 Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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: Why only pass $data to view instead of model instance?
No - the point of MVC is really to separate the manipulation of model data from the view through the use of a controller. There's nothing wrong with reading data from a model in a view, unless you like needless overhead. Lots of respected frameworks do it (like the Zend Framework). On Nov 16, 10:50 am, cricket zijn.digi...@gmail.com wrote: The whole point of the MVC pattern is to separate the Model from the View through the use of a Controller. On Tue, Nov 16, 2010 at 3:45 AM, Joshua Muheim psybea...@gmail.com wrote: Also an interesting idea, Miles. Thanks for mentioning it. On Fri, Nov 12, 2010 at 8:00 PM, Miles J mileswjohn...@gmail.com wrote: I dislike this also. Cake really should have more than 1 model type: DAOModel and DataModel. One deals with database interactions, while the other manipulates a dataset for the view. However, there is nothing stopping you creating these extra models. $this-set('data', new UserDataModel($this-User-find())); On Nov 12, 5:23 am, Joshua Muheim psybea...@gmail.com wrote: I'd like to warm up this topic again. :-) I decided to pass model instances to the views instead of just their $data attributes. So is there a way to tweak the paginator to do exactly this? Thanks, Josh On Thu, Oct 28, 2010 at 8:26 PM, euromark dereurom...@googlemail.com wrote: i tend to do those things on demand using a behavior to add new keys or even doing it in the model afterFind() etc often results in additional work without actually needing this information but of course this depends on the particular case On 28 Okt., 20:10, cricket zijn.digi...@gmail.com wrote: On Thu, Oct 28, 2010 at 10:03 AM, euromark dereurom...@googlemail.com wrote: thats not correct for PHP5 anymore in PHP4 you needed to do this but in PHP5 it is passed by reference by default, afaik Agreed on passing the model to the view. But this could also be accomplished in afterFind(), adding new key = value to the data array. Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others with their CakePHP related questions. 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 athttp://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with their CakePHP related questions. 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 athttp://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with their CakePHP related questions. 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 athttp://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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: Why only pass $data to view instead of model instance?
On Tue, Nov 16, 2010 at 2:09 PM, Jamie jamie@gmail.com wrote: No - the point of MVC is really to separate the manipulation of model data from the view through the use of a controller. There's nothing wrong with reading data from a model in a view, unless you like needless overhead. Lots of respected frameworks do it (like the Zend Framework). Right, and so making the model available for reading from the view would NEVER lead to its manipulation. Sure. And what needless overhead? There are several simple (and cheap) ways to get your data to the view without passing the model to it. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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: Auth / Acl redirect issue CakePHP 1.3.4
I am not sure that is one hundred percent accurate, if I am logged in as an admin and i type a restricted URL in the address bar of the browser I get redirected to the main site home page. If i am not logged in and I type the same restricted URL in the address bar of the browser i get redirected to the admin/login page and I get a flash message saying that I am not authorized to access that location. So how does the app know to redirect me to the admin/login page when not logged in, but when logged in I get redirected to the main site home page? On Nov 16, 12:08 am, Amit Badkas amit.sanis...@gmail.com wrote: Hi, The redirection after ACL fails depends on HTTP_REFERER environment variable. If you access the restricted URL directly then referrer doesn't get set, that's why '/' (by default, home page) is being used. Amit Badkas PHP Applications for E-Biz:http://www.sanisoft.com On Mon, Nov 15, 2010 at 10:06 PM, danielnolan danielano...@gmail.comwrote: I have an application setup with admin prefix route, Auth, and ACL. everything seems to be working as expected, except when I am logged in as an admin user and I try to access a ACL restriced action by typing the url in the address bar of the browser. I get redirected to the home page of the site (view/pages/home.ctp) instead of the admin dashboard (users/admin_dashboard) i have created. If I click on a link to the exact same action in the admin dashboard that is restricted, I get redirected to the admin dashboard as expected with an auth error message telling me I am not authorized to access that location. What am I missing? Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with their CakePHP related questions. 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.comcake-php%2bunsubscr...@googlegroups.comFor more options, visit this group at http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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
array fieldName length
Hi. Everybody. I have a problem with the length of the fieldName in the array data. In my Database Table Have fieldNames with lenght of 42 words, but when I read this row, CakePHP truncate the name of that field. For example if the field is name total_incidencias_1_5_materias_todos_grados CAKE truncate it to total_incidencias_1_5_materias_tod. I use PostgreSQL if is necesary to know wich database Im using. Does anybody know how solve it? I can't truncate the fieldname on the table. Thanks !!! Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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: Why only pass $data to view instead of model instance?
@Cricket - How so? Just because the model has database access? It really doesn't matter if you pass the model to the view if you are using it for convenience methods. I think you are completely missing the point, this isn't about passing data to the view. On Nov 16, 11:24 am, cricket zijn.digi...@gmail.com wrote: On Tue, Nov 16, 2010 at 2:09 PM, Jamie jamie@gmail.com wrote: No - the point of MVC is really to separate the manipulation of model data from the view through the use of a controller. There's nothing wrong with reading data from a model in a view, unless you like needless overhead. Lots of respected frameworks do it (like the Zend Framework). Right, and so making the model available for reading from the view would NEVER lead to its manipulation. Sure. And what needless overhead? There are several simple (and cheap) ways to get your data to the view without passing the model to it. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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: Why only pass $data to view instead of model instance?
On Tue, Nov 16, 2010 at 5:22 PM, Miles J mileswjohn...@gmail.com wrote: @Cricket - How so? Just because the model has database access? It really doesn't matter if you pass the model to the view if you are using it for convenience methods. I think you are completely missing the point, this isn't about passing data to the view. Not sure I understand what you mean, either. Not providing a model (by default) to the view is a design decision based on separation of concerns (google it). In a well-designed MVC framework, it not only isn't necessary but would likely also be detrimental. And the point I was trying to make is that having a model available for convenience methods is no different from having it available for DB writes. ... Which goes against the principles of the MVC pattern. IOW, this isn't a those Cake devs and their crazy notions thing, but borne of a decision to utilise the MVC pattern. However, as Andy will remind us, it's just PHP, and so it's a simple matter to shoot oneself in the foot if one wants. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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
Baffling blank screen problem
I have a new CakePHP installation I'm fiddling around with. I've built a reasonably sophisticated CakePHP app before, so I like to think I know my way around CakePHP, but am by no means an expert. On my new installation, my test page (/pages/home) works fine. If I come back after a few hours and refresh, I get a blank page. There is no HTML being served at all. All other pages are the same. If I enable debugging then refresh, the page loads. Then I disable debugging, and the page *still* loads. But a couple of hours later, the whole thing happens again. This problem occurs in any web browser, so I'm fairly sure it's a server-side problem. I'm not sure how to debug this problem. Any suggestions? Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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: Baffling blank screen problem
On Tue, Nov 16, 2010 at 7:00 PM, Jules fattyju...@gmail.com wrote: I have a new CakePHP installation I'm fiddling around with. I've built a reasonably sophisticated CakePHP app before, so I like to think I know my way around CakePHP, but am by no means an expert. On my new installation, my test page (/pages/home) works fine. If I come back after a few hours and refresh, I get a blank page. There is no HTML being served at all. All other pages are the same. If I enable debugging then refresh, the page loads. Then I disable debugging, and the page *still* loads. But a couple of hours later, the whole thing happens again. This problem occurs in any web browser, so I'm fairly sure it's a server-side problem. I'm not sure how to debug this problem. Any suggestions? Maybe something to do with caching. Are you doing anything out of the ordinary in that respect? Anything in the server's log? Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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: Why only pass $data to view instead of model instance?
Actually that's wrong. If this was a pure OOP framework, then we would be passing the model or some kind of object to the view, but we are not since Cake uses array as its primary data structure. Say you had a method like this in your User model: public function isActive() { return $this-data['User']['active'] == User::STATUS_ACTIVE; } Then all you would need to do in the view is: if ($model-isActive()) That cuts out the whole problem of having to manually write that condition every time its used. It also cuts out the need of a helper that handles this function when its unnecessary. Furthermore, Cake models are used incorrectly in my opinion. Models should represent a single entity of data (getters and setters for a row in the database), while Cakes approach is a global model to database table relation. On Nov 16, 3:28 pm, cricket zijn.digi...@gmail.com wrote: On Tue, Nov 16, 2010 at 5:22 PM, Miles J mileswjohn...@gmail.com wrote: @Cricket - How so? Just because the model has database access? It really doesn't matter if you pass the model to the view if you are using it for convenience methods. I think you are completely missing the point, this isn't about passing data to the view. Not sure I understand what you mean, either. Not providing a model (by default) to the view is a design decision based on separation of concerns (google it). In a well-designed MVC framework, it not only isn't necessary but would likely also be detrimental. And the point I was trying to make is that having a model available for convenience methods is no different from having it available for DB writes. ... Which goes against the principles of the MVC pattern. IOW, this isn't a those Cake devs and their crazy notions thing, but borne of a decision to utilise the MVC pattern. However, as Andy will remind us, it's just PHP, and so it's a simple matter to shoot oneself in the foot if one wants. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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: Why only pass $data to view instead of model instance?
On Tue, Nov 16, 2010 at 9:44 PM, Miles J mileswjohn...@gmail.com wrote: Actually that's wrong. If this was a pure OOP framework, then we would be passing the model or some kind of object to the view, but we are not since Cake uses array as its primary data structure. I didn't mention OOP. But, now that you have, note that View is an object. Among its attributes is an array of data. I thought this was awkward at first, also, until I realised that it doesn't matter because View really needn't have that close a relationship with the data members themselves. That is, it wouldn't make much sense to do View::getX() or View::getY() when $x and $y are attributes of Model. Of course, I'm not going to sell anyone on that argument if they're still convinced that Model should be the object passed to the view. :-) Say you had a method like this in your User model: public function isActive() { return $this-data['User']['active'] == User::STATUS_ACTIVE; } Then all you would need to do in the view is: if ($model-isActive()) That cuts out the whole problem of having to manually write that condition every time its used. It also cuts out the need of a helper that handles this function when its unnecessary. But it's easy enough to adjust the data array in afterFind(), so that argument doesn't sway me. Think of $data as an encapsulation of your model instance. Not the entire model itself, with all of its behaviors and business logic, but the face it should present to the View. So, $data doesn't provide an isActive() method but, instead, includes the *information* that the View requires. Another example would be date formatting. Say a business needs their dates all formatted 'd-m-Y'. That's something that definitely should be handled by the model because, after all, it's the model that should deal with business logic. But it's unnecessary to call a formattedDate() method when we can just add a 'formatted_date' field to $data in afterFind(). Something like that could be put in AppModel, in fact. Either way, it's a cinch to just push it onto the array. (Another site might need to format dates according to users' locale. In that case, the logic should probably be handled in the view, perhaps with a helper.) Furthermore, Cake models are used incorrectly in my opinion. Models should represent a single entity of data (getters and setters for a row in the database), while Cakes approach is a global model to database table relation. I'd argue that Cake's ORM makes more sense. There are always going to be trade-offs when attempting to map objects to relational data, but Cake's DB table to array scheme has worked very well so far. Remember that the model's $data is not the entirety of the model. It's just the encapsulation for the View. If the latter requires more than what's been given to it, you simply have to add it in. That's business logic. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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: Problem with Cake session time out and security level
Hi, Have you also added following code to your custom session settings file? ini_set('session.cookie_lifetime', 0); Also try after removing existing session cookies manually from the browser. Amit Badkas PHP Applications for E-Biz: http://www.sanisoft.com On Tue, Nov 16, 2010 at 7:37 PM, thomaus tho...@saimiris.com wrote: Hi, The piece of code you gave me lets me setting the time-out to 90 seconds, but it doesn't log-out after browser closing, unless I set the Security level to high, which I don't want. So still the same problem... Thanks a lot for helping anyway! On Nov 16, 1:57 pm, Amit Badkas amit.sanis...@gmail.com wrote: Hi, I think following code will do the trick alongwith custom session settings, try Configure::write('Session.timeout', 0.9); Amit Badkas PHP Applications for E-Biz:http://www.sanisoft.com On Tue, Nov 16, 2010 at 6:04 PM, thomaus tho...@saimiris.com wrote: Hi, I know that but my problem is not this one. I want to know how to have these 3 conditions fullfilled: 1) Security level to medium (and not high) 2) A given time-out of 90 seconds 3) An automatic log-out after browser closing So far, I can't find a way to do it! On Nov 16, 5:56 am, Amit Badkas amit.sanis...@gmail.com wrote: Hi, If you want custom session settings then change configuration to something like Configure::write('Session.save', 'my_session'); and after that create app/config/my_session.php where you can define your own session settings, something like ini_set('session.use_trans_sid', 0); ini_set('session.name', Configure::read('Session.cookie')); ini_set('session.cookie_lifetime', 0); ini_set('session.cookie_path', $this-path); Hope this helps. Amit Badkas PHP Applications for E-Biz:http://www.sanisoft.com On Tue, Nov 16, 2010 at 12:41 AM, thomaus tho...@saimiris.com wrote: Hi, My question is simple. Is it possible to have these 3 things set-up for my project: 1) Security level to medium (and not high) 2) A given time-out of 90 seconds 3) An automatic log-out after browser closing ??? From what I understood, if I want 3, then I need to set the Security level to high, which I don't want. Now, I can set manually 3 by writing ini_set('session.cookie_lifetime', 0); in a session config file, but then how can I set a number of seconds for the session time-out??? So it seems like my request is impossible. Is it? That would be completely incredible! Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others with their CakePHP related questions. 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.comcake-php%2bunsubscr...@googlegroups.com cake-php%2bunsubscr...@googlegroups.comcake-php%252bunsubscr...@googlegroups.com cake-php%2bunsubscr...@googlegroups.comcake-php%252bunsubscr...@googlegroups.com cake-php%252bunsubscr...@googlegroups.comcake-php%25252bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with their CakePHP related questions. 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.comcake-php%2bunsubscr...@googlegroups.com cake-php%2bunsubscr...@googlegroups.comcake-php%252bunsubscr...@googlegroups.comFor more options, visit this group at http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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.comcake-php%2bunsubscr...@googlegroups.comFor more options, visit this group at http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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: Constants in hasAndBelongsToMany relationship.
Hi John, Thanks for your reply!! It was very helpful and I got the idea now. I understand that having those constants in a table is totally fine as the database design. Yes, the payment method in my case could be added in the future, so this time I'll take the classifiers table approach. Thank you very much again for your help!! Kura On 11月14日, 午後7:19, John Andersen j.andersen...@gmail.com wrote: Consider your future requirements regarding payments - could there in the future be other kinds of payment methods that you would like to include? If the answer to that is No, then go for another solution, like having each payment method as a logical field in your seminar table. If the answer to that is Yes, then go for the table. Usually what I do, when I have several small sets of classification records, is to create one table to hold them all, like this: classifiers: id int name varchar(20) // Name, ex. CASH, CREDITCARD. classifier_id int Using your example, the records would be: id, name, classifier_id 1, PAYMENT METHOD, null 2, CASH, 1 3, CREDITCARD, null 4, BANK TRANSFER, null etc. Thus your example becomes: Seminar HABTM Classifier OtherModel HABTM Classifier etc. Hope you get the idea, enjoy, John On 14 Nov., 08:29, kura kurakur...@gmail.com wrote: Hi, This may be a very basic question, but I've been struggling with a design problem in hasAndBelongsToMany relationship. I have a Seminar model that represents seminar information, and each of the seminar can have many payment methods like in Cash, CreditCard, Bank Transfer, etc. I have defined the PaymentMethod definitions in bootstrap.php as follows: Configure::write('PaymentMethod.Cash', 1); Configure::write('PaymentMethod.CreditCard', 2); Configure::write('PaymentMethod.BankTransfer', 3); ... As the seminars can have many payment methods, and each payment method can have many seminars that uses it, the relationship between Seminar and PaymentMethod models is Has And Belongs To Many (HABTM). If I want to use the CakePHP HABTM relationship functionality, it seems that I need to have a database table for the PaymentMethod constantsas well as the Seminars and the join table seminars_payment_methods. In this case, should I create a table for the PaymentMethod and insert those constant data, instead of defining in the Configure::write() method? I don't feel it's a good design to create a table just for the constantsthat may never be modified in the app. There could be a lof of these cases, so I might have to have SO MANY of the tables that holsconstants... What is the best practice in this case? Thanks for your help in advance. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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: Auth / Acl redirect issue CakePHP 1.3.4
Hi, Auth component uses 'loginRedirect' (by default, /users/login or /admin/users/login) class property for redirecting non-logged in users to login page if you are on restricted page. Amit Badkas PHP Applications for E-Biz: http://www.sanisoft.com On Wed, Nov 17, 2010 at 12:56 AM, danielnolan danielano...@gmail.comwrote: I am not sure that is one hundred percent accurate, if I am logged in as an admin and i type a restricted URL in the address bar of the browser I get redirected to the main site home page. If i am not logged in and I type the same restricted URL in the address bar of the browser i get redirected to the admin/login page and I get a flash message saying that I am not authorized to access that location. So how does the app know to redirect me to the admin/login page when not logged in, but when logged in I get redirected to the main site home page? On Nov 16, 12:08 am, Amit Badkas amit.sanis...@gmail.com wrote: Hi, The redirection after ACL fails depends on HTTP_REFERER environment variable. If you access the restricted URL directly then referrer doesn't get set, that's why '/' (by default, home page) is being used. Amit Badkas PHP Applications for E-Biz:http://www.sanisoft.com On Mon, Nov 15, 2010 at 10:06 PM, danielnolan danielano...@gmail.com wrote: I have an application setup with admin prefix route, Auth, and ACL. everything seems to be working as expected, except when I am logged in as an admin user and I try to access a ACL restriced action by typing the url in the address bar of the browser. I get redirected to the home page of the site (view/pages/home.ctp) instead of the admin dashboard (users/admin_dashboard) i have created. If I click on a link to the exact same action in the admin dashboard that is restricted, I get redirected to the admin dashboard as expected with an auth error message telling me I am not authorized to access that location. What am I missing? Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with their CakePHP related questions. 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.comcake-php%2bunsubscr...@googlegroups.com cake-php%2bunsubscr...@googlegroups.comcake-php%252bunsubscr...@googlegroups.comFor more options, visit this group at http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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.comcake-php%2bunsubscr...@googlegroups.comFor more options, visit this group at http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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: Why only pass $data to view instead of model instance?
I guess it all boils down to personal preference then :P On Nov 16, 8:20 pm, cricket zijn.digi...@gmail.com wrote: On Tue, Nov 16, 2010 at 9:44 PM, Miles J mileswjohn...@gmail.com wrote: Actually that's wrong. If this was a pure OOP framework, then we would be passing the model or some kind of object to the view, but we are not since Cake uses array as its primary data structure. I didn't mention OOP. But, now that you have, note that View is an object. Among its attributes is an array of data. I thought this was awkward at first, also, until I realised that it doesn't matter because View really needn't have that close a relationship with the data members themselves. That is, it wouldn't make much sense to do View::getX() or View::getY() when $x and $y are attributes of Model. Of course, I'm not going to sell anyone on that argument if they're still convinced that Model should be the object passed to the view. :-) Say you had a method like this in your User model: public function isActive() { return $this-data['User']['active'] == User::STATUS_ACTIVE; } Then all you would need to do in the view is: if ($model-isActive()) That cuts out the whole problem of having to manually write that condition every time its used. It also cuts out the need of a helper that handles this function when its unnecessary. But it's easy enough to adjust the data array in afterFind(), so that argument doesn't sway me. Think of $data as an encapsulation of your model instance. Not the entire model itself, with all of its behaviors and business logic, but the face it should present to the View. So, $data doesn't provide an isActive() method but, instead, includes the *information* that the View requires. Another example would be date formatting. Say a business needs their dates all formatted 'd-m-Y'. That's something that definitely should be handled by the model because, after all, it's the model that should deal with business logic. But it's unnecessary to call a formattedDate() method when we can just add a 'formatted_date' field to $data in afterFind(). Something like that could be put in AppModel, in fact. Either way, it's a cinch to just push it onto the array. (Another site might need to format dates according to users' locale. In that case, the logic should probably be handled in the view, perhaps with a helper.) Furthermore, Cake models are used incorrectly in my opinion. Models should represent a single entity of data (getters and setters for a row in the database), while Cakes approach is a global model to database table relation. I'd argue that Cake's ORM makes more sense. There are always going to be trade-offs when attempting to map objects to relational data, but Cake's DB table to array scheme has worked very well so far. Remember that the model's $data is not the entirety of the model. It's just the encapsulation for the View. If the latter requires more than what's been given to it, you simply have to add it in. That's business logic. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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: Why only pass $data to view instead of model instance?
There is a known debate about if the controller should know about the model and view while the model and view should not know about each other Or, the view should know about the model for update purpose for example. I prefer the the first approach but I understand the other is ok too. Considering the fact that controller may have several models and several views it should hide the data gathering process from the view. For example: You have a users model controller and view. Then you decide to extract the email column to a different profile table. All you need to do is playing with your models and controller and do nothing with the view. But if you passed the model to the view you need now to pass the new profile model and make changes to your view. On Wed, Nov 17, 2010 at 6:20 AM, cricket zijn.digi...@gmail.com wrote: On Tue, Nov 16, 2010 at 9:44 PM, Miles J mileswjohn...@gmail.com wrote: Actually that's wrong. If this was a pure OOP framework, then we would be passing the model or some kind of object to the view, but we are not since Cake uses array as its primary data structure. I didn't mention OOP. But, now that you have, note that View is an object. Among its attributes is an array of data. I thought this was awkward at first, also, until I realised that it doesn't matter because View really needn't have that close a relationship with the data members themselves. That is, it wouldn't make much sense to do View::getX() or View::getY() when $x and $y are attributes of Model. Of course, I'm not going to sell anyone on that argument if they're still convinced that Model should be the object passed to the view. :-) Say you had a method like this in your User model: public function isActive() { return $this-data['User']['active'] == User::STATUS_ACTIVE; } Then all you would need to do in the view is: if ($model-isActive()) That cuts out the whole problem of having to manually write that condition every time its used. It also cuts out the need of a helper that handles this function when its unnecessary. But it's easy enough to adjust the data array in afterFind(), so that argument doesn't sway me. Think of $data as an encapsulation of your model instance. Not the entire model itself, with all of its behaviors and business logic, but the face it should present to the View. So, $data doesn't provide an isActive() method but, instead, includes the *information* that the View requires. Another example would be date formatting. Say a business needs their dates all formatted 'd-m-Y'. That's something that definitely should be handled by the model because, after all, it's the model that should deal with business logic. But it's unnecessary to call a formattedDate() method when we can just add a 'formatted_date' field to $data in afterFind(). Something like that could be put in AppModel, in fact. Either way, it's a cinch to just push it onto the array. (Another site might need to format dates according to users' locale. In that case, the logic should probably be handled in the view, perhaps with a helper.) Furthermore, Cake models are used incorrectly in my opinion. Models should represent a single entity of data (getters and setters for a row in the database), while Cakes approach is a global model to database table relation. I'd argue that Cake's ORM makes more sense. There are always going to be trade-offs when attempting to map objects to relational data, but Cake's DB table to array scheme has worked very well so far. Remember that the model's $data is not the entirety of the model. It's just the encapsulation for the View. If the latter requires more than what's been given to it, you simply have to add it in. That's business logic. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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.comcake-php%2bunsubscr...@googlegroups.comFor more options, visit this group at http://groups.google.com/group/cake-php?hl=en -- Regards, Zaky Katalan-Ezra QA Administrator www.IGeneriX.com Sites.IGeneriX.com 054-7762312 Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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: CakePHP should be more strict with unclean configuration, e.g. when specifying missing components! --psybear
@Miles: oh no for sure I won't! That's exactly what I was expecting from CakePHP 2.0 already... :-P On Tue, Nov 16, 2010 at 7:24 PM, Miles J mileswjohn...@gmail.com wrote: Well you're going to hate Cake 2.0 which is getting rid of the error system in place of exceptions :P On Nov 16, 12:47 am, Joshua Muheim psybea...@gmail.com wrote: Thank you for your replies. I was not aware that false is returned, so I'm taking back my accusation that CakePHP is lazy. Still I'd like to have an option that CakePHP automatically cries when in development mode... On Sat, Nov 13, 2010 at 5:32 PM, mark_story mark.st...@gmail.com wrote: Also App::import() returns false when an import fails. If you are interested in whether or not things succeed, you could check the return value of the method. -Mark On Nov 12, 5:05 am, psybear83 psybea...@gmail.com wrote: Hi all I don't get it why CakePHP doesn't complain about stuff like when one specifies missing components or fixtures: var $components = array('SomeNotExistingComponent'); var $fixtures = array('app.this_fixture_does_not_exist'); App::import('Lib', 'TheresNoSuchFileInLib'); All the three lines do not result in any error, and I guess there's more of that like $uses or stuff, but I didn't investigate this any further. Can anyone tell me why CakePHP just doesn't care about stuff like that? Seems vry unresponsible to me... Thanks for any hints Josh Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with their CakePHP related questions. 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 athttp://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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 Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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