Array Format for Multiple Inserts
I have a series of Form elements(select) that I create dynamically w/ JS, and I have JS that will change the name so that they will create an array. I can create either *Module.column_id.0* or *Module.0.column_id* and increment the number, but I can't get the multiple elements to write to the database. Can someone point me in the write direction? I can't find about dynamic inputs in the book -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Writing array from dynamically generated Select boxes to database.
I don't quite know what this is called, so I'm having trouble finding a working example. This is what I want: 1. A select/pulldown menu that pulls data from the database. 2. An "add" button that creates a new menu that is a clone of the original 3. For this to write to the database. So if I have the 3 selects, I get 3 new rows in the table. Here is what I have: 1. A select/pulldown menu that pulls data from the database. 2. An "add" button that creates a new menu that is a clone of the original 3. JS script that will change the name so that it will create nested arrays of the selections. 4. The ability to write one pulldown, but only one. 5. Cake 2.something. Is what I want possible with Cake? I know it is possible with straight PHP, I've done it before. However, I can't get cake to write multiple values to the database. I have no idea where to even begin with this. There's nothing in the book, and I can't find someone who has done something similar. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: Multi Tenancy / SaaS
I've got the same issue on a project I'm working on. Any solutions you came up with Dylan? On Monday, August 6, 2012 4:02:15 PM UTC-6, Dylan Jennings wrote: > > Hello > > I'm currently building a SaaS application using cakePHP. I've worked with > cakePHP before a few times and I'm comfortable with how it all works. > > So, I have an `accounts` table which holds information about each tenant, > and then a `users` table aswell, which will contain the users for each > account/tenant. New users will initially be added through a basic plain PHP > or WordPress front-end, so there won't be the need to create new `accounts` > through the cakePHP side of the app. > > Just to be clear, each tenant will be on a subdomain of the main domain. > For example, http://dylan.mycakeapp.dev/ could be a tenant. The front-end > site will be held in the root of the site, http://mycakeapp.dev/. When > new users sign up on the front-end site, their `accounts` record and a > single `users` record will be created, they will get redirected to their > subdomain, and the cakePHP app will take it from there. > > So here's the problem. I want all tenants to share the same database, > separated by an 'account_id' which will be in all tables. I'm not 100% on > this, but I think the correct approach is to use the 'beforeSave', > 'beforeDelete' and 'beforeFind' callbacks in the model, and simply add the > `account_id` as a query condition. The problem comes when I'm trying to > detect which tenant to use, because I can't use the database within the > model. > > Does anyone have any experience with SaaS/multi-tenancy apps in cakePHP, > and can help? Thanks in advance. > > Cheers > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
SQL / PHP Beginner....
Hi I am trying to make a simple PHP page that queries a MySQL database. There are two tables created by a program (I don't have any control over the creation of these tables) but they both created by the same data source. I was trying to form a FULL JOIN to display data from both tables in one web page - However I can't seem to get this to work. The only common column in both is ResultSetID which in one is totally unique - the other is repeated (although the identifier does relate to the same user and data entered by that user) The two tables are: resultsets: (which contains the following columns) ResultSetID, Candidate, QuizName, PercentageScore, PercentagePass, PassFail and questiondata (which contains the following colloums) ResultSetID, SectionReference, Responce The code I have strung together so far is as follows:. "; } ?> But the output I am getting from the webpage is: Column 'ResultSetID' in on clause is ambiguous Is this because the ResultSetID in the questiondata is not unique per row? And if so is there any way to merge the two tables together? Sorry to be a real novice but I only started to look at PHP and MySQL last night! -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Tree Behavior problem
I've got a problem with the Tree behavior in an application I'm maintaining. The version of cakephp is 1.2.1.8004. The user wants to move a node that was already created to a node created after the node being moved. After the save is performed the old node has the same lft, rght values as before the save. To investigate the problem, I've created a test db with only one table. When I perform the same operation, the node is successfully moved (i.e., the lft and rght fields are correctly updated). I executed verify and got errors on the tree, but those same errors exists on the test table and the function works correctly. The model extends the AppModel and has the parentNode function as required: class Realm extends AppModel { var $name = 'Realm'; var $actsAs = array('Tree' => array('left'=>'lft','right'=>'rght'),'Acl' => array('requester')); var $uses = array('Acl'); var $hasMany = array( 'User' => array('className' => 'User', 'foreignKey' => 'realm_id', 'dependent' => false, 'conditions' => '', 'fields' => '', 'order' => 'lname asc', 'limit' => '', 'offset' => '', 'exclusive' => '', 'finderQuery' => '', 'counterQuery' => '' ) ); var $belongsTo = 'Instrument'; function parentNode() { if (!$this->id && empty($this->data)) { return null; } $data = $this->data; if (empty($this->data)) { $data = $this->read(); } if (!$data['Realm']['parent_id']) { return null; } else { return array('Realm' => array('id' => $data['Realm'] ['parent_id'])); } } The User model does not have a parentNode function. In the realm_controller, the CRUD functions exists: Add $params = array( //'callbacks'=>false, ); if ($this->Realm->save($this->data,$params)) { //die(); // now need to add the permissions $this->admin_setupDefaultPerms($this->Realm->id, false); // need to reload realms in app_controller so remove them from // the session // so they are reset when the page is reloaded $this->Session->write('realm_ids',''); $this->Session->setFlash(__('The Realm has been saved', true)); $this->redirect(array('action'=>'index')); } else { $this->Session->setFlash(__('The Realm could not be saved. Please, try again.', true)); } ... Update: if (!empty($this->data)) { $params = array( 'callbacks'=>false, ); //Configure::write('debug', 2); //$this->Realm->useModel('Realm'); //$this->Realm- >find('all',array('conditions'=>array('Realm.id'=>$id),'order'=>'lft asc')); //if ($cRealm['Realm']['parent_id'] != $this- >data['Realm']['parent_id']) //debug($this->data); //die; //$save_data = $this->data[0]; if ($this->Realm->save($this->data,$params)) { $this->Session->setFlash(__('The Realm has been saved', true)); $this->redirect(array('action'=>'index')); } else { $this->Session->setFlash(__('The Realm could not be saved. Please, try again.', true)); } } else { $this->data = $this->Realm->read(null, $id); } The delete and read are typical. The find uses a paginator and the default order is Realm.id. The SQL for table creation and insert follows: -- phpMyAdmin SQL Dump -- version 3.2.3 -- http://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: Feb 18, 2010 at 10:58 AM -- Server version: 5.0.88 -- PHP Version: 5.2.9
Losing Session on Redirect
Hi everyone, I've read through all the various posts regarding losing session data on redirects. Tried most everything, including * Setting security to low * Toggled useragent check off * Tried starting session manually * Within redirect function and commented out anything regarding sessions * Storing sessions in database After setting security to low and commenting out items in redirect function, I can now redirect without losing session data about 75% time, but there's still occasions, including anytime I delete a record, where the session is totally wiped out. In addition, even when I redirect and do NOT lose session data, the session 'flash' data is never carried over. In my research, I read that this could be a larger PHP issue, than just Cake, but wanted to post and start discussion again. Has anyone come up with a foolproof method for redirecting without losing session data everytime? I'm on PHP 5.6.5, Cake 1.2.4.8166. Thanks! Wilson --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Save HABTM, Undefined index: id
Thanks Martin! That works. Not quite sure why, but I've added an 'id' field to my join table. For the multi-saves, there's no error, but nothing is written to the field? Anyhow, I appreciate your help. Wilson On Aug 17, 4:02 am, Martin Westin wrote: > Which model doesn't have anidfield? > > If it has an pk or uid or some other name you should just let Cake > know via the attribute $primaryKey. > The join-table can manage without any primary key as long as you don't > store any extra data in it. But this is not encouraged, it seems to be > considered as smart as smoking cigarettes and drinking lighter-fluid > at the same time. (I tried to discuss the point a while back.) > > But, since you mention a position value in the joining table you do > need anidthere to make Cake happy. > > On Aug 17, 12:31 am, Wilson Sheldon wrote: > > > Hi everyone, > > > Anytime I save a HABTM relationship, I always get this error: > > >Notice(8):Undefinedindex: id > > > Everything works, but of course, this is annoying when I'm not in > > production mode. There is no plain 'id' in the model. > > > Done a bit of research on it, and found a few others who mention it, > > but can't find answer, so just normally suppress it. > > > I think it's related to the fact, that I often store the position in > > the join table. > > > Has anyone experienced this? And if so, is there a workaround or a > > better way to store the position? > > > I've also thought it might be something to do with theindexon my > > join table? > > > Thanks, > > Wilson > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Save HABTM, Undefined index: id
Hi everyone, Anytime I save a HABTM relationship, I always get this error: Notice (8): Undefined index: id Everything works, but of course, this is annoying when I'm not in production mode. There is no plain 'id' in the model. Done a bit of research on it, and found a few others who mention it, but can't find answer, so just normally suppress it. I think it's related to the fact, that I often store the position in the join table. Has anyone experienced this? And if so, is there a workaround or a better way to store the position? I've also thought it might be something to do with the index on my join table? Thanks, Wilson --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Containable recursive find problem
Hi Andreas, I'm trying to this same thing, but without success. Do you mind pasting your find logic here? On Jun 12, 9:20 am, Andreas Derksen wrote: > Thanks, Works fine! Thought to complicated... :-) > Containable behavior is really nice ;-) > > greets > Andreas > > Martin Westin schrieb: > > > You just go: > > > 'contain' => array( > > 'Product' => array( > > 'conditions' => array('Product.id' => $productId), > > 'Module' => array( > > 'Subject' > > ) > > ), > > 'Check' > > ) > > > That is: in contain you simply name the nearest "associates" and in > > each of those you name furhter associates to return. > > > On Jun 12, 2:02 pm, Andreas Derksen wrote: > > >> Hi, im currently developing a checklist application witch has the > >> following Models and relations: > >> Checklist belongsTo Product > >> Checklist hasMany Check > >> Product HABTM Module > >> Module hasMany Subjects > >> Subject belongsTo Module > >> So, what i want to do now is to generate tables like this:Checklist ID > >> 2Module 1Subject 1Subject 2Subject 3Subject 4Module 2Subject 1Subject > >> 2Subject 3Subject 4 > >> I tried to query it like this: > >> $this->Checklist->find('first', array('contain' => array( > >> 'Product' => > >> array('conditions' => array('Product.id' => $productId)), > >> 'Check' ))); > >> the result is:Array ( [Checklist] => Array ( [id] => 1 [product_id] => 1 ) > >> [Product] => Array ( [id] => 1 [name] => Product1 ) [Check] => Array ( [0] > >> => Array ( [id] => 1 [check] => true [checklist_id] => 1 [subject_id] => 1 > >> ) ) )Now I need the Product array recursive, means: the associated > >> Module(s) and the Subject(s) associated to the Module(s). > >> A $this->Checklist->find('first', array('recursive' => 2, 'conditions' => > >> array('id' => $checklistId))); returns everything I need, ... and more. > >> thats the problem. > >> How can I do that? > >> Thanks in advance > >> Andreas > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
$this->layout not working in Production in 8166, but is in 7945
Hi everyone, I feel like this is a common issue, and one that I've probably come across myself before, but I can't for the life of me seem to solve it. I have a simple action 'home' in my pages controller and the only code in it is: $this->layout = 'home'; I can verify with debug code that it's getting here properly. Here's the tricky part, in Cake, revision 8166 it doesn't work in production mode. Just uses the 'default' layout. However, in Cake, revision 7945 it works fine in both production mode and both debug modes. Is this a bug? Did anything change between 7945 and 8166? Thanks for any help! Wilson --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Anyone built a forum system yet?
I've 'bridged' a phpBB2 and phpBB3 system successfully on two separate occasions. For phpBB3, you can use the bridge I wrote here. http://bakery.cakephp.org/articles/view/phpbb3-api-bridge And certainly you could extend it to match your ACL, Who's Online and read/unread requirements. Some of these may already be included in phpBB3's API. To display the forum, in the body of the page, I used the Dynamic Drive iFrame script. http://www.dynamicdrive.com/dynamicindex17/iframessi2.htm On Jan 20, 4:00 pm, Miles J wrote: > What if there are like 1000+ unread threads, with thousands of users. > Why would I want to store all that information in the system. Plus I > would also have to extract the array from the database, remove indexes > depending on what threads they have read, update the db again, etc. > > Anyways, anyone have answers to my initial questions? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: data is one step behind when submitting a form with FCK editor and AJAX
Check the Expire headers your server is sending. I had an issue with this causing similar problems. In fact, I had to disable the far future Expires until I could determine a way to apply it to all but the /admin routes. Wilson On Jun 11, 10:18 am, "Jonathan Snook" <[EMAIL PROTECTED]> wrote: > I'm trying to figure out exactly what you've got going on: > > When you click save, do you have an ajax call that's meant to save the > data to the server? If you take the ajax call out and just leave Fck, > does it work? > > As far as I know, Fck copies the content from the editor to a hidden > textarea on form submit. Which means if you're doing an Ajax call, it > may not be accessing the most recent content. You may need to do a > custom javascript call to force Fck to update the hidden textarea so > that the Ajax call can submit it to the server. > > On Wed, Jun 11, 2008 at 7:15 AM, Bart <[EMAIL PROTECTED]> wrote: > > > Hello, > > An awkward thing occurs when I'm trying to submit a form with the AJAX > > helper and fck editor applied to a textarea. > > > The textarea is already loaded with a value from the database (I'm > > updating newsposts). When I submit the form (only textarea) the new > > value is not passed to the controller $this->data. The old value > > appears. > > Though, if I hit the submit button again... it does post the new > > value. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
RC1 SVN Question
Hi everyone, Quick question... Since RC1 is revision 7125. Am I safe to export https://svn.cakephp.org/repo/branches/1.2.x.x As my production code? I did that and it works fine but is revision 7146. If not, how do you check out the RC1 stable? And should that be from trunk or branches? Thanks for your advice! Best, Wilson --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Expires Headers and Routes
Hi everyone, This question is not specific to CakePHP, but does anyone have any advice how I would set the Apache Expires header in .htaccess for every URL except for '/admin/*. My normal 'Yslow inspired' Expires header causes problems with images and session flash messages in my clients' admin system. Many thanks, Wilson --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Routes or Template Field?
Hi everyone, Quick question. I have an app I'm building with nav all building off of the 'pages' table with certain pages requiring data from other Models. For example, 'clients' is a table and a row in 'pages'. So would you: 1. Store the view new as a template in the table? For example, pages.template = 'clients' 2 Hard-code the possible routes, for example: Router::connect('/clients/*', array('controller' => 'clients', 'action' => 'index')); Just looking for the best practice way of doing this. Thanks! Wilson --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Reverse Bake?
Hi, I heard a developer friend mention once that he heard of CakePHP considering sort of a 'reverse baking' technique, in that the database structure is created automatically from the model relationships. Could anyone verify this? And if true point me to the thread, it sounds very interesting and I didn't find it when I searched. Thanks! WS --~--~-~--~~~---~--~~ 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 Kids in HasMany (like an Adoption) . . .
On Feb 10, 2008 4:36 AM, AD7six <[EMAIL PROTECTED]> wrote: > > On Feb 10, 3:47 am, "Ben Wilson" <[EMAIL PROTECTED]> wrote: > > I'm not getting this from the documentation, so could somebody point > > me to an example that shows this? > > > > I have a Parent that "hasMany" Children. I also have children > > belongsTo Parent. I want to change a handful of Children so they have > > a different Parent. > > How is that different from simply 'calling save'? Dunno. I don't see an example that clearly states that calling save will change the kids like that. My present solution is to send the form to the kids' controller and processing them individually. We're talking a lot of kids. -- Ben Wilson "Words are the only thing which will last forever" Churchill --~--~-~--~~~---~--~~ 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 Kids in HasMany (like an Adoption) . . .
I'm not getting this from the documentation, so could somebody point me to an example that shows this? I have a Parent that "hasMany" Children. I also have children belongsTo Parent. I want to change a handful of Children so they have a different Parent. -- Ben Wilson "Words are the only thing which will last forever" Churchill --~--~-~--~~~---~--~~ 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: history...
On Feb 9, 2008 8:45 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > I see. Not the way I would do it to be honest, but it's possible... > > What you really want to do is avoid overriding the save method in the > model and use either a beforeSave hook in the model, or writing a > behaviour (1.2) that has similar beforeSave hooks in it. > > I would watch that column quite carefully if I were you, a few updates > and, and you could quickly find yourself with very sub-optimal > database row lengths. Thanks, the data does not change often, and after (say) 30 days the history is truncated. Were I to use beforeSave, roughly how would I got about it? I mean, what do I need to do before/after the "history" logic? -- Ben Wilson "Words are the only thing which will last forever" Churchill --~--~-~--~~~---~--~~ 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: history...
On Feb 9, 2008 6:31 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > if you add created and modified columns to your table, cake will > automagically fill them in for you. But, when I submit a changed record, I want it to do something like the following: save($orig, $new) { $hx = json_decode($orig['hx'], 1); $key = time(); unset($orig['hx']); $hx[$key] = $orig; $new['hx'] = json_encode($hx); Model::save($new); } However, I don't know the right way to call the parent class that will recognize the model described. -- Ben Wilson "Words are the only thing which will last forever" Churchill --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
history...
I am storing a row's history in a json_encoded hx field, where each change is a timestamped key. How do I go about putting this behavior in save() so I don't have to do it in every action? -- Ben Wilson "Words are the only thing which will last forever" Churchill --~--~-~--~~~---~--~~ 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: SQL error with ACL ARO
On Jan 29, 2008 10:44 AM, david_setwise <[EMAIL PROTECTED]> wrote: > > Hi, I am running the 1.2 beta with mysql. I am trying to setup ACL > and have been following all the common tutorials out there like > http://bakery.cakephp.org/articles/view/how-to-use-acl-in-1-2-x > > When I run the setupAcl function, as detailed in the Bakery article, I > get a SQL error about the aro.parent_id field: SQL Error: 1054: > Unknown column 'Aro.parent_id' in 'field list' > > My aro table definitely does not have a parent_id field, but I thought > I had the table structure correct. Does anyone have any idea what I > am doing wrong? David, you're carping about the same thing I've raised. It seems that the script that creates the database neglects the correct schema. Nobody seems interested in addressing or resolving this. -- Ben Wilson "Words are the only thing which will last forever" Churchill --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
cake acl create aco ROOT Members... problem
below is the result I get trying to set acos. what am I doing wrong? [EMAIL PROTECTED] [~/cake/AstroEmpires]# cake acl initdb Hello daushan, Welcome to CakePHP v1.2.0.6311 beta Console --- Error: This command is deprecated. Please use, cake schema run create DbAcl [EMAIL PROTECTED] [~/cake/AstroEmpires]# cake schema run create DbAcl Hello daushan, Welcome to CakePHP v1.2.0.6311 beta Console --- Cake Schema Shell --- The following tables will drop. acos aros aros_acos Are you sure you want to drop the tables? (y/n) [n] > y Dropping tables. The following tables will create. acos aros aros_acos Are you sure you want to create the tables? (y/n) [y] > y Creating tables. End create. [EMAIL PROTECTED] [~/cake/AstroEmpires]# cake acl create aco / ROOT Hello daushan, Welcome to CakePHP v1.2.0.6311 beta Console --- New Aco 'ROOT' created. [EMAIL PROTECTED] [~/cake/AstroEmpires]# cake acl create aco ROOT Members Hello daushan, Welcome to CakePHP v1.2.0.6311 beta Console --- Error: Could not find parent node using reference "ROOT" The table: id object_id alias lft rght 1 NULLROOT 1 2 -- Ben Wilson "Words are the only thing which will last forever" Churchill --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Too Much Noise Auth/ACL 1.2
I've been beating my head into the wall on Auth/ACL for over a week now. Yesterday, I got SimpleACL Component to work,[1] but this morning I was suddenly unable to authenticate; nor is anybody else. I used to be pretty good at digging through spaghetti code and finding problems, but I cannot figure out where the authentication is failing---yes, the username/password are correct. I got SimpleACL to work out of the box, until this morning when everything stopped authenticating. I cannot find one truly authoritative reference that clearly explains Auth/ACL. I find documents that discuss the 1.1 table structure, but nothing that explains 1.2 in a way that clearly makes sense to me. I even tried that ACL Management plugin and threw it away. I need a solution that works vanilla. -- Ben Wilson "Words are the only thing which will last forever" Churchill [1]: http://wiki.kabturek.info/simpleaclcomponent --~--~-~--~~~---~--~~ 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: Auth 1.2 infinite redirect...
On Jan 20, 2008 9:11 AM, Ben Wilson <[EMAIL PROTECTED]> wrote: > Could somebody clue me into why I'm encountering an infinite > redirection loop? I'm using the latest Beta 1.2 series. My browser > allows cookies. I am following what appears to be a pretty-good > tutorial---and have made my users/groups table comply.[1] The only way > to keep it from looping is to allow '*', which defeats the purpose. > > > [1]: http://www.webdevelopment2.com/cakephp-auth-component-tutorial-1/ I think I've found the problem. I was using an element to create a site-wide menu. In that element, a call was made to an action that was not on the allow list. However, since it occurs on every page, including /users/login, any attempt to call it resulted in a redirect to /users/login. This resulted in the infinite loop. The culprit code follows: $menus = $this->requestAction('menus/getMenus/header'); The solution was to add the action "getMenus" to the allow. This corrected the problem. The solution code follows: $this->Auth->allow('getMenus'); -- Ben Wilson "Words are the only thing which will last forever" Churchill --~--~-~--~~~---~--~~ 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: Auth in 1.2
On Jan 20, 2008 11:43 AM, b logica <[EMAIL PROTECTED]> wrote: > > Change back to where you had a blank screen and look in the error log > for any FATAL errors. I think I found the problem. I created a site-wide menu element that is in the default. It calls the action below. Because the action is not in the 'allow' list, calls to it result in the loop. $menus = $this->requestAction('menus/getMenus/header'); -- Ben Wilson "Words are the only thing which will last forever" Churchill --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Auth 1.2 infinite redirect...
Could somebody clue me into why I'm encountering an infinite redirection loop? I'm using the latest Beta 1.2 series. My browser allows cookies. I am following what appears to be a pretty-good tutorial---and have made my users/groups table comply.[1] The only way to keep it from looping is to allow '*', which defeats the purpose. [1]: http://www.webdevelopment2.com/cakephp-auth-component-tutorial-1/ -- Ben Wilson "Words are the only thing which will last forever" Churchill --~--~-~--~~~---~--~~ 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: Auth in 1.2
On Jan 19, 2008 10:55 PM, Ben Wilson <[EMAIL PROTECTED]> wrote: > On Jan 16, 2008 5:05 PM, Baz <[EMAIL PROTECTED]> wrote: > > Yep, > > > > Took me a while too. lol > > Okay, I bit. I'm trying to get authentication/authorization going for > a site and am trying your tutorial. Although, I have a table in place > and need to make a few mods. However, with the original table and your > code, I'm getting a blank display on the browser. Now I'm in an infinite redirection loop, unless I set $this->Auth->allow('*'); This sort of defeats the purpose. :-) -- Ben Wilson "Words are the only thing which will last forever" Churchill --~--~-~--~~~---~--~~ 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: Auth in 1.2
On Jan 16, 2008 5:05 PM, Baz <[EMAIL PROTECTED]> wrote: > Yep, > > Took me a while too. lol Okay, I bit. I'm trying to get authentication/authorization going for a site and am trying your tutorial. Although, I have a table in place and need to make a few mods. However, with the original table and your code, I'm getting a blank display on the browser. -- Ben Wilson "Words are the only thing which will last forever" Churchill --~--~-~--~~~---~--~~ 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: Building an action list bar
I found what I was looking for. Thanks, all, for pointing me in good directions. I applied the menu helper below,[1] although I had to change the code to make $link a string instead of an array (implode('/', $link)). I also had to change "AppHelper" to "HtmlHelper." I noticed the individual who posted the solution tried to have it accepted into the core,[2] but was unsuccessful from what I can tell. Ben Wilson [1]: http://bakery.cakephp.org/articles/view/ul-ol-menu-method-for-helpers [2]: https://trac.cakephp.org/ticket/3144 On Jan 12, 2008 12:25 PM, Marcin Domanski <[EMAIL PROTECTED]> wrote: > > Hey Ben > Welcome. You can find many menu systems floating around ( > bakery.cakephp.org, cakeforge.org , > http://www.thinkingphp.org/2007/07/08/macgyver-menu-for-cakephp-whats-the-active-menu-item/ > ) > If that is what you want :) > > Join us on irc.freenode.org @ #cakephp if you have any questions, > > > On Jan 12, 2008 5:05 PM, Ben Wilson <[EMAIL PROTECTED]> wrote: > > > > Okay, I realize this is probably a softball pitch for the more > > experienced Cake users. I just started tinkering with CakePHP > > yesterday, having never used a framework before. I web programmed in > > Perl (professional) for a few years, then drifted into PHP (as a > > hobby) after I moved on to being a PM. So, I'm not exactly a knuckle > > dragger, but not immediately knowledgeable in some of the more recent > > innovations. > > > > My foray into CakePHP is an effort to correct that. So far, I've been > > pleased with the organization of the tool. I got a little frustrated > > when I moved the core Cake code and the app-specific code out of the > > 'standard' area---the documentation was disorganized enough that I > > ended up throwing up a few print strings in the core code until I > > figured out where things should go. But, I digress. That's just me > > being confused. > > > > I would like to build an action bar that lists all that a user can do > > (e.g. login/logout, view, edit) for display at the top of the page. I > > figured there would be a short tutorial somewhere, or a ready-baked > > solution in the tool itself. Would somebody mind pointing me in the > > right direction? > > > > Regards, > > Ben Wilson > > > -- > Marcin Domanski > http://tumble.kabturek.info > > > > -- Ben Wilson "Words are the only thing which will last forever" Churchill --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Building an action list bar
Okay, I realize this is probably a softball pitch for the more experienced Cake users. I just started tinkering with CakePHP yesterday, having never used a framework before. I web programmed in Perl (professional) for a few years, then drifted into PHP (as a hobby) after I moved on to being a PM. So, I'm not exactly a knuckle dragger, but not immediately knowledgeable in some of the more recent innovations. My foray into CakePHP is an effort to correct that. So far, I've been pleased with the organization of the tool. I got a little frustrated when I moved the core Cake code and the app-specific code out of the 'standard' area---the documentation was disorganized enough that I ended up throwing up a few print strings in the core code until I figured out where things should go. But, I digress. That's just me being confused. I would like to build an action bar that lists all that a user can do (e.g. login/logout, view, edit) for display at the top of the page. I figured there would be a short tutorial somewhere, or a ready-baked solution in the tool itself. Would somebody mind pointing me in the right direction? Regards, Ben Wilson --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Exclude Array Item on Save
Hiya, I've got a simple image upload form in which the user can come back and update the image, as well as name, description etc. The issue I'm having is that when they come back to only update the description, I don't want the original image to be overridden. So I first thought that I could just unset the array item. For example: if (!$this->data['Home']['image']['name']) { unset($this->data['Home']['image']); } However, the Cake save() function still overrwrites the old image in the DB. How do you all accomplish this in your forms? Is there a CakePHP syntax to tell it to not update a field? I'm using the latest 1.2x from the SVN. Many thanks! Wilson --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
HTTP_ACCEPT_LANGUAGE and Locale Question
Hiya, It seems from reading about translations in the forum, that we're to use the browser's HTTP_ACCEPT_LANGUAGE variable to switch between translations stored in the /app/locale/language/. Correct? This makes sense, but why is the default language in the locale directory 'eng' rather than 'en-us' or 'en-gb' (or any other). Is there another variable set to 'eng' somewhere? Thanks! Wilson --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Validate one form, multiple models, 1.2
Hiya, Could anyone point me in the right direction for a way to validate a single form based on the rules set in different models? Basically, my form registers a user (User model) and uploads a photo (Photo) model. It's rendered and saved in the users_controller.php so all fields defined in the User model are validated correctly. But the fields from the Photo model aren't validated. Many thanks! Wilson --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Baked Enum in 1.2?
Hi there, Has anyone gotten the Baked Enum snippet to work in 1.2? I've looked through the bakery and it certainly seems it was working in 1.x. But it didn't work for me. I may be missing something, but it seems like the Enum issue was discussed a lot until Nov 2006 and then stopped. So is it included in 1.2? I baked my App to start and it was broken in that, though it had this curious $s variable in the view. I just need a dropdown and set a selected value on render, like a lot of folks I imagine. I can code it myself if need be. Thanks, Wilson --~--~-~--~~~---~--~~ 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: Quick admin routes question
Ah, got it! Router::connect('/admin', array('controller'=>'photos','action'=>'index', CAKE_ADMIN => CAKE_ADMIN)); On 8 Jul, 21:30, wilson <[EMAIL PROTECTED]> wrote: > Hmmm. Actually I couldn't get this to work for me. Perhaps, it's > because I'm on 1.2x. Anyone else got a way they do this? I'll dig in > the source a bit. > > Thanks, > Wilson > > On Jul 8, 7:17 am, Hellbot <[EMAIL PROTECTED]> wrote: > > > Router::connect('/admin/', array(CAKE_ADMIN => true, 'controller' => > > 'photos', 'action' => 'index')); > > > 2007/7/8, [EMAIL PROTECTED] <[EMAIL PROTECTED]>: > > > > I need to route '/admin' to '/admin/photos/index' in my routes table. > > > Is this possible? I'm using CakePHP admin routes. > > > > Router::connect('/admin', array('controller' => 'photos', > > > 'action' => > > > 'admin_index')); > > > > For me, it generates the 'Trying to access private method in class' > > > error. I've read the manual and searched the group to find the answer > > > but didn't locate it. > > > > I also tried: > > > > Router::connect('/admin', array('controller' => 'admin/photos', > > > 'action' => 'index')); > > > > Among others. > > > > Anyone done this? --~--~-~--~~~---~--~~ 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: Quick admin routes question
Hmmm. Actually I couldn't get this to work for me. Perhaps, it's because I'm on 1.2x. Anyone else got a way they do this? I'll dig in the source a bit. Thanks, Wilson On Jul 8, 7:17 am, Hellbot <[EMAIL PROTECTED]> wrote: > Router::connect('/admin/', array(CAKE_ADMIN => true, 'controller' => > 'photos', 'action' => 'index')); > > 2007/7/8, [EMAIL PROTECTED] <[EMAIL PROTECTED]>: > > > I need to route '/admin' to '/admin/photos/index' in my routes table. > > Is this possible? I'm using CakePHP admin routes. > > > Router::connect('/admin', array('controller' => 'photos', 'action' > > => > > 'admin_index')); > > > For me, it generates the 'Trying to access private method in class' > > error. I've read the manual and searched the group to find the answer > > but didn't locate it. > > > I also tried: > > > Router::connect('/admin', array('controller' => 'admin/photos', > > 'action' => 'index')); > > > Among others. > > > Anyone done this? --~--~-~--~~~---~--~~ 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: Quick admin routes question
Gracias hellbot. W On Jul 8, 7:17 am, Hellbot <[EMAIL PROTECTED]> wrote: > Router::connect('/admin/', array(CAKE_ADMIN => true, 'controller' => > 'photos', 'action' => 'index')); > > 2007/7/8, [EMAIL PROTECTED] <[EMAIL PROTECTED]>: > > > I need to route '/admin' to '/admin/photos/index' in my routes table. > > Is this possible? I'm using CakePHP admin routes. > > > Router::connect('/admin', array('controller' => 'photos', 'action' > > => > > 'admin_index')); > > > For me, it generates the 'Trying to access private method in class' > > error. I've read the manual and searched the group to find the answer > > but didn't locate it. > > > I also tried: > > > Router::connect('/admin', array('controller' => 'admin/photos', > > 'action' => 'index')); > > > Among others. > > > Anyone done this? --~--~-~--~~~---~--~~ 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 Woes
looks like this problem was caused by the firecake helper, wasted a day b/c of firecake. --~--~-~--~~~---~--~~ 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 Woes
Here is a var_dump of the _SESSION variable at the very beginning of script processing. 1st request array(2) { ["Config"]=> &array(3) { ["rand"]=> int(377719362) ["time"]=> int(1175658289) ["userAgent"]=> string(32) "64892a71614760306f6c52f1cb727cca" } ["partner"]=> &array(6) { ["id"]=> string(5) "11429" ["created"]=> string(19) "2007-04-25 10:00:00" ["modified"]=> string(19) "2007-04-28 10:00:00" ["name"]=> string(12) "Kerry Wilson" ["email"]=> string(17) "[EMAIL PROTECTED]" ["password"]=> string(32) "d1e96978c6935ec01d995b1b8e4d8c33" } } 2nd request array(2) { ["Config"]=> &string(92) ""Config":{"rand":377719362,"time": 1175658290,"userAgent":"64892a71614760306f6c52f1cb727cca"}" ["partner"]=> &string(183) ""partner":{"id":11429,"created":"2007-04-25 10:00:00","modified":"2007-04-28 10:00:00","name":"Kerry Wilson","email":"[EMAIL PROTECTED]","password":"d1e96978c6935ec01d995b1b8e4d8c33"}" } 3rd request array(1) { ["Config"]=> &string(93) ""Config":{"rand":2084398870,"time": 1175658300,"userAgent":"64892a71614760306f6c52f1cb727cca"}" } It looks like the data is being stored differently ( converted ) on every request or something --~--~-~--~~~---~--~~ 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 Woes
I am having problems maintaining a session. It seems the domain object I place into session is dropped after a single request ( similar to flash scope )... Login Post Valid ( adds partner to session ) > Renders flash redirect message > Shows homepage When I am on the home page the partner is still in session ( using firecake for debugging ). However, if I refresh the homepage partner is dropped from session. Config values still the same. [code] // In login controller $this->Session->write('partner',$partner["Partner"]); $this->flash('You have successfully logged in.',$homepage); [/code] [code] // in home controller view ( action is empty method ) read('partner.email'); ?> [/code] Is this something people have experienced? Also, session->read method is not working properly for me, ( it always return a quotation mark, when the value exists in session ). Again, I have verified it is in session using firecake. help --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---