Re: Download
On 5/24/07, cake_learner <[EMAIL PROTECTED]> wrote: > > Are there any other scripts(whole site) to download apart from > bakesale? If there are, pls give me links. > http://cakeforge.org/ -- My motto for everyone else - "Just shut up, damnit!!" = PHP for E-Biz: http://sanisoft.com = --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Download
Are there any other scripts(whole site) to download apart from bakesale? If there are, pls give me links. --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: Is 1.2.0.5146alpha Usable?
I'm also using 5146 in production, and no problems so far. Might be hard to find documentation for functions and recently added features, but this affects all 1.2.xx builds... With some help from Google and this group you will get it working! So I would say go for it! =) --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: Retrieve a random list of products from subcategories
Actually found a solution. Just trying to get a list of special offers for some products. function get_special_products($id = null) { $conditions = '(Product.category_id IN (SELECT id as category_id FROM categories WHERE parent_id = '.$id.') OR Product.category_id = '. $id.') AND Product.special = 1'; $data = $this->Product->findAll($conditions,$this- >fields,'RAND()'); } --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Retrieve a random list of products from subcategories
Basically I have a category with many subcategories and those subcategories also have subcategories and so on and so forth. I want to retrieve a list of products from the category but in the eventuality there aren't any, I would like to query products belonging to any of the subcategories of the current category. Is this possible with one query ? --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Ajax + CakePHP + Tree Menu (Ver Urgent)
Hi Guys, I have search the WWW like anything... I have the basic knowledge of Ajax, javascript and cakePHP... I am trying to create a dynamic tree view of data entries using cakePHP and Ajax... Something like this:- Book1 Title Author Book2... where book information is in book table, title in title table and author in author table I kinda know how to do this using ajax, php and javascript but the problem is I have no idea about the CakePHP's Ajax functions.. I have read the manual...Looked into the IBM's tutorial...Check all the available tutorials but all of them provides piece of code which I can't understand... Is there any website/document which expains Ajax and CakePHP step by step... Please I really need help... I have to finish this project by next friday... Please Reply --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Help me set up cakephp on godaddy
I've searched and read around but have found no solution to setting up my app in godaddy, my client needs the app as soon as possible but I didn't count on the whole godaddy mod_rewrite thing. I tried using internal rewrite, the main page shows but thats it. Any access to http://site/controller will just return a 404 not found error. Can someone give me a hand here please? --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: Querying HABTM associations by array
Just a follow up -- I got the HABTM code linked up following advice from this post: http://groups.google.com/group/cake-php/browse_frm/thread/f23b1825050ad543/014092749592de70?lnk=gst&q=filtering+habtm&rnum=1#014092749592de70 The working test code is something like this: function test() { $search = array(); $this->Profile->Community->unbindAll(); $comm = $this->Profile-->Community->findByTitle("Wally's Home Community"); $search['CommunitiesProfile.community_id'] = $comm['Community']['id']; $this->Profile->bindModel(array('hasOne' => array('CommunitiesProfile')), false); // If you don't include the false, you need to execute this line again before doing the count query0 debug($this->Profile->findAll($search)); debug($this->Profile->findAll($search, array('count(*)'))); exit; } Obviously, this code doesn't do much, just tests that I can get the results I want, and a count of the records, since I'll be using paginated results. Thanks to AD7six for putting me onto the right search terms for the google group (filtering habtm). --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: Cakephp 1.2 --> belongsTo fails for the joining table
hi okie now its working..I tried couple of things and it seems, changing the order of array in belongsTo definition helped. It seems, CakePHP recursively initialize model and somehow with my original order, User object was never getting created Regards, Ritesh On May 23, 7:32 pm, bingo <[EMAIL PROTECTED]> wrote: > hi, > > I did some debugging and found some weird things.. > if I do debug($this->ArticlesUser->User) it returns me ArticlesUser > object instead of User Object > > however I do the same in another class (discussions_controller.php) > that also has a belongsTo relationships with User returns User > Object... > > Any idea where in the code, I might be making a mistake > > Regards, > Ritesh > > On May 23, 3:43 pm, bingo <[EMAIL PROTECTED]> wrote: > > > > > hi, > > > I am getting weird problem with belongsTo. My database models > > following relationships > > articles < HABTM ---> users > > articles_users ---> belongsTo --> articles && articles --> hasMany --> > > articles_users > > > articles_users ---> belongsTo --> users && users --> hasMany --> > > articles_users > > > Below is how I have defined belongsTo relations in articles_users > > var $belongsTo = array('Article','User'); > > > this is the simple piece of code that I am trying to get it working > > but is not. Based on the userid provided, it determines the username > > of the user > > > //defined in articles_users_controller.php > > function test($userid){ > >$this->ArticlesUser->expects('User'); > > $this->ArticlesUser->User->expects(); > > $result = $this->{$this->modelClass}->User->findAll(array('User.id' > > => "{$userid}"), array('User.username', 'User.id')); > > debug($result); > > exit(); > > > } > > > however, the SQL query that is being generated is > > SELECT `User`.`username`, `User`.`id` FROM `articles_users` AS > > `ArticlesUser` WHERE `User`.`id` = 2 > > > If I change the $belongsTo relationship to only contain 'User' i.e. > > var $belongsTo = array('User'); > > then the above method works...I have tried everything that I can think > > of..but nothing is working.. > > > Please let me know if you bakers have any idea or faced similar > > situation.. > > > Regards, > > Ritesh- Hide quoted text - > > - Show quoted text - --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: "Security Issue" with Malicious Forms and Model->Save
On May 23, 12:14 am, AD7six <[EMAIL PROTECTED]> wrote: > On 23 mayo, 08:58, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > > > I have a model that is updated with a simple form and model->save, but > > I purposely left feilds out of the form so a user can't update them. > > > However, as far as I know, it is possible for a user to construction a > > form with the additional fields and the controller would save the > > model without a problem. > > > I may be answering my own question, but is there a good way of > > preventing fields from being updated in certain contexts other than > > setting them to NULL before doing a save? > > > Thanks in advance! > > Look in the api for the parameters for the model save method > (whitelist means "ignore anything that isn't in this list of fields). > > In 1.2 there is automatic form-fiddling prevention. > > hth, > > AD Is the automatic form-fiddling prevention working when using the form helper? --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: Cakephp 1.2 --> belongsTo fails for the joining table
hi, I did some debugging and found some weird things.. if I do debug($this->ArticlesUser->User) it returns me ArticlesUser object instead of User Object however I do the same in another class (discussions_controller.php) that also has a belongsTo relationships with User returns User Object... Any idea where in the code, I might be making a mistake Regards, Ritesh On May 23, 3:43 pm, bingo <[EMAIL PROTECTED]> wrote: > hi, > > I am getting weird problem with belongsTo. My database models > following relationships > articles < HABTM ---> users > articles_users ---> belongsTo --> articles && articles --> hasMany --> > articles_users > > articles_users ---> belongsTo --> users && users --> hasMany --> > articles_users > > Below is how I have defined belongsTo relations in articles_users > var $belongsTo = array('Article','User'); > > this is the simple piece of code that I am trying to get it working > but is not. Based on the userid provided, it determines the username > of the user > > //defined in articles_users_controller.php > function test($userid){ >$this->ArticlesUser->expects('User'); > $this->ArticlesUser->User->expects(); > $result = $this->{$this->modelClass}->User->findAll(array('User.id' > => "{$userid}"), array('User.username', 'User.id')); > debug($result); > exit(); > > } > > however, the SQL query that is being generated is > SELECT `User`.`username`, `User`.`id` FROM `articles_users` AS > `ArticlesUser` WHERE `User`.`id` = 2 > > If I change the $belongsTo relationship to only contain 'User' i.e. > var $belongsTo = array('User'); > then the above method works...I have tried everything that I can think > of..but nothing is working.. > > Please let me know if you bakers have any idea or faced similar > situation.. > > Regards, > Ritesh --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: Changing datasources to support web services.
you would put a class that extends DataSource in /app/models/ datasources then create a connection in database.php that can be used. you could use the xml class to get the web service. here is a datasource I started on for imap. never completed beyond making the initial connection, but it provides a good skeleton for your own datasource. http://bin.cakephp.org/view/1531034840 I know someone was working on an xml datasource. He was in the IRC channel a little while ago, but I have not heard from him in a little while. hope this helps. --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Cakephp 1.2 --> belongsTo fails for the joining table
hi, I am getting weird problem with belongsTo. My database models following relationships articles < HABTM ---> users articles_users ---> belongsTo --> articles && articles --> hasMany -- > articles_users articles_users ---> belongsTo --> users && users --> hasMany --> articles_users Below is how I have defined belongsTo relations in articles_users var $belongsTo = array('Article','User'); this is the simple piece of code that I am trying to get it working but is not. Based on the userid provided, it determines the username of the user //defined in articles_users_controller.php function test($userid){ $this->ArticlesUser->expects('User'); $this->ArticlesUser->User->expects(); $result = $this->{$this->modelClass}->User->findAll(array('User.id' => "{$userid}"), array('User.username', 'User.id')); debug($result); exit(); } however, the SQL query that is being generated is SELECT `User`.`username`, `User`.`id` FROM `articles_users` AS `ArticlesUser` WHERE `User`.`id` = 2 If I change the $belongsTo relationship to only contain 'User' i.e. var $belongsTo = array('User'); then the above method works...I have tried everything that I can think of..but nothing is working.. Please let me know if you bakers have any idea or faced similar situation.. Regards, Ritesh --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
multiple fields in $displayField.
Hello there, I've been trying to fill a SELECT-tag by using the generateList function, this works great! Although I want to fill it with multiple fields from the table, eg. firstname . ' ' . lastname. How can I pull this off? Greets Ruud --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: hasOne Problem
> hm.. > i want to print out all projects and instead of the project.status_id, > i want to show the status.title provided you setup you models correctly, eg: Project belongsTo Status Status hasMany Project // in your ProjectsController $this->Project->recursive = 1; $projects = $this->Project->findAll(); foreach ($projects as $proj) { echo $proj['Project']['title'].' has a status of '.$proj['Status']['title']; } hth jon -- jon bennett t: +44 (0) 1225 341 039 w: http://www.jben.net/ iChat (AIM): jbendotnet Skype: jon-bennett --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: hasOne Problem
On May 23, 2007, at 4:21 PM, pete wrote: > > hm.. > i want to print out all projects and instead of the project.status_id, > i want to show the status.title > > how could i do that? If Project belongsTo Status: $projects = $this->Project->findAll(); foreach($projects as $project) { echo $project['Status']['title']; } (completely off the cuff, test it and play with it to get it to work) -- John > > thanks > > pete > > On May 23, 5:29 pm, "John David Anderson (_psychic_)" > <[EMAIL PROTECTED]> wrote: >> On May 23, 2007, at 3:21 PM, pete wrote: >> >> >> >>> hi, >>> i have problems using hasOne >>> basically i want to achieve: a project hasOne status >> >>> TABLES >>> projects >>> id >>> title >>> status_id >> >>> statuses >>> id >>> title >> >> The way you have things keyed here, its actually >> >> Status hasOne Project (and Project belongsTo Status). >> >> -- 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?hl=en -~--~~~~--~~--~--~---
Re: hasOne Problem
hm.. i want to print out all projects and instead of the project.status_id, i want to show the status.title how could i do that? thanks pete On May 23, 5:29 pm, "John David Anderson (_psychic_)" <[EMAIL PROTECTED]> wrote: > On May 23, 2007, at 3:21 PM, pete wrote: > > > > > hi, > > i have problems using hasOne > > basically i want to achieve: a project hasOne status > > > TABLES > > projects > > id > > title > > status_id > > > statuses > > id > > title > > The way you have things keyed here, its actually > > Status hasOne Project (and Project belongsTo Status). > > -- 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?hl=en -~--~~~~--~~--~--~---
Changing datasources to support web services.
I've seen this question asked in this group a few times, but I couldn't really parse out an answer, so I'm asking again. From what I've read of the source code, it /appears/ as though you can set the datasource for a model to, for instance, use a web service. It appears as though it's not much harder than overriding create/read/ update/delete in a subclass of DataSource. However, I can't seem to get the data source in use at all. I suspect this has to do with which files get loaded when (h00ray for file-based source code!). I'm also not quite sure where to put the code for this. I've shoved it in app/vendors now, but that doesn't seem quite right, since it ain't third party, but a first-party generic library. So, I have this data source defined in 'app/vendors/ web_services_data_source.php', and I have a model which require()s it (again, not very pretty, and I'd like to not have to do that in every model), and that's fine, but when I try to load the page I get: [SNIP] Fatal error: ConnectionManager::getDataSource - Non-existent data source WebServicesDataSource in /home/bjc/src/cake_test/htdocs/cake/ libs/model/connection_manager.php on line 110 [SNIP] And I can't figure out why. By this point, my model has been loaded and the data source module has been loaded by require() (I know, because if I change the arg to require, it barfs without displaying the message above). So why can't ConnectionManager find it? I specify $this->setDataSource('WebServicesDataSource') in the constructor of the model I'm using. I've also tried 'web_services_data_source', but it has the same error. Can anyone give me any pointers? -bjc --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: Question about variable scope, object and $html
I read it, and I did the online tutorial line by line. But I still do not quite understand. Back to my question, is $this->controller an object? But $controller is a variable defined in this class.Or maybe $controller is a variable passed by reference that points to an object? For the $html (introduced in the blog tutorial), as I never declare it. Is it a global variable (global object?)? If yes, where is it declared? Many thanks, On May 23, 2:31 pm, "Chris Hartjes" <[EMAIL PROTECTED]> wrote: > On 5/23/07, Ming <[EMAIL PROTECTED]> wrote: > > > > > Hey John, > > > This script is from an app built on top of cakephp, and to maintain > > this app is part of my new job. There are 557 files totally in app/ > > models, app/controllers, and app/views, and I want to go through all > > over them so that I can work on the app. > > > Thanks, > > I highly suggest you read the CakePHP manual before you even attempt > to figure this out. From your comments I take it that you do not have > a lot of experience with MVC frameworks built in PHP. If you did, a > lot of the questions you are asking would be easier to answer. > > -- > Chris Hartjes > > My motto for 2007: "Just build it, damnit!" > > @TheBallpark -http://www.littlehart.net/attheballpark > @TheKeyboard -http://www.littlehart.net/atthekeyboard --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: Question about variable scope, object and $html
Yes, this app has many bugs. So far I have found nearly 100 bugs. I am using both Zend studio and phpedit to debug it. I have quite a few java and perl experience, but do not have too much php experience. Thanks, On May 23, 2:34 pm, "John David Anderson (_psychic_)" <[EMAIL PROTECTED]> wrote: > On May 23, 2007, at 3:27 PM, Ming wrote: > > > > > Hey John, > > > This script is from an app built on top of cakephp, and to maintain > > this app is part of my new job. There are 557 files totally in app/ > > models, app/controllers, and app/views, and I want to go through all > > over them so that I can work on the app. > > Part of the magic of using a framework is *not* knowing what > everything does. Not many of us walk through Cake's source, not > because we don't care, but because we really don't need to. > > Are you tracking down a bug or something? > > -- 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?hl=en -~--~~~~--~~--~--~---
New Translate Behavior
I'm just playing with brand new Translate Behavior. It works great. I have only one question - is it possible to post something with the same ID in two or more languages? Now, when I post something, I have to switch language to write it another language. And then, I can't modify existing post (I can see only post in current language), I have to post another one. Anyone knows any workaround? --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: Question about variable scope, object and $html
On May 23, 2007, at 3:27 PM, Ming wrote: > > Hey John, > > This script is from an app built on top of cakephp, and to maintain > this app is part of my new job. There are 557 files totally in app/ > models, app/controllers, and app/views, and I want to go through all > over them so that I can work on the app. Part of the magic of using a framework is *not* knowing what everything does. Not many of us walk through Cake's source, not because we don't care, but because we really don't need to. Are you tracking down a bug or something? -- 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?hl=en -~--~~~~--~~--~--~---
Re: Question about variable scope, object and $html
On 5/23/07, Ming <[EMAIL PROTECTED]> wrote: > > Hey John, > > This script is from an app built on top of cakephp, and to maintain > this app is part of my new job. There are 557 files totally in app/ > models, app/controllers, and app/views, and I want to go through all > over them so that I can work on the app. > > Thanks, I highly suggest you read the CakePHP manual before you even attempt to figure this out. From your comments I take it that you do not have a lot of experience with MVC frameworks built in PHP. If you did, a lot of the questions you are asking would be easier to answer. -- Chris Hartjes My motto for 2007: "Just build it, damnit!" @TheBallpark - http://www.littlehart.net/attheballpark @TheKeyboard - http://www.littlehart.net/atthekeyboard --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: hasOne Problem
On May 23, 2007, at 3:21 PM, pete wrote: > > hi, > i have problems using hasOne > basically i want to achieve: a project hasOne status > > TABLES > projects > id > title > status_id > > statuses > id > title The way you have things keyed here, its actually Status hasOne Project (and Project belongsTo Status). -- 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?hl=en -~--~~~~--~~--~--~---
Re: Question about variable scope, object and $html
Hey John, This script is from an app built on top of cakephp, and to maintain this app is part of my new job. There are 557 files totally in app/ models, app/controllers, and app/views, and I want to go through all over them so that I can work on the app. Thanks, On May 23, 2:10 pm, "John David Anderson (_psychic_)" <[EMAIL PROTECTED]> wrote: > It might help us if we knew what you were trying to do, or why you > needed to know this... > > -- John > > On May 23, 2007, at 2:45 PM, Ming wrote: > > > > > Hi, > > > I am new to Cake and I have a question. > > > For the file below (email.php), I do not understand where does the > > "render" in > > $this->controller->render($this->thtml) come from. > > > $controller ($this->controller) is a variable whose domain is limited > > to this class. But it seems $this->controller is an object and it has > > a render function > > > I searched the entire project and there are 3 render functions: > > > The 1st is in app/controllers/components/output.php, > > the 2nd is in cake/libs/view/view.php > > the 3rd is in cake/libs/controller/controller.php > > > For this class (EmailComponent), which render function does it really > > call? Why? > > > The confusing part for me, why $this->controller is an object instead > > of a variable? I am using two different PHP IDE, after entering $this- > >> controller->, there is no code hint (if entering $this->, code hints > > will popup controller, for example). > > > Additionally, I got to know the $html helper from cake's online > > tutorial. But where is $html declared? I cannot find it. > > > Thanks, > > > > > > App/controllers/components/email.php > > > /* > > * EmailComponent for CakePHP > > * > > * @author gwoo <[EMAIL PROTECTED]> > > * @version 0.10.5.1797 > > * @licenseOPPL > > * > > */ > > class EmailComponent extends Object > > { > > var $thtml; > > var $headers = null; > > var $to = null; > > var $from = null; > > var $subject = null; > > var $cc = null; > > var $bcc = null; > > var $controller; > > > function message() > > { > >//Output buffer starts here > > ob_start(); > > $this->controller->render($this->thtml); > > > //Get buffer content and clean buffer > > $mail = ob_get_clean(); > > return $mail; > > } > > > function send() > > { > > > $headers = $this->headers > >."Content-Transfer-Encoding: quoted-printable\n" > >."From: $this->from\n" > >."Return-Path: $this->from\n" > >."CC:$this->cc\n" > >."BCC:$this->bcc\n"; > > >$success = mail($this->to, $this->subject, $this->message(), > > $headers); > >return $success; > > } > > > } > > > ?> --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
hasOne Problem
hi, i have problems using hasOne basically i want to achieve: a project hasOne status TABLES projects id title status_id statuses id title class Project extends AppModel { var $name='Project'; var $hasOne = array('Status' => array('className' => 'Status', 'conditions' => '', 'order' => '', 'foreignKey' => 'status_id')); } CONTROLLER $this->('projects', $this->Project->findAll()); VIEW when i print out the array ...[Status]=>Array([id]=>[title])) } the array is empty and i dont get the status title anyone has a hint how that could work correctly? thanks pete Status is empty. --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: Question about variable scope, object and $html
It might help us if we knew what you were trying to do, or why you needed to know this... -- John On May 23, 2007, at 2:45 PM, Ming wrote: > > Hi, > > I am new to Cake and I have a question. > > For the file below (email.php), I do not understand where does the > "render" in > $this->controller->render($this->thtml) come from. > > $controller ($this->controller) is a variable whose domain is limited > to this class. But it seems $this->controller is an object and it has > a render function > > I searched the entire project and there are 3 render functions: > > The 1st is in app/controllers/components/output.php, > the 2nd is in cake/libs/view/view.php > the 3rd is in cake/libs/controller/controller.php > > For this class (EmailComponent), which render function does it really > call? Why? > > The confusing part for me, why $this->controller is an object instead > of a variable? I am using two different PHP IDE, after entering $this- >> controller->, there is no code hint (if entering $this->, code hints > will popup controller, for example). > > Additionally, I got to know the $html helper from cake's online > tutorial. But where is $html declared? I cannot find it. > > Thanks, > > > > App/controllers/components/email.php > /* > * EmailComponent for CakePHP > * > * @author gwoo <[EMAIL PROTECTED]> > * @version 0.10.5.1797 > * @license OPPL > * > */ > class EmailComponent extends Object > { > var $thtml; > var $headers = null; > var $to = null; > var $from = null; > var $subject = null; > var $cc = null; > var $bcc = null; > var $controller; > > > function message() > { > //Output buffer starts here > ob_start(); > $this->controller->render($this->thtml); > > //Get buffer content and clean buffer > $mail = ob_get_clean(); > return $mail; > } > > function send() > { > > $headers = $this->headers > ."Content-Transfer-Encoding: quoted-printable\n" > ."From: $this->from\n" > ."Return-Path: $this->from\n" > ."CC:$this->cc\n" > ."BCC:$this->bcc\n"; > > $success = mail($this->to, $this->subject, $this->message(), > $headers); > return $success; > } > > } > > ?> > > > > --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: Question about variable scope, object and $html
By the way, I tried to get help from capk's online API. But cake's API interface is pretty different with those of Java, Pear, or CPAN. Sounds need some time to get familiar with it. On May 23, 1:45 pm, Ming <[EMAIL PROTECTED]> wrote: > Hi, > > I am new to Cake and I have a question. > > For the file below (email.php), I do not understand where does the > "render" in > $this->controller->render($this->thtml) come from. > > $controller ($this->controller) is a variable whose domain is limited > to this class. But it seems $this->controller is an object and it has > a render function > > I searched the entire project and there are 3 render functions: > > The 1st is in app/controllers/components/output.php, > the 2nd is in cake/libs/view/view.php > the 3rd is in cake/libs/controller/controller.php > > For this class (EmailComponent), which render function does it really > call? Why? > > The confusing part for me, why $this->controller is an object instead > of a variable? I am using two different PHP IDE, after entering > $this->controller->, there is no code hint (if entering $this->, code hints > > will popup controller, for example). > > Additionally, I got to know the $html helper from cake's online > tutorial. But where is $html declared? I cannot find it. > > Thanks, > > > > App/controllers/components/email.php > /* > * EmailComponent for CakePHP > * > * @author gwoo <[EMAIL PROTECTED]> > * @version 0.10.5.1797 > * @license OPPL > * > */ > class EmailComponent extends Object > { > var $thtml; > var $headers = null; > var $to = null; > var $from = null; > var $subject = null; > var $cc = null; > var $bcc = null; > var $controller; > > function message() > { > //Output buffer starts here > ob_start(); > $this->controller->render($this->thtml); > > //Get buffer content and clean buffer > $mail = ob_get_clean(); > return $mail; > } > > function send() > { > > $headers = $this->headers > ."Content-Transfer-Encoding: quoted-printable\n" > ."From: $this->from\n" > ."Return-Path: $this->from\n" > ."CC:$this->cc\n" > ."BCC:$this->bcc\n"; > > $success = mail($this->to, $this->subject, $this->message(), > $headers); > return $success; > } > > } > > ?> --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Question about variable scope, object and $html
Hi, I am new to Cake and I have a question. For the file below (email.php), I do not understand where does the "render" in $this->controller->render($this->thtml) come from. $controller ($this->controller) is a variable whose domain is limited to this class. But it seems $this->controller is an object and it has a render function I searched the entire project and there are 3 render functions: The 1st is in app/controllers/components/output.php, the 2nd is in cake/libs/view/view.php the 3rd is in cake/libs/controller/controller.php For this class (EmailComponent), which render function does it really call? Why? The confusing part for me, why $this->controller is an object instead of a variable? I am using two different PHP IDE, after entering $this- >controller->, there is no code hint (if entering $this->, code hints will popup controller, for example). Additionally, I got to know the $html helper from cake's online tutorial. But where is $html declared? I cannot find it. Thanks, App/controllers/components/email.php * @version 0.10.5.1797 * @license OPPL * */ class EmailComponent extends Object { var $thtml; var $headers = null; var $to = null; var $from = null; var $subject = null; var $cc = null; var $bcc = null; var $controller; function message() { //Output buffer starts here ob_start(); $this->controller->render($this->thtml); //Get buffer content and clean buffer $mail = ob_get_clean(); return $mail; } function send() { $headers = $this->headers ."Content-Transfer-Encoding: quoted-printable\n" ."From: $this->from\n" ."Return-Path: $this->from\n" ."CC:$this->cc\n" ."BCC:$this->bcc\n"; $success = mail($this->to, $this->subject, $this->message(), $headers); return $success; } } ?> --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Ideas on [EMAIL PROTECTED]
Don't know if this is the right thing to discuss here: I do really like the idea to be able to post and download code snippets from http://cakeforge.org/snippet. But every time I want to try some of the code, I have to solve the same kind of problems: - How should the files be named after downloading (save as... or wget "link" results in files named "download.php")? - where should they be placed? in controllers, helpers, elements? It takes a lot of time to sort those things out, especially when you are new to cakephp. In the comments you see a lot of questions related to files in the wrong location or missing. Wouldn't it be handy (especially with multiple files) to have snippets in a tgz / zip file with paths "relative to ./app"? Bests, Bram --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: Complex SQL Conditions (multiple ORs)
Looking it over, I think my question may boil down to this: how can I set conditions that specify "X is not between A and B"? --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: Count clicks
Here is my temp solution to the count clicks issue: //Getting read-posts data from the session: $rPosts = $this->Session->read('readPosts'); if(!empty($rPosts)) { //if the post do not exist in $rposts, add it: if(!in_array($id, $rPosts)) { array_push($rPosts, $id); $this->Session->write('readPosts', $rPosts); $this->Post->populateCount($id); //Populate count now adds to a tmp cache file before updating the database once every hour. } else { //do nothing } } //If $rPosts is empty, create a new variable: else { $this->Post->populateCount($id); //Add count to tmp file $rPosts = array($id); $this->Session->write('readPosts', $rPosts); } Probably not the most efficient way of doing this, but it works and it does not trouble the database to much. The populateCount() function now writes clicks to a tmp cache file and updates the database once every hour. When getting the clicks it combines the clicks from the database and the file, with a cache of 5 minutes, so the database is not overloaded. Hope this can inspire anyone to make this work even better =) Bake on! --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: Model Heirarchy and Quering
So it turns out I'm just making things harder than they need to be: $data = $this->File->findAll('User.group_id='.$this->Session- >read('User.User.group_id')); I realize this only works because of recursion, but so far, it's the best solution I have, and I need the recursive data anyway to display all the information to the users. Just so you know I tried the findAll as AD suggested. The second findAll never showed any conditions in the WHERE clause and so would retrieve all Files. After racking my brain for a while and staring at the SQL output I realized I was just doing it the hard way :P --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: Simple Model Associations Question
For the scaffolding to show the description instead of the id you need to add this to your Status/Priority model: var $displayField = 'description'; and to accomplish what you are wanting with Status/Priority I had to make it a $belongsTo instead of a $hasOne ($hasOne expects the Status & Priority tables to have a item_id foreign key.) Seems odd, but that's the only way I know to make it work, but I have about the same amount of experience as you ;) Hope that helps! -- Brian On May 23, 7:00 am, "Howard Glynn" <[EMAIL PROTECTED]> wrote: > been using cake a fortnight or so, very impressed, i'm up and running and > it is saving heaps of time :-) ... but looking for a little clarificaton > > Say I have a model called "Items" which is my main table of data. > This contains a couple of foreign keys, say "status_id" and "priority_id" > > "Statuses" and "Priorities" contain two fields, id and description > (these occasionally get changed and updated, especially by admin users, > which is why they need their own models to update via web form) > > I think it is an M:1 relationship from Items to Statuses [or Priorities] > (i.e. Many different Items can have the same status [or priority]) > > In Items, and this class alone, I say something like below. Is > this the right relationship descriptor? Does "Statuses" need anything? > I've tried reading the docs but i can't quite get my head round it. > > var $hasOne = array( > 'Status' => > array('className' => 'Status', > 'foreignKey' => 'id', > 'conditions' => '', > 'fields' => '', > 'order' => '', > 'dependent' => 'false' > ), > > If I do this, what can I expect? I was kind of hoping the scaffolding would > replace > the numeric id's in the basic form with the descriptive versions (maybe that > is asking > a little too much!) Is it the case that the data is in the variable on the > page, i just need > > Ta, HG --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Complex SQL Conditions (multiple ORs)
I need to query database entries that are "(A OR B) AND (X OR Y)". My $conditions currently looks like this: $conditions[0]['OR'] = array('Listing.expiration' => 0, 'Listing.expiration' => "> ".mktime()); $conditions[1]['OR'] = array("Listing.title" => "LIKE %".$term."%", "Listing.description" => "LIKE %".$term."%"); The problem, of course, is that I am overriding "'Listing.expiration' => 0" with "'Listing.expiration' => "> ".mktime()". How can I restructure this? Thanks for any suggestions! --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Paginator URLs
Hi fellow bakers! I have been playing around with CakePHP since late 2006, and so far I must say I love the taste of this Cake! Just started baking 1.2.xx cakes, and I have some problems with the paginator helper. Anyone know how to change the urls from: http://www.webpage.com/posts/index/page:1 http://www.webpage.com/posts/index/page:2 to http://www.webpage.com/posts/index/1 http://www.webpage.com/posts/index/2 In advance, thanks! --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: Can I do 'with' associations without HABTM?
On May 23, 2007, at 11:02 AM, bilh wrote: > > Hi folks, > > I'm adapting an app to CakePHP, learning as I go. Here's my question: > > I have three models: > > Store hasMany Forms > Form belongsTo Store, hasMany Orders > Order belongs to Form > > What would be the CakePHP way to get all Orders for a given Store? $this->Store->recursive = 2; $result = $this->Store->findById($id); Play with that recursive value until you have the data you need, using unbindModel() to eliminate whatever you don't. -- 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?hl=en -~--~~~~--~~--~--~---
Re: Is 1.2.0.5146alpha Usable?
On May 23, 2007, at 10:47 AM, Sebastian Macias wrote: > > Hello guys I just upgraded from an older version fo cakePHP 1.2 to > 1.2.0.5146alpha. I noticed the new colored warnings with context and > code. The version I was using in the past didn't have those but it was > definetely 1.2.x. > > I'm getting now a lot of errors that look like this: > > Warning (512): SQL Error: 1054: Unknown column 'User.id' in 'order > clause' [CORE\cake\libs\model\datasources\dbo_source.php, line 463] > > Warning (512): SQL Error: 1054: Unknown column 'Profile.status' in > 'where clause' [CORE\cake\libs\model\datasources\dbo_source.php, line > 463] > > Any idea why I'm getting those? If I go back to my previous version of > cake, everything works just fine. Can you show us the model calls that cause these errors, and their accompanying table structures? -- 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?hl=en -~--~~~~--~~--~--~---
Can I do 'with' associations without HABTM?
Hi folks, I'm adapting an app to CakePHP, learning as I go. Here's my question: I have three models: Store hasMany Forms Form belongsTo Store, hasMany Orders Order belongs to Form What would be the CakePHP way to get all Orders for a given Store? I think what I am trying to accomplish is something like Store hasMany Orders through Forms. I'm new to CakePHP, so please excuse my ignorance! Any more info I can provide, let me know Thanks so much! Bil --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: Is 1.2.0.5146alpha Usable?
I'm using 5146 in production with multiple relatively small apps -- smooth upgrade from 4798, and I'm currently writing a new medium-sized app using 5146 with no problems so far. Give us some details about the SQL that's raising the error, and maybe some snippets from your models and/or controllers. Unless someone else is aware of 5146 bug I'm not seeing, or hasn't been reported...? On May 23, 12:47 pm, Sebastian Macias <[EMAIL PROTECTED]> wrote: > Hello guys I just upgraded from an older version fo cakePHP 1.2 to > 1.2.0.5146alpha. I noticed the new colored warnings with context and > code. The version I was using in the past didn't have those but it was > definetely 1.2.x. > > I'm getting now a lot of errors that look like this: > > Warning (512): SQL Error: 1054: Unknown column 'User.id' in 'order > clause' [CORE\cake\libs\model\datasources\dbo_source.php, line 463] > > Warning (512): SQL Error: 1054: Unknown column 'Profile.status' in > 'where clause' [CORE\cake\libs\model\datasources\dbo_source.php, line > 463] > > Any idea why I'm getting those? If I go back to my previous version of > cake, everything works just fine. > > Thanks, > > Sebastian --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: Is 1.2.0.5146alpha Usable?
I'm using 5146 in production with multiple relatively small apps -- smooth upgrade from 4798, and I'm currently writing a new medium-sized app using 5146 with no problems so far. Give us some details about the SQL that's raising the error, and maybe some snippets from your models and/or controllers. Unless someone else is aware of 5146 bug I'm not seeing, or hasn't been reported...? On May 23, 12:47 pm, Sebastian Macias <[EMAIL PROTECTED]> wrote: > Hello guys I just upgraded from an older version fo cakePHP 1.2 to > 1.2.0.5146alpha. I noticed the new colored warnings with context and > code. The version I was using in the past didn't have those but it was > definetely 1.2.x. > > I'm getting now a lot of errors that look like this: > > Warning (512): SQL Error: 1054: Unknown column 'User.id' in 'order > clause' [CORE\cake\libs\model\datasources\dbo_source.php, line 463] > > Warning (512): SQL Error: 1054: Unknown column 'Profile.status' in > 'where clause' [CORE\cake\libs\model\datasources\dbo_source.php, line > 463] > > Any idea why I'm getting those? If I go back to my previous version of > cake, everything works just fine. > > Thanks, > > Sebastian --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Querying HABTM associations by array
I'm trying to search for profiles based on communities that they HABTM. I need to use an array for the search, because I'll be including dozens of other criteria in the search. I've got everything else hammered out except how to search this way using HABTM assoc's. I've tried tons of combos of binding models, etc to try to get what I'm looking for, but I can't seem to get it right. Here's the code I'm using to try to test just this one aspect of the array search: function test() { $search = array(); $search['Community.title'] = "Wally's Home Community"; $this->Profile->bindModel(array('hasMany' => array('CommunitiesProfile' => array('foreignKey' => 'profile_id'; $this->Profile->bindModel(array('hasOne' => array('Community' => array('foreignKey' => 'CommunitiesProfile.profile_id'; debug($this->Profile->findAll($search)); debug($this->Profile->findCount($search)); exit; } This particular incarnation of the code yields: Unknown column 'Community.CommunitiesProfile.profile_id' in 'on clause' for the findAll call, and Unknown column 'Community.title' in 'where clause' for the findCount call. Can anyone please help steer me in the right direction? How should I structure the search array, and how do I bind these models to get the results I'm looking for? On IRC people kept telling me to debug() and pr() the results... This doesn't help me figure out how to structure this type of query (though I have tried $search['Profile']['Community']['title'] = 'title', which is what the structure would have led me to believe was the way to go). Thanks --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: dynamically setting the $useTable
setSource --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
dbo adodb driver problem
where was a bug in dbo adodb driver (dbo_adodb.php) problem was in : function fields(&$model, $alias, $fields) { ... } to fix you need to add arguments types in function: function fields(&$model, $alias = null, $fields = array()) { ... } and in the start of functio add these lines: if (empty($alias)) { $alias = $model->name; } $fields = parent::fields($model, $alias, $fields, false); --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Is 1.2.0.5146alpha Usable?
Hello guys I just upgraded from an older version fo cakePHP 1.2 to 1.2.0.5146alpha. I noticed the new colored warnings with context and code. The version I was using in the past didn't have those but it was definetely 1.2.x. I'm getting now a lot of errors that look like this: Warning (512): SQL Error: 1054: Unknown column 'User.id' in 'order clause' [CORE\cake\libs\model\datasources\dbo_source.php, line 463] Warning (512): SQL Error: 1054: Unknown column 'Profile.status' in 'where clause' [CORE\cake\libs\model\datasources\dbo_source.php, line 463] Any idea why I'm getting those? If I go back to my previous version of cake, everything works just fine. Thanks, Sebastian --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: Saving hasAndBelongsToMany with selectTag
> Well, considering other people seem to be able to use HABTM-related > models, I'd say that perhaps something is wrong in your configuration. > :) The weird thing is that everything works perfectly normally as long as I use a multi-select field, i.e. a select tag that has the "multiple" attribute. The whole chain of saving and reading works and entries are made in the join table. All the examples I've found in the manual and online also all use multi-selects. I should point out that this is only if you use the HTML helper to generate the field - otherwise all you should need to do is add "[]": ... --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
afterFind when called from associations
Hello, When a model's data is fetched through an association that has a different name, in afterFind() the results are indexed using the association's name and not the model's name. Is this the correct behavior? If so how can i have a generic way of post-processing data? Do i have to manually process every association name i declare? Thanks in advance. --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: dynamically setting the $useTable
thanks the reason is i have a content model and have two tables for english content and one for spanish content, then depending on what language the user is viewing in i thought i could swap the table over rather than have two controllers. This also makes adding a new language just adding a new table. thanks again On 23 May 2007, at 14:04, grigri wrote: > > Why do you need to do that? > > Anyway, assuming you have a reason, the best place to set it would be > the constructor of the model: > > class SillyTest extends AppModel { > var $name = "SillyTest"; > var $useTable = 'dummy'; > > function __construct() { > if (mt_rand(0, 100) < 30) { > $this->useTable = 'other_table'; > } > } > parent::__construct(); > } > > Hope this helps! > > On May 23, 9:19 am, Anton Morrison <[EMAIL PROTECTED]> wrote: >> Hi I am wondering if anyone can help me find a way to set the >> $useTable dynamically. >> >> I want to set it depending on a Session variable. >> >> thanks > > > > Anton Morrison [EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: Saving hasAndBelongsToMany with selectTag
On 5/23/07, simon <[EMAIL PROTECTED]> wrote: > > Hi, > > Oddly enough Cake doesn't seem to understand that it should make an > entry in the join table for HABTM related models when the foreign key > isn't supplied from a multi select field... > Let me try and explain that :) Well, considering other people seem to be able to use HABTM-related models, I'd say that perhaps something is wrong in your configuration. :) Past your models into the CakeBin (http://bin.cakephp.org) so we can take a look at it. I assume you've also read up on the section in the manual dealing with associations and you understand what all the configuration variables for associations mean? -- Chris Hartjes My motto for 2007: "Just build it, damnit!" @TheBallpark - http://www.littlehart.net/attheballpark @TheKeyboard - http://www.littlehart.net/atthekeyboard --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Form(s) and Table(s) at one page
Hello! I'am new to Cake and - call me stupid - got some problems understanding, how to call different actions from the same controller at one page e.g. a form that submits data to the model and a table which shows the results of this (or another) model at the same page. Or as real world example, a blog, which shows a list of comments, a comment-form and all validation error messages at the same page. By now, I don't have a clue, how to handle this or even more complex layouts with more forms and tables. Maybe something like this: set("form1",$this->add()); $this->set("list1",$this->listcomments(); } function listComments() { // logic for reading comments } function add () { if (empty($this->data)) { $this->render(); } else { if($this->Post->save($this->data)) { //ok cool, the stuff is valid } else { //Danger, Will Robinson. Validation errors. $this->set('errorMessage', 'Please correct errors below.'); $this->render(); } } } } ?> Thank you, for helping a noob ... MaDo --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: Saving hasAndBelongsToMany with selectTag
The way I've worked around it for the moment is to add the following to the add function in the controller: if( !is_array($this->data['Person']['Person']) ) { $this->data['Person']['Person'] = aa(0, $this->data['Person'] ['Person']); } It's not pretty, I know. On May 23, 3:18 pm, simon <[EMAIL PROTECTED]> wrote: > Hi, > > Oddly enough Cake doesn't seem to understand that it should make an > entry in the join table for HABTM related models when the foreign key > isn't supplied from a multi select field... > Let me try and explain that :) > > Say you are creating a new Item which belongs to one or many Persons, > you will need a select tag with the name "Person/Person". However it > seems this needs to be a select tag with multiple selection enabled. > This is so that the form generates the following: > > Array > ( > [Item] => Array > ( > [field] => Value > ) > [Person] => Array > ( > [Person] => Array > ( > [0] => 1 > ) > ) > ) > > In other words you can't use a normal select tag, as this will > generate: > [Person] => Array > ( > [Person] => 1 > ) > > As the value of person isn't an array here, Cake won't pick it up and > won't make an entry in the join table. > > I haven't found a solution for this yet, I'm assuming that I'm either > missing something or that I'm going to have to do some ugly hack in > the controller's add/edit functions to turn the value into an array. > > Simon --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: How paginate results of search?
In Cake 1.2, just use the paginator. In your controller, have a search action which sets the search conditions: $this->paginate['conditions'] = array('myfield' => 'mysearch' ); $this->set( 'mydata', $this->paginate() ); You might want to store the search conditions in the session, also, if your search is supposed to by dynamic. To find out how the view has to look like, just look at how 'index' views are baked by the bake script (bake console shell, as of now). --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Saving hasAndBelongsToMany with selectTag
The way I've worked around it for the moment is to add the following to the add function in the controller: if( !is_array($this->data['Person']['Person']) ) { $this->data['Person']['Person'] = aa(0, $this->data['Person'] ['Person']); } It's not pretty, I know. On May 23, 3:18 pm, simon <[EMAIL PROTECTED]> wrote: > Hi, > > Oddly enough Cake doesn't seem to understand that it should make an > entry in the join table for HABTM related models when the foreign key > isn't supplied from a multi select field... > Let me try and explain that :) > > Say you are creating a new Item which belongs to one or many Persons, > you will need a select tag with the name "Person/Person". However it > seems this needs to be a select tag with multiple selection enabled. > This is so that the form generates the following: > > Array > ( > [Item] => Array > ( > [field] => Value > ) > [Person] => Array > ( > [Person] => Array > ( > [0] => 1 > ) > ) > ) > > In other words you can't use a normal select tag, as this will > generate: > [Person] => Array > ( > [Person] => 1 > ) > > As the value of person isn't an array here, Cake won't pick it up and > won't make an entry in the join table. > > I haven't found a solution for this yet, I'm assuming that I'm either > missing something or that I'm going to have to do some ugly hack in > the controller's add/edit functions to turn the value into an array. > > Simon --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: is anyone using Acl and AuthComponent in 1.2
Hey guys, near as I can tell... ACL is not yet functional in 1.2, unless it was finished in the last release (1.2.0.5137alpha) cook On May 23, 10:09 am, alan <[EMAIL PROTECTED]> wrote: > I am just looking into it for the first time... it would be great to > get a solid tutorial on it on the cakephp site... Perhaps they'll get > to that when 1.2 goes stable. > > thanks, > -alan- > > On May 10, 12:25 pm, Tribastian <[EMAIL PROTECTED]> wrote: > > > On 26 Apr., 07:09, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > > > > I was just wondering if anyone is successfully using cakephpAcland > > > the newAuthComponentin 1.2? > > > > If so, could you give us mortals some guidance in setting it up? It > > > looks as thoughAclhas changed significantly from 1.1. > > > > Here is some of what I have managed to peace together so far... > > > > //add theACLcomponent > > > var $components = array('Acl'); > > > > //get the aro model > > > $aro = $this->Acl->Aro; > > > > //create a new aro for User:scook, related to a user in the Users > > > table > > > $aro->create( array('model' => 'User', 'foreign_key' => 2, 'alias' => > > > 'scook') ); > > > > //save the new aro > > > $aro->save(); > > > > //get the aco model > > > $aco = $this->Acl->Aco; > > > > //create an aco for my Clients controller > > > $aco->create( array('foreign_key' => 0, 'alias' => 'Clients') ); > > > > //save the new aco > > > $aco->save(); > > > > //create an aco for the index action of my Clients controller > > > $aco->create( array('parent_id'=>'[id of Client Aco]', 'foreign_key' > > > => 0, 'alias' => 'Index') ); > > > > //save the new aco > > > $aco->save(); > > > > //grant User:scook access to the Clients controller > > > $this->Acl->allow('scook','Clients'); > > > > So now I can accesswww.site.com/clients/index > > > > 1. Is everything I have done so far correct and reasonable? > > > > 2. How do I allow User:scook access to ALL of the Clients > actions, > > > without adding an aco for each action? I have tried using "*" and "/", > > > but no luck. > > > > 3. Can I exclude certain controllers and/or actions from being > > > checked? It seems that if I include theAuthComponent, then every > > > single action is automatically checked. But if the user is not logged > > > in, theaclcheck will deny access to any action (including login). If > > > that is the case, how do I access the login action? > > > > Any insight would be appreciated. > > > > cook > > > Servus, > > > Well i am a newbe, but very interesseted in the ACL component. But i > > could not even get close to what you have already managed. So i wonder > > if you could help me a bit... i loaded the component: > > > var $components = array('Acl'); super > > > then i let cake print out me aktive components: > > > $aro = new Aro(); > > > but in the same time i get a real ugly sql error: > > > Query: startup > > > Warning (512): SQL Error: 1064: You have an error in your SQL syntax; > > check the manual that corresponds to your MySQL server version > > blablabla > > > well if you have any idea what i do wrong, i would be very happy... > > > tribastian --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: requestAction issue
Yes, I was thinking as well about using a component but I wanted to make sure this was the wisest choice. I'll need a whole lot of them ;) On 5/23/07, Mariano Iglesias <[EMAIL PROTECTED]> wrote: > > What about components? > > > > http://manual.cakephp.org/chapter/components > > > > "Components are to controllers what helpers are to views. The main > difference is that components encapsulate *business logic* whereas helpers > encapsulate presentation logic" > > -MI > > > --- > > Remember, smart coders answer ten questions for every question they ask. > So be smart, be cool, and share your knowledge. > > BAKE ON! > > blog: http://www.MarianoIglesias.com.ar > -- > > *De:* cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] *En > nombre de *Repsah > *Enviado el:* Miércoles, 23 de Mayo de 2007 10:14 a.m. > *Para:* cake-php@googlegroups.com > *Asunto:* requestAction issue > > > > In a situation like mine, what would be the best way to access another > controller's logic? Is there somewhere you can point me to? > > > > > --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: ajax link call very slow
On May 22, 2007, at 11:47 PM, Dr. Tarique Sani wrote: > > On 5/23/07, John David Anderson (_psychic_) <[EMAIL PROTECTED]> > wrote: >> >> >> On May 22, 2007, at 8:01 PM, wralph wrote: >> >>> Just thought I'd pass on this info in case someone needs to create a >>> large number of links on a page. My advice would be to create the >>> links yourself and steer clear of Cakes inbuilt functions. >> >> ...or cache your view files. > > It would be interesting to know the results after caching the view - I > would presume it would be almost as less as writing all the links > manually BUT it would be nice to know for sure :) It should be the same as writing them out statically (except for the first request to the pages), only you keep the maintainability of using the HtmlHelper functions. -- 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?hl=en -~--~~~~--~~--~--~---
RE: requestAction issue
What about components? http://manual.cakephp.org/chapter/components Components are to controllers what helpers are to views. The main difference is that components encapsulate business logic whereas helpers encapsulate presentation logic -MI --- Remember, smart coders answer ten questions for every question they ask. So be smart, be cool, and share your knowledge. BAKE ON! blog: http://www.MarianoIglesias.com.ar _ De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre de Repsah Enviado el: Miércoles, 23 de Mayo de 2007 10:14 a.m. Para: cake-php@googlegroups.com Asunto: requestAction issue In a situation like mine, what would be the best way to access another controller's logic? Is there somewhere you can point me to? --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: Session keeps regenerating
I had a problem getting things to work because i had the app_controller.php in the /app/controllers/ folders but it has to be in /app/ On 23 May 2007, at 09:29, Mike Digital Egg wrote: > > Hi, > > This is driving me mad and I hope that someone can spot the very > simple mistake I am making. I am building a shopping cart and I want > to generate a session id which then creates a shopping cart for that > session. > > I have the following in app_controller.php which should create the > Cart.session id once per session. But it isn't doing that, it > regenerates the session id every page request. So it seems that > either !$this->Session->check('Cart.session') is not working, I have > tried all 3 storage methods (php,cake,database) but still no joy. > > app_controller.php > [php] > var $beforeFilter = array('_set_defaults'); > var $uses = array('ShoppingCart'); > var $helpers = array('Javascript', 'Html', 'Ajax' , 'Form'); > > function _set_defaults () { > if ( !$this->Session->check('Cart.session') ) { > $session = md5(uniqid(time())); > $this->Session->write('Cart.session',$session); > $this->_create_cart( $session ); > } > } > [/php] > Am I doing something really stupid? > > Thanks > > Mike > > > > Anton Morrison [EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Saving hasAndBelongsToMany with selectTag
Hi, Oddly enough Cake doesn't seem to understand that it should make an entry in the join table for HABTM related models when the foreign key isn't supplied from a multi select field... Let me try and explain that :) Say you are creating a new Item which belongs to one or many Persons, you will need a select tag with the name "Person/Person". However it seems this needs to be a select tag with multiple selection enabled. This is so that the form generates the following: Array ( [Item] => Array ( [field] => Value ) [Person] => Array ( [Person] => Array ( [0] => 1 ) ) ) In other words you can't use a normal select tag, as this will generate: [Person] => Array ( [Person] => 1 ) As the value of person isn't an array here, Cake won't pick it up and won't make an entry in the join table. I haven't found a solution for this yet, I'm assuming that I'm either missing something or that I'm going to have to do some ugly hack in the controller's add/edit functions to turn the value into an array. Simon --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: Changes to SecurityComponent - every form I submit gets blackholed
Mika, If you are using hand-written forms you will need to follow the example here: https://trac.cakephp.org/changeset/4978 to remove any fields that are added by hand. Note when the security component is used you should still use the $form->create(); and the $form->submit(); if not your forms will not have the expected hidden fields and will be considered invalid anyway. Do you really like writing all the forms yourself or is there another reason you are not using the helper? -- /** * @author Larry E. Masters * @var string $userName * @param string $realName * @returns string aka PhpNut * @access public */ --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: is anyone using Acl and AuthComponent in 1.2
I am just looking into it for the first time... it would be great to get a solid tutorial on it on the cakephp site... Perhaps they'll get to that when 1.2 goes stable. thanks, -alan- On May 10, 12:25 pm, Tribastian <[EMAIL PROTECTED]> wrote: > On 26 Apr., 07:09, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > > > > > I was just wondering if anyone is successfully using cakephpAcland > > the newAuthComponentin 1.2? > > > If so, could you give us mortals some guidance in setting it up? It > > looks as thoughAclhas changed significantly from 1.1. > > > Here is some of what I have managed to peace together so far... > > > //add theACLcomponent > > var $components = array('Acl'); > > > //get the aro model > > $aro = $this->Acl->Aro; > > > //create a new aro for User:scook, related to a user in the Users > > table > > $aro->create( array('model' => 'User', 'foreign_key' => 2, 'alias' => > > 'scook') ); > > > //save the new aro > > $aro->save(); > > > //get the aco model > > $aco = $this->Acl->Aco; > > > //create an aco for my Clients controller > > $aco->create( array('foreign_key' => 0, 'alias' => 'Clients') ); > > > //save the new aco > > $aco->save(); > > > //create an aco for the index action of my Clients controller > > $aco->create( array('parent_id'=>'[id of Client Aco]', 'foreign_key' > > => 0, 'alias' => 'Index') ); > > > //save the new aco > > $aco->save(); > > > //grant User:scook access to the Clients controller > > $this->Acl->allow('scook','Clients'); > > > So now I can accesswww.site.com/clients/index > > > 1. Is everything I have done so far correct and reasonable? > > > 2. How do I allow User:scook access to ALL of the Clients > actions, > > without adding an aco for each action? I have tried using "*" and "/", > > but no luck. > > > 3. Can I exclude certain controllers and/or actions from being > > checked? It seems that if I include theAuthComponent, then every > > single action is automatically checked. But if the user is not logged > > in, theaclcheck will deny access to any action (including login). If > > that is the case, how do I access the login action? > > > Any insight would be appreciated. > > > cook > > Servus, > > Well i am a newbe, but very interesseted in the ACL component. But i > could not even get close to what you have already managed. So i wonder > if you could help me a bit... i loaded the component: > > var $components = array('Acl'); super > > then i let cake print out me aktive components: > > $aro = new Aro(); > > but in the same time i get a real ugly sql error: > > Query: startup > > Warning (512): SQL Error: 1064: You have an error in your SQL syntax; > check the manual that corresponds to your MySQL server version > blablabla > > well if you have any idea what i do wrong, i would be very happy... > > tribastian --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
i love cake
good. --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: Why cake save to 0 value if you are editing a model ?
So cake considers 0 as default value for an integer isn't it ? On 23 mai, 15:44, "Davide" <[EMAIL PROTECTED]> wrote: > Chris Hartjes wrote: > > Perhaps I'm wrong, but last I checked you can't set an integer to > > NULL...the default for an integer would be zero, wouldn't it? > > on MySQL 4.1.14-nt (Windows XP) > > CREATE TABLE `xyz` ( > `field1` int(11) default NULL, > `field2` int(11) default NULL > ) ENGINE=MyISAM DEFAULT CHARSET=latin1 > > mysql> insert into xyz (field2) value (1); > Query OK, 1 row affected (0.00 sec) > > mysql> select * from xyz; > +++ > | field1 | field2 | > +++ > | NULL | 1 | > +++ > 1 row in set (0.00 sec) > > I had the doubt too :) > > Bye > Davide --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: Why cake save to 0 value if you are editing a model ?
Chris Hartjes wrote: > Perhaps I'm wrong, but last I checked you can't set an integer to > NULL...the default for an integer would be zero, wouldn't it? on MySQL 4.1.14-nt (Windows XP) CREATE TABLE `xyz` ( `field1` int(11) default NULL, `field2` int(11) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 mysql> insert into xyz (field2) value (1); Query OK, 1 row affected (0.00 sec) mysql> select * from xyz; +++ | field1 | field2 | +++ | NULL | 1 | +++ 1 row in set (0.00 sec) I had the doubt too :) Bye Davide --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: Why cake save to 0 value if you are editing a model ?
On 5/23/07, ricarou51 <[EMAIL PROTECTED]> wrote: > > Hello, > > I've this problem : > > for any table which contains 'int' fields ( I put default value at > NULL in the database) , when I add a row whitout filling the input for > my int field, there is no problem but when I edit a row , if the input > for int field is empty, cake saves it to 0 and not to NULL > > Thanks for yours answers Perhaps I'm wrong, but last I checked you can't set an integer to NULL...the default for an integer would be zero, wouldn't it? -- Chris Hartjes My motto for 2007: "Just build it, damnit!" @TheBallpark - http://www.littlehart.net/attheballpark @TheKeyboard - http://www.littlehart.net/atthekeyboard --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Why cake save to 0 value if you are editing a model ?
Hello, I've this problem : for any table which contains 'int' fields ( I put default value at NULL in the database) , when I add a row whitout filling the input for my int field, there is no problem but when I edit a row , if the input for int field is empty, cake saves it to 0 and not to NULL Thanks for yours answers --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Simple Model Associations Question
been using cake a fortnight or so, very impressed, i'm up and running and it is saving heaps of time :-) ... but looking for a little clarificaton Say I have a model called "Items" which is my main table of data. This contains a couple of foreign keys, say "status_id" and "priority_id" "Statuses" and "Priorities" contain two fields, id and description (these occasionally get changed and updated, especially by admin users, which is why they need their own models to update via web form) I think it is an M:1 relationship from Items to Statuses [or Priorities] (i.e. Many different Items can have the same status [or priority]) In Items, and this class alone, I say something like below. Is this the right relationship descriptor? Does "Statuses" need anything? I've tried reading the docs but i can't quite get my head round it. var $hasOne = array( 'Status' => array('className' => 'Status', 'foreignKey' => 'id', 'conditions' => '', 'fields' => '', 'order' => '', 'dependent' => 'false' ), If I do this, what can I expect? I was kind of hoping the scaffolding would replace the numeric id's in the basic form with the descriptive versions (maybe that is asking a little too much!) Is it the case that the data is in the variable on the page, i just need Ta, HG --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
No Html Tables
Hi I looked at cakephp.org and they dont use any tables in their html. I would like to do the same with my site but with cakephp Cakephp has this for tables: echo $html- >tableCells($tr,array('class'=>'altRow'),array('class'=>'evenRow')); Do they have a function for div rows like this or do I have to do it manually? L --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
requestAction issue
I'm using cake 1.1.4, dealing with a requestAction problem. In one of my controllers I need to apply some logic which clearly belongs to another controller, to do this, I used a requestAction. The abuse of this feature quickly brings a significant drop in performances. In my opinoin, moving the login from controller to model to then be able to load the model in the other controller and perform the checks is wrong, models are not the place for such things, correct me if I am wrong. The duplication of such logic in every controller where this is needed doesn't sound right to me either. In a situation like mine, what would be the best way to access another controller's logic? Is there somewhere you can point me to? Thank you Repsah --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: Changes to SecurityComponent - every form I submit gets blackholed
Hey Larry, Could you maybe explain the process if we use hand-written forms as I do not use the Forms helper at all. Thanks --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: dynamically setting the $useTable
Why do you need to do that? Anyway, assuming you have a reason, the best place to set it would be the constructor of the model: class SillyTest extends AppModel { var $name = "SillyTest"; var $useTable = 'dummy'; function __construct() { if (mt_rand(0, 100) < 30) { $this->useTable = 'other_table'; } } parent::__construct(); } Hope this helps! On May 23, 9:19 am, Anton Morrison <[EMAIL PROTECTED]> wrote: > Hi I am wondering if anyone can help me find a way to set the > $useTable dynamically. > > I want to set it depending on a Session variable. > > thanks --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: dynamically setting the $useTable
Why do you need to do that? Anyway, assuming you have a reason, the best place to set it would be the constructor of the model: class SillyTest extends AppModel { var $name = "SillyTest"; var $useTable = 'dummy'; function __construct() { if (mt_rand(0, 100) < 30) { $this->useTable = 'other_table'; } } parent::__construct(); } Hope this helps! On May 23, 9:19 am, Anton Morrison <[EMAIL PROTECTED]> wrote: > Hi I am wondering if anyone can help me find a way to set the > $useTable dynamically. > > I want to set it depending on a Session variable. > > thanks --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: Is there a way to avoid name collisions?
On 5/23/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > I think this is something that should be mentioned in the Cake manual. > How do I propose such a change in the manual? > > Jos > Well, I don't think it's the responsibility of the framework to prevent namespace collisions. It's good coding practice, which is beyond the scope of CakePHP. -- Chris Hartjes My motto for 2007: "Just build it, damnit!" @TheBallpark - http://www.littlehart.net/attheballpark @TheKeyboard - http://www.littlehart.net/atthekeyboard --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: how to check all checkboxes automatically after selecting one checkbox?
hi Thomas, you may use the client side js for your purpose, see http://jquery.com for details. On 5月23日, 下午7时23分, Thomas <[EMAIL PROTECTED]> wrote: > Hai there, > > In the website I am building, there is a form with seven checkboxes. > One of those checkboxes is "all". > If someone checks the "all" checkbox, I want cake to check all the > checkboxes automatically. > > How can I do this? > > My code looks like this (I work with the Smarty template engine, so > every '{' is equal to ''): > > {$html->checkbox('Zoek/Artikel', '', '')} Artikelen > {$html->checkbox('Zoek/Column', '', '')} Columns > {$html->checkbox('Zoek/Nieuws', '', '')} Nieuws > {$html->checkbox('Zoek/QuestionAndAnswer', '', '')} Question & > Answer > {$html->checkbox('Zoek/Dir', '', '')} Bedrijven > {$html->checkbox('Zoek/CommunityMembers', '', '')} Community Members > {$html->checkbox('Zoek/Poll', '', '')} Polls > {$html->checkbox('Zoek/All', '', '')} All > > Thanks! --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: how to check all checkboxes automatically after selecting one checkbox?
hi Thomas, you may use the client side js for your purpose, see http://jquery.com for details. On 5月23日, 下午7时23分, Thomas <[EMAIL PROTECTED]> wrote: > Hai there, > > In the website I am building, there is a form with seven checkboxes. > One of those checkboxes is "all". > If someone checks the "all" checkbox, I want cake to check all the > checkboxes automatically. > > How can I do this? > > My code looks like this (I work with the Smarty template engine, so > every '{' is equal to ''): > > {$html->checkbox('Zoek/Artikel', '', '')} Artikelen > {$html->checkbox('Zoek/Column', '', '')} Columns > {$html->checkbox('Zoek/Nieuws', '', '')} Nieuws > {$html->checkbox('Zoek/QuestionAndAnswer', '', '')} Question & > Answer > {$html->checkbox('Zoek/Dir', '', '')} Bedrijven > {$html->checkbox('Zoek/CommunityMembers', '', '')} Community Members > {$html->checkbox('Zoek/Poll', '', '')} Polls > {$html->checkbox('Zoek/All', '', '')} All > > Thanks! --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: how to check all checkboxes automatically after selecting one checkbox?
hi Thomas, you may use the client side js for your purpose, see http://jquery.com for details. On 5月23日, 下午7时23分, Thomas <[EMAIL PROTECTED]> wrote: > Hai there, > > In the website I am building, there is a form with seven checkboxes. > One of those checkboxes is "all". > If someone checks the "all" checkbox, I want cake to check all the > checkboxes automatically. > > How can I do this? > > My code looks like this (I work with the Smarty template engine, so > every '{' is equal to ''): > > {$html->checkbox('Zoek/Artikel', '', '')} Artikelen > {$html->checkbox('Zoek/Column', '', '')} Columns > {$html->checkbox('Zoek/Nieuws', '', '')} Nieuws > {$html->checkbox('Zoek/QuestionAndAnswer', '', '')} Question & > Answer > {$html->checkbox('Zoek/Dir', '', '')} Bedrijven > {$html->checkbox('Zoek/CommunityMembers', '', '')} Community Members > {$html->checkbox('Zoek/Poll', '', '')} Polls > {$html->checkbox('Zoek/All', '', '')} All > > Thanks! --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: Getting data from external applications / Constructing objects
Depends on version cakePHP for 1.1.x in ModelController: $this->ModelName->id = null; $this->ModelName->save(array('fieldName' => $fieldValue)); for 1.2.x in ModelController: $this->ModelName->create(array('fieldName' => $fieldValue)); $this->ModelName->save(); 2007/5/23, Dazweeja <[EMAIL PROTECTED]>: > What is the correct Cake way of doing this, ie. Saving data from > external sources into a db in Cake? > --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
how to check all checkboxes automatically after selecting one checkbox?
Hai there, In the website I am building, there is a form with seven checkboxes. One of those checkboxes is "all". If someone checks the "all" checkbox, I want cake to check all the checkboxes automatically. How can I do this? My code looks like this (I work with the Smarty template engine, so every '{' is equal to ''): {$html->checkbox('Zoek/Artikel', '', '')} Artikelen {$html->checkbox('Zoek/Column', '', '')} Columns {$html->checkbox('Zoek/Nieuws', '', '')} Nieuws {$html->checkbox('Zoek/QuestionAndAnswer', '', '')} Question & Answer {$html->checkbox('Zoek/Dir', '', '')} Bedrijven {$html->checkbox('Zoek/CommunityMembers', '', '')} Community Members {$html->checkbox('Zoek/Poll', '', '')} Polls {$html->checkbox('Zoek/All', '', '')} All Thanks! --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
how cache handle sessions ?
imagine, if we've a sql query like this: select * from shops where city=??? ??? is a result read from one of the session's "city" var, clients may come from different cities, how cake's cache handle this issue? if I set cache on, will the cache work? or will the cache be confused? thanks so much for any helps. --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: FCKEditor Problem
I have resolved using: $(field_name).value=field_value; --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: FCKEditor Problem
I have maked this modify but the problem is not resolved. But I've noticed that if I do a alert of ($('ni". $uniq."').getInputs(null,'data[Newsitem][text]') [0].value) I get only the tag . Instead if I do an alert of ( $F(field_name)) I get exactly the value in the tectarea before the change. The problem is to assing the 'field_value' to '$F(field_name)'. Marco --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Session keeps regenerating
Hi, This is driving me mad and I hope that someone can spot the very simple mistake I am making. I am building a shopping cart and I want to generate a session id which then creates a shopping cart for that session. I have the following in app_controller.php which should create the Cart.session id once per session. But it isn't doing that, it regenerates the session id every page request. So it seems that either !$this->Session->check('Cart.session') is not working, I have tried all 3 storage methods (php,cake,database) but still no joy. app_controller.php [php] var $beforeFilter = array('_set_defaults'); var $uses = array('ShoppingCart'); var $helpers = array('Javascript', 'Html', 'Ajax' , 'Form'); function _set_defaults () { if ( !$this->Session->check('Cart.session') ) { $session = md5(uniqid(time())); $this->Session->write('Cart.session',$session); $this->_create_cart( $session ); } } [/php] Am I doing something really stupid? Thanks Mike --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
dynamically setting the $useTable
Hi I am wondering if anyone can help me find a way to set the $useTable dynamically. I want to set it depending on a Session variable. thanks --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: requestAction, modularity and multiple forms in one view
Push :-) --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: "Security Issue" with Malicious Forms and Model->Save
Great response as usual AD7. Thanks! On May 23, 12:14 am, AD7six <[EMAIL PROTECTED]> wrote: > On 23 mayo, 08:58, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > > > I have a model that is updated with a simple form and model->save, but > > I purposely left feilds out of the form so a user can't update them. > > > However, as far as I know, it is possible for a user to construction a > > form with the additional fields and the controller would save the > > model without a problem. > > > I may be answering my own question, but is there a good way of > > preventing fields from being updated in certain contexts other than > > setting them to NULL before doing a save? > > > Thanks in advance! > > Look in the api for the parameters for the model save method > (whitelist means "ignore anything that isn't in this list of fields). > > In 1.2 there is automatic form-fiddling prevention. > > hth, > > AD --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: "Security Issue" with Malicious Forms and Model->Save
Great response as usual AD7. Thanks! On May 23, 12:14 am, AD7six <[EMAIL PROTECTED]> wrote: > On 23 mayo, 08:58, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > > > I have a model that is updated with a simple form and model->save, but > > I purposely left feilds out of the form so a user can't update them. > > > However, as far as I know, it is possible for a user to construction a > > form with the additional fields and the controller would save the > > model without a problem. > > > I may be answering my own question, but is there a good way of > > preventing fields from being updated in certain contexts other than > > setting them to NULL before doing a save? > > > Thanks in advance! > > Look in the api for the parameters for the model save method > (whitelist means "ignore anything that isn't in this list of fields). > > In 1.2 there is automatic form-fiddling prevention. > > hth, > > AD --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: "Security Issue" with Malicious Forms and Model->Save
Great response as usual AD7. Thanks! On May 23, 12:14 am, AD7six <[EMAIL PROTECTED]> wrote: > On 23 mayo, 08:58, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > > > I have a model that is updated with a simple form and model->save, but > > I purposely left feilds out of the form so a user can't update them. > > > However, as far as I know, it is possible for a user to construction a > > form with the additional fields and the controller would save the > > model without a problem. > > > I may be answering my own question, but is there a good way of > > preventing fields from being updated in certain contexts other than > > setting them to NULL before doing a save? > > > Thanks in advance! > > Look in the api for the parameters for the model save method > (whitelist means "ignore anything that isn't in this list of fields). > > In 1.2 there is automatic form-fiddling prevention. > > hth, > > AD --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Duplicate Messages on the Group.
Hi All, Please note that (lately) the web interface for google groups often erroneously reports new messages have not been submitted successfully when in fact they have. Coupled with the (sometimes x hour) delay between posting and a message appearing, duplicate messages are an inevitability. If you use the web interface please: 1) If you get an error on submission - wait at least a minute and check if your message was in fact successfully submitted. 2) If you accidentally submit a duplicate message note that you can delete it yourself (the "More Options" link displayed for each message on the web interface allows the author to delete their own messages). 3) Be aware that it's not a browser problem so closing your browser and trying again doesn't make a difference. 4) Be patient :) If you do not use the web interface please: 1) Be forgiving & patient :) Cheers, AD --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: "Security Issue" with Malicious Forms and Model->Save
On 23 mayo, 08:58, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I have a model that is updated with a simple form and model->save, but > I purposely left feilds out of the form so a user can't update them. > > However, as far as I know, it is possible for a user to construction a > form with the additional fields and the controller would save the > model without a problem. > > I may be answering my own question, but is there a good way of > preventing fields from being updated in certain contexts other than > setting them to NULL before doing a save? > > Thanks in advance! Look in the api for the parameters for the model save method (whitelist means "ignore anything that isn't in this list of fields). In 1.2 there is automatic form-fiddling prevention. hth, AD --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: "Security Issue" with Malicious Forms and Model->Save
On 23 mayo, 08:58, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I have a model that is updated with a simple form and model->save, but > I purposely left feilds out of the form so a user can't update them. > > However, as far as I know, it is possible for a user to construction a > form with the additional fields and the controller would save the > model without a problem. > > I may be answering my own question, but is there a good way of > preventing fields from being updated in certain contexts other than > setting them to NULL before doing a save? > > Thanks in advance! Look in the api for the parameters for the model save method (whitelist means "ignore anything that isn't in this list of fields). In 1.2 there is automatic form-fiddling prevention. hth, AD --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: Model Heirarchy and Quering
On 23 mayo, 01:23, Brian Hartvigsen <[EMAIL PROTECTED]> wrote: > I have 3 models, Group, User, Referral. Group hasMany User, User > hasMany File. > > I have some Users that I want to be able to see all Files for other > Users in their Group. Right now I'm trying to do this with > $users = $this->User->findAll('group_id = ' . $User['group_id']); > $this->File->findAll(array('File.user_id' => $users)); Hi Brian, $constraint = array( 'User.group_id'=>$User['group_id'], 'NOT' => array('User.id' => $User['id']) ); //EITHER: $this->User->displayField = 'id'; $users = $this->User->generateList($constraint); //OR $users = $this->User- >generateList($constraint,null,null,null,'{n}.User.id'); //FOLLOWED BY $data = $this->File->findAll(array('File.user_id' => $users)); //pr ($data); die; > Obviously this isn't working. The $users array is in the wrong format > for use in a conditions statement (even if I restrict it to grabbing > id only in the first findAll.) Am I expecting to much here or simply > going about this the wrong way? I'll go for option 2. :D. hth, AD --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---