Model HABTM Model Referencing Original Model
This is a duplicate of my question asked on StackOverflow here: http://stackoverflow.com/questions/17875143/model-habtm-model-referencing-original-model If you could answer the question there, or let me know if it is a bug or not, it would be greatly appreciated. I have a Team model that is HABTM Match and when I pull the data for a specific Team, I ask for the related Teams for those Matches, but Cake only returns the data for the original Team. How can I get all the Teams (the opponent) for that Match without looping through the results and pulling them that way? I am having the same issue with the Team HABTM Player association as well. When I pull a Player, Cake will not return any of the associated Players (teammates) for the linked Team. *My schema:* CREATE TABLE IF NOT EXISTS `matches` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `tournament_id` int(10) unsigned NOT NULL, `name` varchar(255) NOT NULL DEFAULT '', `created` datetime NOT NULL, PRIMARY KEY (`id`), KEY `tournament_id` (`tournament_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ; CREATE TABLE IF NOT EXISTS `matches_teams` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `match_id` int(10) unsigned NOT NULL, `team_id` int(10) unsigned NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `match_id` (`match_id`,`team_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ; CREATE TABLE IF NOT EXISTS `players` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ; CREATE TABLE IF NOT EXISTS `players_teams` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `player_id` int(10) unsigned NOT NULL, `team_id` int(10) unsigned NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `player_id` (`player_id`,`team_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ; CREATE TABLE IF NOT EXISTS `teams` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `tournament_id` int(10) unsigned NOT NULL, `name` varchar(255) NOT NULL, `seed` smallint(2) DEFAULT NULL, PRIMARY KEY (`id`), KEY `tournament_id` (`tournament_id`), KEY `seed` (`seed`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ; *My query:* $this-Team-recursive = 3; $team = $this-Team-read(null, $id); $this-set('team', $team); *I have also tried:* $this-Team-contain(array( 'Match' = array( 'Team', ), )); $team = $this-Team-read(null, $id); $this-set('team', $team); *The results (`$team`):* array (size=4) 'Team' = array (size=5) ... team data ... 'Match' = array (size=2) 0 = array (size=9) ... match data ... 'MatchesTeam' = array (size=3) 'id' = string '1' (length=1) 'match_id' = string '1' (length=1) 'team_id' = string '1' (length=1) // there should be an array for 'Team' here // that contains the opponent team 1 = ... more match data with same missing 'Team' array ... ... other related models ... -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Re: Turning off Debugkit debug data in a specific instance
Replace the element method in /DebugKit/View/DebugView.php with the following: /** * Element method, adds comment injection to the features View offers. * * @return void */ public function element($name, $data = array(), $options = array()) { $out = ''; $isHtml = (!isset($this-request-params['ext']) || $this-request-params['ext'] === 'html'); $isAjax = ( ! empty($this-request-params['isAjax'])); if ($isHtml ! $isAjax Configure::read('debug')) { $out .= sprintf(!-- %s - %s --\n, __d('debug_kit', 'Starting to render'), $name); } $out .= parent::element($name, $data, $options); if ($isHtml ! $isAjax Configure::read('debug')) { $out .= sprintf(\n!-- %s - %s --\n, __d('debug_kit', 'Finished'), $name); } return $out; } -- This will turn off the Starting to render comments if the output is not HTML (as it was), is AJAX, or if debug is off. On Tuesday, February 7, 2012 3:45:08 PM UTC-7, Chris Cinelli wrote: I would like to turn off in a specific instruction $this-element(...) the behavior that the DebugKit has to add prepending line with !-- Rendiring xxx -- etc. The result of the element rendering goes in a string that should not have those HTML comments. I would like to be able to keep the debug kit on except in that specific instance. Is there a way to achieve that ? Best, Chris -- --Everything should be made as simple as possible, but not simpler (Albert Einstein) -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Javascript Helper modification. Opinions, please.
One issue that I'm having, is that if a script is included in the default layout in the HEAD tag above the $scripts_for_layout, with the default 'inline' = true, and then again in a view (or element, or whatever) with 'inline' = false, The HtmlHelper does not recognize that the script in question has already been loaded, and proceeds to load another version of it. This is troublesome, and doubly so for scripts like jQuery, where if it gets loaded again, it loses all previously loaded plugins. How can I stop Cake from loading already loaded scripts that were loaded directly in the header of the layout? Is this a bug? Or deliberate? I've tried a few things to fix this without editing core files, but they all have their various issues. 1. Setting 'inline' = false on scripts loaded in the views, the scripts that should have been loaded via the layout template (which have 'inline' = true) get moved down in the queue, setting jQuery below some of it's plugins (which only get loaded in the layout, therefore don't get moved down, and get loaded inline as expected). 2. Setting all scripts in the layout to 'inline' = false, seems to lose all scripts that are added in the layout template. Only loading scripts that were added in the views. Not sure why. 3. Setting 'once' = false on the layout scripts, then the view instances of the scripts get loaded as well. It seems that 'once' = false bypasses the storage of the script name into the __includedScriptsarray. Any other methods for getting this to work as I'm expecting? -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. 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
Re: Javascript Helper modification. Opinions, please.
It also seems that scripts added in the default layout or through elements that are included in the default layout don't have their scripts added to the queue at all. I was going to try adding all the default scripts in via an element, but they just get ignored. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. 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
How to get $settings data out of FormAuthenticate object (cake2.0)
I am building a RememberMe Component using the AuthComponent and would like to get the BaseAuthenticate::$settings data (userModel and fields) data out of the XxxxAuthenticate object so I can know what model and fields I should be dealing with, but I can't seem to figure out how to get that data back out. Any suggestions? Cake- 2.0.3 -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. 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
Fatal error: Call to a member function here()
I ran into a fatal error on my home page. Fatal error: Call to a member function here() on a non-object in C: \Development\cake_files\cake_2.0.0-rc3\lib\Cake\Error \ExceptionRenderer.php on line 182 Not sure what to do about it as it's a core issue. Is there something I'm missing? Cake2.0.0-rc3 -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. 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
Containable and find('list')
A similar question was asked previously (about two years ago) and I was just looking for some further clarification but didn't want to revive a dead thread... I was trying to do a find('list') on a model and trying to pull information from another model (for grouping purposes) via the containable behavior and it wouldn't work. I dug into the containable behavior file, and noticed on around line 175 (of v1.2.6) that if the find type is list or count, that containable won't do anything, and just returns the base query without adding anything. I was wondering why this is? Is there some underlying issue that is preventing the contained models from being added to the query when the type is list or count? Or should I report a bug? I worked around the issue with a manual join, and everything works fine, but it isn't as elegant as it could have been had containable been used. So this isn't a cry for help, merely a question why. 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: Model name issues with Upload Behavior
Thanks for the info... I think I'm going to go with possibly attaching the MeioUpdate behavior in the beforeFilter method of my controllers. It doesn't seem like a very cake way to do it, but if it's the only way... On Oct 23, 8:22 am, Miles J mileswjohn...@gmail.com wrote: You can try my uploader system, it supports multiple uploads. http://www.milesj.me/resources/script/uploader-plugin On Oct 22, 10:25 pm, Dr. Loboto drlob...@gmail.com wrote: This behavior can work with only one model at time. So you need or load only needed model (MotionFile or SeeFile), or attach-detach behavior manually. I think all will be fine if you remove 'MeioUpload' from $actsAs in all models and will attach it just before save: $this- MotionFile-Behaviors-attach('MeioUpload', array('filename')); On Oct 23, 5:01 am, benjam benjamwel...@gmail.com wrote: I'm currently using the MeioUpload Behavior fromhttp://github.com/josegonzalez/MeioUpload/tree/masterinacouple of my models on a project of mine and am running into an issue. When I try to upload a file in one of my models (MotionFile), it says the index cannot be found SeeFile. SeeFile is the name of the other model that is using the Upload behavior, so it seems that when Cake gets into what it does and loads up all the models and behaviors, it loads the MotionFile first (obviously), and runs the setup method for the Upload Behavior, and then later on it loads up the SeeFile model (because it's attached through other models to the MotionFile model), and runs the setup method for the Upload Behavior again, except this time with the SeeFile model data instead of the MotionFile model data that I need, overwriting it, and causing my current issue. Here is the behavior include for my models (same for both). var $actsAs = array( 'MeioUpload' = array('filename'), ); Anybody experienced this before, and is there a workaround? Or am I doing something obviously wrong? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Model name issues with Upload Behavior
I'm currently using the MeioUpload Behavior from http://github.com/josegonzalez/MeioUpload/tree/master in a couple of my models on a project of mine and am running into an issue. When I try to upload a file in one of my models (MotionFile), it says the index cannot be found SeeFile. SeeFile is the name of the other model that is using the Upload behavior, so it seems that when Cake gets into what it does and loads up all the models and behaviors, it loads the MotionFile first (obviously), and runs the setup method for the Upload Behavior, and then later on it loads up the SeeFile model (because it's attached through other models to the MotionFile model), and runs the setup method for the Upload Behavior again, except this time with the SeeFile model data instead of the MotionFile model data that I need, overwriting it, and causing my current issue. Here is the behavior include for my models (same for both). var $actsAs = array( 'MeioUpload' = array('filename'), ); Anybody experienced this before, and is there a workaround? Or am I doing something obviously wrong? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Debug off denies access to login page
I have a site that uses ACL and Auth to control access to the admin portion of the site, as well as one other non-admin page. When I have debug set to 2, I can log in and access the admin fine, and when I'm logged off, it blocks everything as it should. When I turn debugging off, and try to access the admin section, it redirects me to the login page (as it should), but then gives me a 404 on the login page. I don't have any debug specific code anywhere, so I can't seem to put my finger on why this may be happening. And the real kicker is, it only happens when debug is off, so I can't debug it. Any ideas as to why this may be happening? --~--~-~--~~~---~--~~ 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: ACL throwing self-joined model into infinite recursion
Seems to work great. I removed the 'Parent', and 'Child' relationship from Page, and refactored it to use the Tree behavior methods instead. Thanks. On Feb 16, 5:06 pm, benjam benjamwel...@gmail.com wrote: I had thought of that (the Parent Child thing on multiple models) but was hoping that Cake was smart enough to know which was which. Thanks for the info, I'll fiddle with it and post the outcome here... On Feb 16, 12:43 pm, AD7six andydawso...@gmail.com wrote: On Feb 16, 9:21 am,benjambenjamwel...@gmail.com wrote: Here are some (hopefully) relevant code snippits:http://pastebin.com/f7426e0c4 On Feb 16, 8:55 am,benjambenjamwel...@gmail.com wrote: I have just com across a very strange issue with Cake. I have ACL installed in my app, and I havre a self-referencing table in that app as well (Parent-Child). That's nothing to do with ACL and almost definitely because you're using 'Parent' and 'Child' aliases in multiple models to refer to different classes. Why define these relationships at all, they are redundant with the tree behavior. AD --~--~-~--~~~---~--~~ 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: ACL throwing self-joined model into infinite recursion
Here are some (hopefully) relevant code snippits: http://pastebin.com/f7426e0c4 On Feb 16, 8:55 am, benjam benjamwel...@gmail.com wrote: I have just com across a very strange issue with Cake. I have ACL installed in my app, and I havre a self-referencing table in that app as well (Parent-Child). In my app_controller, I pull data for the self-referencing model for every page load (it runs the menu), and it works fine for all the pages that aren't directly related to the ACL. For instance the users model and controller are directly related to the ACL, as is the groups model and controller. The trouble is, when I access a page that is directly related to ACL, for some reason, the pages model (the self-referencing model), gets thrown into an infinite recursion, trying to build the model relationships, and gets stuck trying to go up the tree. Here is an excerpt from my xdebug output when I get the Fatal error: Maximum function nesting level of '100' reached error: AppController-beforeRender( ) ..\controller.php:731 ClassRegistry-init( 'Page', ??? ) ..\app_controller.php:122 Model-__construct( array('class'='Page', alias='Page'), ???, ??? ) ..\class_registry.php:134 Model-__createLinks( ) ..\model.php:417 Model-__constructLinkedModel( 'Parent', 'Page ) ..\model.php:608 ClassRegistry-init( array('class'='Page', alias='Parent'), ??? ) .. \model.php:635 Model-__construct( array('class'='Page', alias='Parent'), ???, ??? ) ..\class_registry.php:134 Model-__createLinks( ) ..\model.php:417 Model-__constructLinkedModel( 'Parent', 'Page' ) ..\model.php:608 -- and it's entered the infinite recursion Has anybody seen this before, and does anybody have any suggestions on how to rectify it? --~--~-~--~~~---~--~~ 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: ACL throwing self-joined model into infinite recursion
I had thought of that (the Parent Child thing on multiple models) but was hoping that Cake was smart enough to know which was which. Thanks for the info, I'll fiddle with it and post the outcome here... On Feb 16, 12:43 pm, AD7six andydawso...@gmail.com wrote: On Feb 16, 9:21 am, benjam benjamwel...@gmail.com wrote: Here are some (hopefully) relevant code snippits:http://pastebin.com/f7426e0c4 On Feb 16, 8:55 am, benjam benjamwel...@gmail.com wrote: I have just com across a very strange issue with Cake. I have ACL installed in my app, and I havre a self-referencing table in that app as well (Parent-Child). That's nothing to do with ACL and almost definitely because you're using 'Parent' and 'Child' aliases in multiple models to refer to different classes. Why define these relationships at all, they are redundant with the tree behavior. AD --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
ACL throwing self-joined model into infinite recursion
I have just com across a very strange issue with Cake. I have ACL installed in my app, and I havre a self-referencing table in that app as well (Parent-Child). In my app_controller, I pull data for the self-referencing model for every page load (it runs the menu), and it works fine for all the pages that aren't directly related to the ACL. For instance the users model and controller are directly related to the ACL, as is the groups model and controller. The trouble is, when I access a page that is directly related to ACL, for some reason, the pages model (the self-referencing model), gets thrown into an infinite recursion, trying to build the model relationships, and gets stuck trying to go up the tree. Here is an excerpt from my xdebug output when I get the Fatal error: Maximum function nesting level of '100' reached error: AppController-beforeRender( ) ..\controller.php:731 ClassRegistry-init( 'Page', ??? ) ..\app_controller.php:122 Model-__construct( array('class'='Page', alias='Page'), ???, ??? ) ..\class_registry.php:134 Model-__createLinks( ) ..\model.php:417 Model-__constructLinkedModel( 'Parent', 'Page )..\model.php:608 ClassRegistry-init( array('class'='Page', alias='Parent'), ??? ) .. \model.php:635 Model-__construct( array('class'='Page', alias='Parent'), ???, ??? )..\class_registry.php:134 Model-__createLinks( ) ..\model.php:417 Model-__constructLinkedModel( 'Parent', 'Page' ) ..\model.php:608 -- and it's entered the infinite recursion Has anybody seen this before, and does anybody have any suggestions on how to rectify it? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Name Display Question
One thing I've noticed that has always kinda bothered me... Why, when baking a view, does Cake get the names for multi-word models correct, except for the one you're on. For instance: I have a table product_categories, and another table product_families which is related. When I bake the view for product_categories, in the header (and various places in the controller), it says ProductCategories (no space), but lower down in the view, in the actions div, it lists the actions for product_families as Product Families (with space). But when I bake the view for product_families, it's the opposite: showing ProductFamilies in the header, and Product Categories in the actions. If cake knows how to split the words, why doesn't it do it consistently? Is this by design? It's not a huge deal, just a bit annoying to have to go through and split the words in all my controllers and views to get a consistent name for my items. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Schema Update fails
Anybody have any suggestions? Or should I just submit a ticket? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: change MIT license to GPL?
On Oct 22, 4:07 pm, Gwoo [EMAIL PROTECTED] wrote: If you think your changes are that great, you should really think again. really? damn, I didn't know that the Cake devs were the only ones who could write decent code. Maybe the Cake devs should hop down off the Cake pedestal and grab a glass of humble. sorry to hijack this one, pepejose, back to topic. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Add comment in the bakery doesn't work
Seconded again. On Sep 30, 2:52 am, dr. Hannibal Lecter [EMAIL PROTECTED] wrote: I second that, doesn't work for me either. On Sep 30, 10:30 am, Kanten [EMAIL PROTECTED] wrote: Hi, I'm afraid there is something wrong with the add comment function in thebakery:http://bakery.cakephp.org/ When trying to add a comment it always comes back with: The comment could not be saved. Please correct the errors below. When looking below at the comment, no errors are listed and in reality, there is no errors. Is there anyone with developer access to thebakery, that can look into this? /Anders --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Can someone with Bakery admin rights help me out?
I apologize in advance for using the group for this, but I can't seem to log into the bakery. I tried resetting my password, I also tried creating a new account, both to no avail. I would like for someone with admin rights to the bakery to get into there and get me my original login data, and possibly delete the second account that I created for me. If this is possible, please contact me via email as I'd rather not discuss account details on the group. Thanks. If this is not possible, could someone point me in the right direction to get in contact with a Bakery admin? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Is there any good way to make url difficult to guess
You should probably take a look at why you want to keep people from viewing certain URLs. If it's from a security standpoint, you should probably have some server side scripting that blocks the URL, not just a If there's no link, then I hope they can't guess my URL security system. And if you are trying to block content, this falls under a similar idea. Give users levels (or some other flag that shows they are allowed to access that particular data, or image, or whatnot), and if they don't have the right level, block the content server-side. You should never trust a fancy URL to block content from users. And then you can use the solutions given by others to further increase your security. On Aug 25, 9:24 pm, Jerry [EMAIL PROTECTED] wrote: Hi: is there any way to make application url difficult to guess? since cake reads record by id, it also provides a way for user to guess the record to retrieve. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Fatal error while baking
Right, which I did, and it fixed the problem, but the main WTF was that the errors spit out by cake bake gave no inclination of the issues I was really having. Not until I really dug into the errors and the problem did I realize that I had created a class called File (which seemed perfectly fine to me at the time, still does), which may be conflicting with other classes. Is there someplace that has a list of table names you shouldn't (read: can't) use? I couldn't find one, so for future reference: Reserved Table Names: acl_bases acl_behaviors acl_components acl_nodes acl_shells aco_actions acos ajax_helpers apc_engines api_shells app_controllers app_helpers app_models apps aros auth_components bake_shells behavior_collections cache_engines cache_helpers caches cake_error_controllers cake_logs cake_schemas cake_sessions cake_sockets class_registries components configures connection_managers console_shells containable_behaviors controller_tasks controllers cookie_components data_sources db_acl_schemas db_acls db_config_tasks dbo_adodbs dbo_db2s dbo_firebirds dbo_mssqls dbo_mysqlis dbo_mysqls dbo_odbcs dbo_oracles dbo_postgreses dbo_sources dbo_sqlites dbo_sybases debuggers dispatchers email_components error_handlers extract_tasks file_engines files flays folders form_helpers helpers html_helpers http_sockets i18n_schemas i18n_shells i18ns inflectors ini_acls javascript_helpers js_helper_objects js_helpers l10ns magic_dbs magic_file_resources media_views memcache_engines model_behaviors model_tasks models multibytes number_helpers objects overloadable2s overloadables pages_controllers paginator_helpers permissions plugin_tasks project_tasks request_handler_components routers rss_helpers sanitizes scaffold_views scaffolds schema_shells security_components securities session_components session_helpers sessions_schemas sets shell_dispatchers shells strings test_suite_shells test_tasks text_helpers theme_views time_helpers translate_behaviors tree_behaviors validations view_tasks views xcache_engines xml_elements xml_helpers xml_managers xml_nodes xml_text_nodes xmls and possibly more... On Jul 9, 4:57 pm, Jonathan Snook [EMAIL PROTECTED] wrote: That's not really a WTF. It's a case of there bing a File class already. So trying to bake a model of the same name is going to give you problems. I'd choose a different name. -Jonathan On 7/9/08, benjam [EMAIL PROTECTED] wrote: Apparently the problem was that I had a table called 'files', which isn't allowed. WTF? On Jul 9, 10:05 am, benjam [EMAIL PROTECTED] wrote: While trying to bake a view I received the following error: Fatal error: Call to undefined method File::schema() in \cake\cake \console\libs\tasks\view.php on line 383 Any suggestions? I was also receiving several notices and warnings when baking my controllers, if this has anything to do with it. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Fatal error while baking
While trying to bake a view I received the following error: Fatal error: Call to undefined method File::schema() in \cake\cake \console\libs\tasks\view.php on line 383 Any suggestions? I was also receiving several notices and warnings when baking my controllers, if this has anything to do with it. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Fatal error while baking
Apparently the problem was that I had a table called 'files', which isn't allowed. WTF? On Jul 9, 10:05 am, benjam [EMAIL PROTECTED] wrote: While trying to bake a view I received the following error: Fatal error: Call to undefined method File::schema() in \cake\cake \console\libs\tasks\view.php on line 383 Any suggestions? I was also receiving several notices and warnings when baking my controllers, if this has anything to do with it. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Custom route question
I have a question about a custom route and was wondering if it's possible, and if it is, how? I have some controllers for a game match site named the following: foos_teams foos_matches chess_matches ping_teams ping_matches catan_matches and I would like to be able to access them by going to the following (respectively): /foos/teams /foos/matches /chess/matches /ping/teams /ping/matches /catan/matches How might I do this? And I don't want to hard code each of them, I could, but I'd like to know if there is a better way that will work for new games and pages as soon as they are added without any further route building. Thanks, I know it's a tricky one. My not even be possible, but any help you could give me is appreciated. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Custom Model Association Problems
I have the following tables with the following fields territories - id zip_start zip_end offices - id zipcode and I want to associate via hasMany and belongsTo on the following conditions (territories hasMany offices) and (offices belongsTo territories): offices.zipcode BETWEEN territories.zip_start AND territories.zip_end How can I do this in Cake? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Keep current password
I have an admin section to my site, which is protected by Auth and using a Users table. The trouble I'm having is, when I set up a user, everything works just fine. When I go in to edit that user, the password field gets corrupted because instead of re-hashing the original password (which would be impossible because it doesn't know it, unless it is specifically re- entered in the password field), it hashes the hash that is output by the form (the one stored in the database). I was wondering if there was a way to prevent it from hashing the password if there is no password entered? Here is what I have so far... in my model: (not complete) var $validate = array( 'username' = array('alphaNumeric'), 'email' = array('email'), 'password' = VALID_NOT_EMPTY, ); in my controller: (not complete) function admin_edit($id = null) { if (!$id empty($this-data)) { $this-Session-setFlash(__('Invalid User', true)); $this-redirect(array('action'='index')); } if (!empty($this-data)) { if (empty($this-data['User']['password'])) { unset($this-data['User']['password']); } if ($this-User-save($this-data)) { $this-Session-setFlash(__('The User has been saved', true)); $this-redirect(array('action'='index')); } else { $this-Session-setFlash(__('The User could not be saved. Please, try again.', true)); } } if (empty($this-data)) { $this-data = $this-User-read(null, $id); } } in my view: (not complete) ?php echo $form-input('username'); echo $form-input('email'); echo 'span class=infoLeave Password field blank to keep current password/span'; echo $form-input('password', array('value' = '')); echo $form-input('contact'); echo $form-input('active'); ? When I debug output $this-data right after I clear out an empty password field in the controller, it shows a hash in the password field, which means the data gets hashed before it gets to the controller admin_edit method. Where should I put the condition to clear out the password field if it's empty so that I can keep the current password if none is entered in the edit form? And how can I make sure that when adding a user, a password is required, but when editing a user, it is not? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Keep current password
If you'll notice in my controller method, that's exactly what I do, but because it's already hashed, it's not empty, it's a hash of an empty string. I need to find a way to delete it before it gets hashed. And it gets hashed before the data gets to the method. So I need to find a way to delete it even before that. On Jun 6, 2:38 pm, Chris Hartjes [EMAIL PROTECTED] wrote: On Fri, Jun 6, 2008 at 4:33 PM, benjam [EMAIL PROTECTED] wrote: I was wondering if there was a way to prevent it from hashing the password if there is no password entered? Well, before you save the data when you're editing, you could unset the password field. i.e. unset($this-data['User']['password'] Totally untested. Hope that helps. -- Chris Hartjes Internet Loudmouth Motto for 2008: Moving from herding elephants to handling snakes... @TheKeyBoard:http://www.littlehart.net/atthekeyboard --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Keep current password
I don't think beforeSave would work, because it gets hashed even before the method that calls Save( ). I think I may have found a cheater (read: non-cake) way of doing it... I run the following test: if ($this-Auth-password('') == $this-data['User']['password']) { unset($this-data['User']['password']); } Basically, if the hash matches the hash of an empty string, the password was empty... clear it. done. thanks for all the input though guys, I appreciate it. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Limiting Routes to specific Controllers
I'm having troubles getting this working the way I want it to. I am using the prefix method (although I also tried the array method with equally false results) an I have my router set up like this: $params = array( 'prefix' = 'training' , 'controller' = 'lessons' , 'action' = 'index' , 'training' = true , ); Router::connect('/training', $params); Router::connect('/training/:controller', $params); Router::connect('/training/:controller/:action/*', $params); With the 'training' = true section commented out, all the links on the site get the /training section added to the URL, which is wrong. With that section not commented out (as above), none of the cake generated links get the /training portion of the URL, which is also wrong. I want it to behave exactly like /admin, where, if I am currently in the /admin portion of the site, all cake generated links get /admin added to the URL. And if I am not in /admin, the links behave normally. As it is right now with /training, it's either one way or the other, not the way it's supposed to be. Is there something I'm doing wrong? I also have my views and methods in my controllers set up properly (with the training_ prefix added to views and methods). --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Limiting Routes to specific Controllers
I found a workaround... by adding 'training' = true to all my cake links parameter arrays, it works. e.g- ?php echo $html-link($lesson['title'], array('controller' = 'lessons', 'action' = 'view', $lesson['id'])); ? -- doesn't work, but should ?php echo $html-link($lesson['title'], array('training' = true, 'controller' = 'lessons', 'action' = 'view', $lesson['id'])); ? -- works, but is not 'cake way' --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Limiting Routes to specific Controllers
But I'd still like to know the proper cake way of getting it to work. Thanks, and sorry for the multiple posts. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Limiting Routes to specific Controllers
Both of those options seem like they would work perfectly. I think I will implement the array version for my needs right now, and look at the prefixing as a cleaner, more 'Cake' way in the future (I'm on a deadline right now, and need something quick). Thanks to you both. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Limiting Routes to specific Controllers
I'm having a menu problem, I have a section of my site which 'wraps' several controllers and models, therefore, while doing things in this section, the menu I have created with $menu-menu breaks (the current menu tab highlighting is incorrect) because my URL keeps changing, although I am in the same 'section' of the site. I figured I could fix this with routes and and have a route set up as the following... (/training is the topmost dir for the section) Router::connect('/training/:controller/:action/*', array('controller' = 'lessons', 'action' = 'index')); which basically clones the entire site at /training/* This is fine for the moment, because using the menu will take people back out of the /training dir. But my question is this... How (if it's possible), can I limit the controllers allowed to go through the /training dir? I only have four controllers that I want to have access to the /training dir, all other requests should show an error, or better yet, redirect to the proper controller directory. As it stands, I can enter the /training section by simply typing / training/some_other_non_training_controller, which is not bad, but it would break the menu the other way, instead of always losing focus on the 'Training' tab, it would always show focus on the 'Training' tab. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Renamed Controller Issues
I have a section of my site called 'Ask Vinny' and I would like the URL to look something like mysite.com/vinny (not mysite.com/vinnies) so I renamed the controller and moved the views into the vinny/ dir, and it works fine, except that when submitting the 'ask question' form ( @ vinny/ask), it tries to submit to vinnies/add instead of vinny/ ask. I fixed the ask part by setting 'action' = 'ask' in the $form-create options array, but when I tried to set the controller, it still goes to vinnies/ask, and not vinny/ask. I finally got it working by setting 'url' = $form-here in the options, but I don't want to have to do this for every form I create. Is there a way to set something in the controller (or anywhere, the model maybe?) that tells it not to pluralize the controller name when going to dynamically created URLs? Or a way to set the controller (or model) up so that it knows to go to vinny/ and not vinnies/? Thanks. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Renamed Controller Issues
That's a big help, but not enough to fix the issue. In fact just the opposite. I'm not trying to adjust the controller to the URL, I'm trying to adjust the URL in the controller. The issue I'm having is when I tell Cake that I want to use the 'Vinny' Controller, it runs off and grabs VinnyController, but then tries to forward that to /vinnies/ instead of /vinny/. For instance, when I create a form using $form-create('Vinny'); in the form, as the action attribute of the tag, it has /vinnies/add. The URL I am using is /vinny/ask. Now I can fix the /add part by adding array('action' = 'ask') to the create from method, but it is still setting /vinnies/ask as the action, which is close, but not quite right. And now I have found out that $form-here does not work for instances where the main site script is not in the root directory of the server. Thanks for the info though. On May 15, 10:23 am, Joel Perras [EMAIL PROTECTED] wrote: http://book.cakephp.org/view/39/configuration#routes-configuration-46 -Joel. On May 15, 11:18 am, benjam [EMAIL PROTECTED] wrote: I have a section of my site called 'Ask Vinny' and I would like the URL to look something like mysite.com/vinny (not mysite.com/vinnies) so I renamed the controller and moved the views into the vinny/ dir, and it works fine, except that when submitting the 'ask question' form ( @ vinny/ask), it tries to submit to vinnies/add instead of vinny/ ask. I fixed the ask part by setting 'action' = 'ask' in the $form-create options array, but when I tried to set the controller, it still goes to vinnies/ask, and not vinny/ask. I finally got it working by setting 'url' = $form-here in the options, but I don't want to have to do this for every form I create. Is there a way to set something in the controller (or anywhere, the model maybe?) that tells it not to pluralize the controller name when going to dynamically created URLs? Or a way to set the controller (or model) up so that it knows to go to vinny/ and not vinnies/? Thanks. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Renamed Controller Issues
Yeah, I tried all of those, and none of them were working for me, but I noticed further down on the page in the link that was supplied by Joel that there was a section called Custom Inflections, and so I edited /config/inflections and added 'vinny' to the $uninflectedPlural var. It works now, and thanks for everybody's help. On May 15, 2:06 pm, Jonathan Snook [EMAIL PROTECTED] wrote: On Thu, May 15, 2008 at 4:00 PM, benjam [EMAIL PROTECTED] wrote: That's a big help, but not enough to fix the issue. In fact just the opposite. I'm not trying to adjust the controller to the URL, I'm trying to adjust the URL in the controller. The issue I'm having is when I tell Cake that I want to use the 'Vinny' Controller, it runs off and grabs VinnyController, but then tries to forward that to /vinnies/ instead of /vinny/. For instance, when I create a form using $form-create('Vinny'); in the form, as the action attribute of the tag, it has /vinnies/add. The URL I am using is /vinny/ask. Try this (if you haven't already): * Call your controller VinniesController. * set up a route: Router::connect('/vinny/ask', array('controller'='vinnies', 'action'='add')); With any luck, the reverse routing lookup will automatically fix your URL. If it doesn't, the following addition should work: * $form-create('Vinny', array('controller'='vinnies', 'action'='add')); again, it should pick up the association and you'll be off to the races. Alternatively, set up a VinnyController and manually do array('controller'='vinny', 'action'='ask'). --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Including a menu on some pages but not all
I apologize if this has been asked before, I looked but did not find the answer I was looking for. I know how to include a file in PHP, and here is what I am looking to do: in view.ctp: - ?php include 'menu.php'; ? pOther view content here/p - What is the cake way of doing something like this? Where menu.php holds the top level menu? And I know I can put nav in default.ctp, but I only want it shown on a few select pages (all within the same controller scope). --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Including a menu on some pages but not all
Exactly what I was looking for. Thanks. On May 14, 11:56 am, Kyle Decot [EMAIL PROTECTED] wrote: create a file called menu.ctp in your views/elements folder. then you can include the menu by using: echo $this-renderElement(menu); --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: OT: Shitty Community
The main reason for the post was not trolling, but to merely open some eyes to the state of the group. It seems it worked, and I'm glad to see that there are a lot of people here who care about the community. I will be around for quite a while, asking questions (some probably pretty stupid ones), and offering help where I can. Thanks. thread closed --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
OT: Shitty Community
Seriously, why does everybody in the CakePHP community got their finger on the trigger to just rip any person that has a question a new one? I mean, I have seen some pretty stupid questions in my time, and the ones here are nowhere near as bad as the ones that I've seen elsewhere. The thing that makes it different here, is that as soon as those 'stupid' questions come in, the person asking the question gets treated like shit for 5-10 posts until their question is answered (if at all). So what if you created CakePHP, so what if you've used it for the entirety of it's life, some people haven't, and those people have perfectly valid questions for the simple fact that the documentation for CakePHP is horrendous and any documentation that is out there, is spread so thin on the internet that looking for an answer is like trying to find the proverbial needle. I've seen people get called names (seriously, are we in 4th grade?), been told to look things up themselves, been harped on to no end, and all without the courtesy of a decent answer. I feel that if someone comes to the group with a question, EVEN IF IT'S BEEN ASKED BEFORE, it deserves an answer, or at least a _polite_ point in the direction of the answer (in the form of a link to the post, or the page with the answer, NOT a begrudged 'Google It, dumbass'). If you can't answer the question in a polite and decent manner, don't answer the question. Let somebody else who has far better people skills answer it. That way, the person asking the question will feel like they are important to the community. Because nothing kills a project faster than a shitty community, no matter what the project is. So get your head out of your 'Holier than thou' asses and lighten up. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: OT: Shitty Community
How is calling the documentation horrendous polite? You have any idea the amount of hours people take to write that, not to mention that is a community effort? I tell you, with the likes of you, I don't doubt anyone would call you names, disrespecting other's people valuable time like that. My apologies, I should have been more clear. The documentation that is there is very good, but there are holes in the documentation where pieces are missing. So the _lack_ of documentation is bad, not the documentation itself, and I truly am very grateful to the people who spend their time helping others out by writing documentation. If I knew anything about it, I would write some myself, but I've only been working with Cake for about a week now. So...to sum up 1) there are no stupid questions, only stupid answers 2) every question, no matter how poorly researched or thought out, deserves a civilized answer 3) people asking questions have no responsibility, only those giving answers . I actually do agree with 1 and 2, but I never said anything about 3. I feel that people should do some research before posting (to at least know the question they are trying to ask), but I also feel that posting is part of the research. But the people asking questions _do_ have responsibility. (If I'm reading your sarcasm correctly) And a 110% ditto to everything John David Anderson said, although he put it much better than I did. And to be clear, I think that CakePHP is an amazing piece of code (I wouldn't be here if I didn't). And this post has nothing to do with the actual code. So if you are a developer, please don't feel like I am attacking you or your code, because I'm not. And I admit, I am new to this community, so I may not have a broad enough picture to make generalized statements like this, but of the posts I've read, most (if not all) of them turned into bashing sessions. And there are people in this community who have a reputation for being quite rude, and that is just not right. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Hierarchical Tree Setup
Thanks for the reply, for some reason when I tried the 'empty' option it didn't work, hence my question here. And thanks for the beforeSave() hint. On May 7, 8:44 pm, Adam Royle [EMAIL PROTECTED] wrote: I can't help you with the scaffolding - never used it, but it's certainly possible to do what you want. 1) Do this in your view. echo $form-input('Product.parent_id', array('options' = $categories, 'empty' = '-- Top Level --')); You might need this in your model... function beforeSave(){ if (isset($this-data[$this-alias]['parent_id']) empty($this-data[$this-alias]['parent_id'])){ $this-data[$this-alias]['parent_id'] = null; } return true; } 2) The Tree behaviour has generatetreelist() however it display likes this: Parent 1 _Child 1-1 _Child 1-2 Parent 2 _Child 2-1 _Child 2-2 __Subchild 2-2-1 I think you would need to create your own method to generate the data in the format you wish. Cheers, Adam On May 8, 4:32 am, benjam [EMAIL PROTECTED] wrote: I have a location table with the following fields: --- id name location_id -- this is a parent location id --- I have a couple of questions about getting this to work the way I want it to using scaffolding. 1- How can I set it up so the location_id select box on the form has a default value of 0 - 'Top Level' without putting a 'Top Level' entry in the table? 2- How can I get the select box to output in the following format? -- Top Level -- Parent 1 Parent 1 :: Child 1-1 Parent 1 :: Child 1-2 Parent 2 Parent 2 :: Child 2-1 Parent 2 :: Child 2-2 Parent 2 :: Child 2-2 :: Subchild 2-2-1 etc. where the tree is built in the order of the ids of the parents, then the order of the idds of the children. I can do this manually, but I'd like to know a 'Cake' way of doing it. And if I must do this manually, how do I get it to play nice with the $form-input method? If I need to at all? Thanks for your help. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: OT: Shitty Community
I do find it interesting to compare Cake responses with, say, the JQuery group- where someone titles their post it's not working and still get loads of polite and helpful responses! Maybe I've just been around the jQuery group too long... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: OT: Shitty Community
I think this guy is just looking for 5 minutes of fame and fortune :P yes please. everybody who has posted a response please send me $5. mbavio gets to send me $10. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Hierarchical Tree Setup
I have a location table with the following fields: --- id name location_id -- this is a parent location id --- I have a couple of questions about getting this to work the way I want it to using scaffolding. 1- How can I set it up so the location_id select box on the form has a default value of 0 - 'Top Level' without putting a 'Top Level' entry in the table? 2- How can I get the select box to output in the following format? -- Top Level -- Parent 1 Parent 1 :: Child 1-1 Parent 1 :: Child 1-2 Parent 2 Parent 2 :: Child 2-1 Parent 2 :: Child 2-2 Parent 2 :: Child 2-2 :: Subchild 2-2-1 etc. where the tree is built in the order of the ids of the parents, then the order of the idds of the children. I can do this manually, but I'd like to know a 'Cake' way of doing it. And if I must do this manually, how do I get it to play nice with the $form-input method? If I need to at all? Thanks for your help. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: SQL error when adding item using the scaffolding
Because it is still an issue, and has not been fixed yet. On May 5, 2:59 pm, AD7six [EMAIL PROTECTED] wrote: benjam wrote: My thinking is that it's a cake problem. Why are you resurrecting this old thread. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: SQL error when adding item using the scaffolding
My thinking is that it's a cake problem. If there is a way of doing things (INSERT NULL) that works everywhere, regardless of server settings, and a way of doing things (INSERT '') that works _almost_ everywhere, then you should use the way of doing things that works everywhere. If you don't, you run the risk of stuff not working on some machines and encountering the situation we have here. And nate, I understand that you're busy, but you don't have to be an ass about it. If I knew where to fix it, I would make a patch, but I've only been working with cake for a week now. You (or somebody you know) probably knows exactly where to go to fix it, and could do it in less than 5 minutes, but you would rather write a post that takes you more than 5 minutes to write to bitch out your users. Nice Job. p.s.- thanks to Ben and asturges for the temporary fix until this gets remedied for good on cake's side. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---