Re: General Questions.
Thanks for the response, i may be miss understanding what your saying here but, the other lang i am working with has XML-RPC but it is a failed implantation and unreliable so im going to be using straight http post data to achieve what i need after all im communicating from a scripting language inside of a video game :P there are some heavy limitations on what i can do, But now the Json suggestion sonds intriguing ive never worked with json so i guess its time to look up some tutorials on it. On Mon, Aug 16, 2010 at 8:39 PM, Hugo M wrote: > Hi Neocrypter! It's easy! You can use JSON or XML to comunicate with > your app. You don't need a special class, you can just take post data > from any action in any controller. Example: > > In your controller: > > var $helpers = array('Xml'); > > function recieve_post() { > //Saving external data > $this->MyModel->save($this->data); > $this->set('response', 'ok'); > } > > In your view: > > $xml->serialize($response, array('format'=>'tags', 'root'=>'root_node'); > > or > > json_encode($response) > > If you want to count your data, in json's case you can do a string > length > 1024 (if your encoding takes 2 bytes per char), the same with > the result of xml serialize. > > And that's all. You probably will need to validate user session and > other things but... well that's another price (?) :P > > 2010/8/16 Neocrypter : > > Hello all I just discovered Cake last night and after playing with it > > for a few moments I must say im impressed, I personally have never > > truly worked with an MVC patten before and its been many years since > > ive done any php work (around PHP 3) But I have taken up the mantel > > of a developer again to help one of my associates with a project. I > > ran through both the tutorials that are in the manual last night and > > was amazed at how fast things were up and running, But before i dive > > head first into my app I need to write i have a couple question, > > > > How hard is it to rig up a class to recive data from external > > sources. I am writing an app in Second Life, which will send post data > > to the website to stick in the db. I was looking at doing that with > > Codeignighter but after working with it for a week and still not > > having a simple CRUD app set up and working the way i think it should > > ive decided to look around at other frameworks. > > > > also is there any functions to count the amount of data that cake will > > send out in one chunk, im also going to be sending data back from the > > site to the application in Second Life but there is a limit to the > > amount of data that can be recived in one post 2kb to be exact.( im > > well aware that there is probaly nothing to keep track of such a thing > > built in but never hurts to ask ) > > > > Thanks > > Neocrypter > > > > 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.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.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: General Questions.
Hi Neocrypter! It's easy! You can use JSON or XML to comunicate with your app. You don't need a special class, you can just take post data from any action in any controller. Example: In your controller: var $helpers = array('Xml'); function recieve_post() { //Saving external data $this->MyModel->save($this->data); $this->set('response', 'ok'); } In your view: $xml->serialize($response, array('format'=>'tags', 'root'=>'root_node'); or json_encode($response) If you want to count your data, in json's case you can do a string length > 1024 (if your encoding takes 2 bytes per char), the same with the result of xml serialize. And that's all. You probably will need to validate user session and other things but... well that's another price (?) :P 2010/8/16 Neocrypter : > Hello all I just discovered Cake last night and after playing with it > for a few moments I must say im impressed, I personally have never > truly worked with an MVC patten before and its been many years since > ive done any php work (around PHP 3) But I have taken up the mantel > of a developer again to help one of my associates with a project. I > ran through both the tutorials that are in the manual last night and > was amazed at how fast things were up and running, But before i dive > head first into my app I need to write i have a couple question, > > How hard is it to rig up a class to recive data from external > sources. I am writing an app in Second Life, which will send post data > to the website to stick in the db. I was looking at doing that with > Codeignighter but after working with it for a week and still not > having a simple CRUD app set up and working the way i think it should > ive decided to look around at other frameworks. > > also is there any functions to count the amount of data that cake will > send out in one chunk, im also going to be sending data back from the > site to the application in Second Life but there is a limit to the > amount of data that can be recived in one post 2kb to be exact.( im > well aware that there is probaly nothing to keep track of such a thing > built in but never hurts to ask ) > > Thanks > Neocrypter > > 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
General Questions.
Hello all I just discovered Cake last night and after playing with it for a few moments I must say im impressed, I personally have never truly worked with an MVC patten before and its been many years since ive done any php work (around PHP 3) But I have taken up the mantel of a developer again to help one of my associates with a project. I ran through both the tutorials that are in the manual last night and was amazed at how fast things were up and running, But before i dive head first into my app I need to write i have a couple question, How hard is it to rig up a class to recive data from external sources. I am writing an app in Second Life, which will send post data to the website to stick in the db. I was looking at doing that with Codeignighter but after working with it for a week and still not having a simple CRUD app set up and working the way i think it should ive decided to look around at other frameworks. also is there any functions to count the amount of data that cake will send out in one chunk, im also going to be sending data back from the site to the application in Second Life but there is a limit to the amount of data that can be recived in one post 2kb to be exact.( im well aware that there is probaly nothing to keep track of such a thing built in but never hurts to ask ) Thanks Neocrypter 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: Migrating to Cake and Few General Questions
On Sep 12, 2006, at 1:35 PM, Tony wrote: > > Okay I just thought of something John. If I'm doing a $hasMany in the > Level model will I also need to do a $belongsTo in the Role model? Yeah, if you want to see Level data from a Role model perspective. > Would I do the same thing and just use > > class Roles extends AppModel > { > > var $name = 'Roles'; > var $belongsTo = array('Level' => array('className' => 'Level', > > 'condition' > => '', > 'order' >=> '', > > 'foreignKey'=> 'role1_id' > ), > 'Level2' => array > ('className' => > 'Level', > > 'condition' > => '', > 'order' >=> '', > > 'foreignKey'=> 'role2_id' > ) > ); > } > > > Am I close here? Yeah - does it work? That's the best way to try. ;o) -- John --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Migrating to Cake and Few General Questions
Okay I just thought of something John. If I'm doing a $hasMany in the Level model will I also need to do a $belongsTo in the Role model? Would I do the same thing and just use class Roles extends AppModel { var $name = 'Roles'; var $belongsTo = array('Level' => array('className' => 'Level', 'condition' => '', 'order' => '', 'foreignKey'=> 'role1_id' ), 'Level2' => array('className' => 'Level', 'condition' => '', 'order' => '', 'foreignKey'=> 'role2_id' ) ); } Am I close here? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Migrating to Cake and Few General Questions
DOH! Typo with the same key names. Okay that makes perfect sense. Dang now I'm really seeing how CakePHP can totally help me out here. And yes that REALLY helps out here. It's so sad I had to leave my office to chat on IRC because our IT department won't let me have access to an IRC channel, have a localhost, or anything along those lines. Sometimes I'm surprised how I get anything done around here. LOL HA HA HA! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Migrating to Cake and Few General Questions
On Sep 12, 2006, at 11:40 AM, Tony wrote: > > John and AD7six, > > Did I do this correctly? > > class Level extends AppModel > { >var $name = "Level"; >var $hasMany = array('Role1' => > array('className' => 'Role', >'conditions' => '', >'order' => '', >'limit' => '', >'foreignKey' => 'role1_id', >'dependent' => false, >'exclusive' => false >'finderSql' => '' > ), > 'Role2' => > array('className' => 'Role', >'conditions' => '', >'order' => '', >'limit' => '', >'foreignKey' => 'role1_id', >'dependent' => false, >'exclusive' => false >'finderSql' => '' > ) >); > } You have both the keys named the same (role1_id and role1_id), but otherwise it looks okay. > I hope that's right LOL! If I have this correct how would I pull in > the > data. Would I do something like $this->Level->read(null, '44'); To get recursive model data, use find(), not read(), but yeah–that's the basic idea. > Then how would I access the titles field in the roles database when > I'm > outputting into the view. First, assign your Level data to the view: $this->set('level', $this->Level->findById(44)); And in the view, you should have access to role data: > You guys are helping me out so much I totally appreciate all the help. Hope that works for you. -- John --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Migrating to Cake and Few General Questions
John and AD7six, Did I do this correctly? class Level extends AppModel { var $name = "Level"; var $hasMany = array('Role1' => array('className' => 'Role', 'conditions' => '', 'order' => '', 'limit' => '', 'foreignKey' => 'role1_id', 'dependent' => false, 'exclusive' => false 'finderSql' => '' ), 'Role2' => array('className' => 'Role', 'conditions' => '', 'order' => '', 'limit' => '', 'foreignKey' => 'role1_id', 'dependent' => false, 'exclusive' => false 'finderSql' => '' ) ); } I hope that's right LOL! If I have this correct how would I pull in the data. Would I do something like $this->Level->read(null, '44'); Then how would I access the titles field in the roles database when I'm outputting into the view. You guys are helping me out so much I totally appreciate all the help. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Migrating to Cake and Few General Questions
On Sep 12, 2006, at 10:00 AM, Tony wrote: > > So I was on the right track with the URL params. I totally agree with > you that cake makes things a lot easier. I read through pretty much > the > entire CakePHP manual, including the models chapter. > > Let me refocus my question. If I have those two role fields that > aren't > named according to convention, how do I override the default. You specify the name of the foreign key in the association array. This is required if you have two ways to associate to a single table anyway. var $hasMany = array( 'UserComment' => array('className' => 'Comment', 'conditions' => 'Comment.type = 1', 'order' => 'Comment.created DESC', 'limit' => '5', 'foreignKey' => 'user_id', 'dependent' => true, 'exclusive' => false, 'finderSql' => '' ), 'AdminComment' => array('className' => 'Comment', 'conditions' => 'Comment.type = 2', 'order' => 'Comment.created DESC', 'limit' => '5', 'foreignKey' => 'admin_id', 'dependent' => true, 'exclusive' => false, 'finderSql' => '' ) ); > The manual is good and all but it's just so unclear on things. It just > gives a really really high level view but nothing very well or > detailed > in the documentation. That's why I'm here at the google group. This is a good place to get specific help, but the place to suggest changes in the manual is Trac. ;o) -- John --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Migrating to Cake and Few General Questions
So I was on the right track with the URL params. I totally agree with you that cake makes things a lot easier. I read through pretty much the entire CakePHP manual, including the models chapter. Let me refocus my question. If I have those two role fields that aren't named according to convention, how do I override the default. I read in the manual that you can do it to one field but can I do it to more than one field and also how do I do that? The manual is good and all but it's just so unclear on things. It just gives a really really high level view but nothing very well or detailed in the documentation. That's why I'm here at the google group. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Migrating to Cake and Few General Questions
Hi Tony, Tony wrote: > S...no one has been able to answer my question Everything you need to answer that question yourself is at your fingertips ;) I.e. the (link I already posted to the) manaul and the api. You may have seen from the manual that if you use normal url parameters you can access them like this: function Method ($param1,$param2) { // Equivalent but unnecessary code //$param1 = $this->params['pass'][0]; //$param2 = $this->params['pass'][1]; } Cake makes a lot of things easier, it would be a shame to ignore such niceties and write longer code that achieves the same thing ;). HTH, AD7six --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Migrating to Cake and Few General Questions
S...no one has been able to answer my question about the roles, having two fields (role1_id and role2_id) that relate to the roles table. I guess what I'm trying to ask is how do you over ride scaffolding in this situation. Is there documentation that shows me what I need to do? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Migrating to Cake and Few General Questions
nate, that helps a lot. Based on the url you gave me http://site.com/posts/list/5/9 you're saying that it would be in an array(5, 9) and that to get that I would do something like $this->params['pass'][0] to get 5 and $this->params['pass'][1] to get 9? If that's correct then that's pretty easy. I sorta had an idea that it would be something like that but wasn't quite sure. OKAY... so now back to my first question about the migration how do I deal with two foreign keys that relate to the same table for the roles. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Migrating to Cake and Few General Questions
Hey Tony. Yeah, your IRC issue sounds like an anal IT thing. Here's a quick rundown of grabbing _GET and _POST data. Pretty much anything GET or POST-related that you could want to know will be in $this->params. In fact, doing an array-dump of that should give you a pretty good lay of the land. However, not all of it will always be relevant, and some of it will seem downright redundant, so here's what you should know: $this->params['url'] is an array containing any information passed in the URL, including the URL itself, as well as any file extension mappings (http://cake.insertdesignhere.com/posts/view/2). $this->params['form'] contains any _POST data, but that's not used so much, since any form fields generated by Cake helpers will have their data socked away in a special POST variable which maps to $this->data (a copy of which can also be found in $this->params['data']). A couple other things that might be of interest for getting URL variables is $this->params['pass'] and $this->passedArgs. If memory serves, both contain the same data, which is anything in the URL that comes after the /controller/action part. So for example if I go to http://site.com/posts/list/5/9, $this->passedArgs would look like: array(5, 9). Anyway, hope that gets you started. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Migrating to Cake and Few General Questions
i think you can use something like $this->params[pass] or $this->params[url] set define('DEBUG', 3); in your config/core.php and you can see them printed out when you run the script. Tony wrote: > Yes my IT department is COMPLETELY anal. It's so bad I can't even have > a localhost. And yes I meant to say "down" and not "done". LOL! > > I'm getting this error: > Connection to irc://irc.freenode.org reset. Reconnecting in 30 seconds. > > Would that be an IT being anal thing. > > Ha ha ha... I dont' think I'm getting the clear pictures of how to grab > the values from a url. I know in traditional PHP I can do something > like this $_GET['myUrlParam'] or $_POST['formItem'] > > So how do I do that? Is it $this->data['myUrlParam']? That's what I'm > trying to figure out. > > - Tony > > > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Migrating to Cake and Few General Questions
$this->here also seems to hold the info as well. Tony wrote: > Yes my IT department is COMPLETELY anal. It's so bad I can't even have > a localhost. And yes I meant to say "down" and not "done". LOL! > > I'm getting this error: > Connection to irc://irc.freenode.org reset. Reconnecting in 30 seconds. > > Would that be an IT being anal thing. > > Ha ha ha... I dont' think I'm getting the clear pictures of how to grab > the values from a url. I know in traditional PHP I can do something > like this $_GET['myUrlParam'] or $_POST['formItem'] > > So how do I do that? Is it $this->data['myUrlParam']? That's what I'm > trying to figure out. > > - Tony > > > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Migrating to Cake and Few General Questions
Yes my IT department is COMPLETELY anal. It's so bad I can't even have a localhost. And yes I meant to say "down" and not "done". LOL! I'm getting this error: Connection to irc://irc.freenode.org reset. Reconnecting in 30 seconds. Would that be an IT being anal thing. Ha ha ha... I dont' think I'm getting the clear pictures of how to grab the values from a url. I know in traditional PHP I can do something like this $_GET['myUrlParam'] or $_POST['formItem'] So how do I do that? Is it $this->data['myUrlParam']? That's what I'm trying to figure out. - Tony --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Migrating to Cake and Few General Questions
I assume you mean "down" not "done," and no, it shouldn't be. You're IT people don't happen to be anal about firewall security do they? Because that could cause an issue, although the Java IRC client at http://irc.cakephp.org/ should still allow you to get in. One additional note on URLs: as of Cake 1.2, you can now create routes that use complex regular expression matches, as in the following: Router::connect( "/calendar/:year/:month/:day", array("controller" => "calendar", "action" => "index"), array( "year" => "(19|20)\d\d", "month" => "(0[1-9]|1[012])", "day" => "(0[1-9]|[12][0-9]|3[01])" ) ); This allows you to map complex URL matching expressions to named parameters which are passed to controller actions. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Migrating to Cake and Few General Questions
I was just using Chatzilla and then I tried the cakephp irc page and both disconnected me to the server. It's been such a freaking long time since I have used IRC that I'm totally rusty here. Is the server done? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Migrating to Cake and Few General Questions
On OSX, check out Colloquy (http://colloquy.info/) - works well, free. On Windows, I'm using HydraIRC (http://www.hydrairc.com/) - works, free, not as pretty as colloquy, but I have yet to find a single Windows app that comes close in elegance to even a crappy OSX app... sigh.. I miss my Mac! The IRC information is right on the cakephp front page - just join the irc.freenode.net server, and join the #cakephp channel. Regards! -Tobias (bigclown) parent Tony wrote: > John, > > That would be great to join into IRC but what client should I use for > IRC, is there one that is free? > > And yeah I know my set up sucks. It's not so much mine but one of those > things that IT set up and I'm looking at it going "WTF?" I wanted it a > much better way but they insisted that it be the way it is now and now > I'm getting screwed over for it. > > BTW what's the IRC channel? > > - Tony > > > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Migrating to Cake and Few General Questions
John, That would be great to join into IRC but what client should I use for IRC, is there one that is free? And yeah I know my set up sucks. It's not so much mine but one of those things that IT set up and I'm looking at it going "WTF?" I wanted it a much better way but they insisted that it be the way it is now and now I'm getting screwed over for it. BTW what's the IRC channel? - Tony --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Migrating to Cake and Few General Questions
Hey AD7six, How do I grab the params from a url using cake? Here's what my database looks like: ++ + LevelID < - (Item id for conent) + ParentLevelID <- (holds an ID from LevelID that will be the parent of the child level) + Level <- (what level it is i.e 1, 2, 3, 4, 5) + LevelOrder <-(order in which the items appears within that level) + RoleID1 <-(Role ID that relate to the table Roles) + RoleID2 <-(Role ID that relate to the table Roles) + LevelTitle + Content ++ The self join makes sense, but what do I do for roles? How many keys can you over ride in the association defenition? The main problem is that I have two foriegn key fields that relate to the same table, Roles. -t --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Migrating to Cake and Few General Questions
On Sep 8, 2006, at 11:42 AM, Tony wrote: > > I'm new to Cake so I'm a bit confused on a few things after reading > part of the documentation. We are a PHP shop and I'm a big fan of the > homegrown framework so I turned to Cake and I like what I'm seeing. > > First off, how do I format and access multiple url params? For example > in normal PHP we do something like > index.php? > module=levels&action=show&level=2&parentLevelId=24&levelId=44 /controller/action/var1/var2/var3 This is the default way to do it, at least. > Also I'm in the process of migrating code from an older application > into using CakePHP. What I'm possibly having a problem with is how my > database was set up as far as fields go. Not so much in the naming but > how they are storing data. How it works is we have multiple levels > (i.e. Level 1, Level 2, Level 3, Level 4) but we have one table > (levels) and a field called "Level" that contains what Level it is and > "ParentLevelID" which if we are on Level 2 then we would have a > ParentLevelID of a Level 1 item from that same table. (I know this > isn't the best design and it's not how I wanted it designed). > > So basically ParentLevelID is the foriegn key of it's own table and I > have to check to see if there are any levels that relate to the parent > level before deleting. How do I check for this and set up the model > for > that? I'm having a bit of a hard time following you - you might join us in IRC to see if we can hammer through it. Its not going to be pretty though - your setup is... nonconventional. ;o) > One more question. Within that same table levels we have two role ids > (role1_id and role2_id) as we can have 2 roles per level. The problem > I'm seeing is that according to how cake works with the database you > have "theforiegntableName_id" but I have two foriegn fields that > relate > to the same table. Again not how I wanted it designed. So how would I > deal with this without changing the database structure? Do I rename > those fields or add a variable some where to configure something? No, you can define multiple relationships for a single relation type, just add an additional key to the association array and make sure to tell cake what the name of the keys are. Welcome to Cake! -- John --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Migrating to Cake and Few General Questions
Hi Tony, You can most likely use what ever url you like :). The last example below (named paramters) is native to cake 1.2 but you can do it quite easily with cake 1.1.7: Assuming controller modules and action show, you can use any of the following: Modules/Show?level=2&parentLevelId=24&levelId=44 Modules/Show/2/24/44 Modules/Show/level/2/parentlevel/24/LevelID/44 <- with some custom code. A bit fragile. Modules/Show/level:2/parent:24/LevelID:44 Or any other permutation you can think of (probably). You could put a simple beforeDelete method in your model to take care your your parent problem, I don´t think you would need a parentLevelID field in your module - that would be in the level model. Self joins aren´t an issue. Regarding the different foreign keys, see http://manual.cakephp.org/chapter/models. If the key isn´t following convention - you simply override it in the association defenition and "that's that". HTH, AD7six --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Migrating to Cake and Few General Questions
I'm new to Cake so I'm a bit confused on a few things after reading part of the documentation. We are a PHP shop and I'm a big fan of the homegrown framework so I turned to Cake and I like what I'm seeing. First off, how do I format and access multiple url params? For example in normal PHP we do something like index.php?module=levels&action=show&level=2&parentLevelId=24&levelId=44 Also I'm in the process of migrating code from an older application into using CakePHP. What I'm possibly having a problem with is how my database was set up as far as fields go. Not so much in the naming but how they are storing data. How it works is we have multiple levels (i.e. Level 1, Level 2, Level 3, Level 4) but we have one table (levels) and a field called "Level" that contains what Level it is and "ParentLevelID" which if we are on Level 2 then we would have a ParentLevelID of a Level 1 item from that same table. (I know this isn't the best design and it's not how I wanted it designed). So basically ParentLevelID is the foriegn key of it's own table and I have to check to see if there are any levels that relate to the parent level before deleting. How do I check for this and set up the model for that? One more question. Within that same table levels we have two role ids (role1_id and role2_id) as we can have 2 roles per level. The problem I'm seeing is that according to how cake works with the database you have "theforiegntableName_id" but I have two foriegn fields that relate to the same table. Again not how I wanted it designed. So how would I deal with this without changing the database structure? Do I rename those fields or add a variable some where to configure something? Thanks for the help. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---