Re: Find condition on joined table

2010-10-20 Thread Nancy
The relationship has to be defined in both models. So make sure you define Customers as belonging to Users and Orders belonging to customers. http://book.cakephp.org/view/1039/Associations-Linking-Models-Together#belongsTo-1042 On Oct 18, 8:02 am, Dan wrote: > Hi, > > I am trying out CakePHP on a

Re: Callback parentNode() not defined in Owner

2010-10-10 Thread Nancy
Well not exactly sure why this worked but putting a parentNode() method in my Community model made the error go away. I just copied the one from my user model. *shrug* I wish I understood what the heck I was doing! On Oct 10, 8:23 am, Nancy wrote: > I'm finally braving the waters of

Callback parentNode() not defined in Owner

2010-10-10 Thread Nancy
I'm finally braving the waters of auth/acl. I'm going from the tutorial in the 1.3 cake docs. Here's how I defined it: modesl/user.php class User extends AppModel { var $hasMany = array( 'Owner' => array( 'className' => 'Community', 'foreignKey' => 'owner_id',

Re: tinyint isn't generating a checkbox with form helper

2010-01-21 Thread Nancy
Oh! I think I figured it out. It needs to be tinyint(1), I was using whatever the default was. Doh! On Jan 21, 3:34 pm, Nancy wrote: > I must be doing something wrong.  I have a database field that's a > tinyint and accord to the online doc if I create a form field from it >

tinyint isn't generating a checkbox with form helper

2010-01-21 Thread Nancy
ount}.current"); $count is just a variable being incremented as I step through the data in this relationship. The data shows up on correctly but it just isn't figuring out the right form element to use, unless I specify everything. Any advice is truly appreciated! Nancy Check out the new

Re: Capture views output into a file?

2010-01-13 Thread Nancy
Thanks for the suggestions! Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com T

Capture views output into a file?

2010-01-04 Thread Nancy
I'd like to be able to automatically generate a file from the output of a view. Can anyone point me in the right direction? I don't see any file i/o available to views, maybe I'm just missing it. Thanks! Check out the new CakePHP Questions site http://cakeqs.org and help others with their Cake

Re: Mysteriously inserted

2009-12-05 Thread Nancy
o that was weird too. Something was inserting the before my code actually inserts it. Is it Firefox doing this? I turned off all my addons just to see, no change. A mystery, wrapped in bacon! On Dec 5, 2:25 pm, Nancy wrote: > This formatting happens in a helper and I return the $out

Re: Mysteriously inserted

2009-12-05 Thread Nancy
o that was weird too. Something was inserting the before my code actually inserts it. Is it Firefox doing this? I turned off all my addons just to see, no change. A mystery, wrapped in bacon! On Dec 5, 2:25 pm, Nancy wrote: > This formatting happens in a helper and I return the $out

Re: Mysteriously inserted

2009-12-05 Thread Nancy
This formatting happens in a helper and I return the $out variable and echo it. foreach ($this->data['Resumeitem'] as $ri) { #debug(Sanitize::html($res->formatSection($ri, $count))); echo $res->formatSection($ri,$count); echo "\n\n";

Mysteriously inserted

2009-12-04 Thread Nancy
This has me going nuts. I'm using 1.2.5 and I'm calling a helper that formats some html and returns it to the view. Anyway, in this helper I have some divs. Something in cake is inserting "" in my code because I'm not doing it. Any ideas? Oh yes, I've used Santizie::html to dump out the HTML t

Re: How to copy a deep database hierarchy?

2009-09-19 Thread Nancy
; * load the Recipe with it's Ingredients and Tags from database > * manipulate the data by removing the 'id' information from the models > * pass the manipulated data to the saveAll() method > > Friendly greetings, > Bert > > On Fri, Sep 18, 2009 at 9:16 PM,

How to copy a deep database hierarchy?

2009-09-18 Thread Nancy
onable way to do this? I'm using MySQL. Many thanks! Nancy Simple Example: Recipe -> Ingredients -> Tags Lets say I want to copy the Apple Pie recipe and all it's related records to a new structure but none of the data are sha

Re: Session expiration with "medium" security level -- doesn't happen.

2009-09-14 Thread Nancy
and it works ok now. On Sep 14, 2:38 pm, Nancy wrote: > I've had to switch from high because my ajax calls were mangling > sessions info.  So I switched to medium.  Now it appears no matter > what I do (tried a custom config and all) my session creates a cookie > that expires in

Session expiration with "medium" security level -- doesn't happen.

2009-09-14 Thread Nancy
I've had to switch from high because my ajax calls were mangling sessions info. So I switched to medium. Now it appears no matter what I do (tried a custom config and all) my session creates a cookie that expires in 1 week. When was on high the cookie would expire with the session (i.e. the bro

Re: store array into session

2009-08-31 Thread Nancy
Have you tried it? It does store it as a string but seems to recreate it as an array when you read it back in. At least, I tried it yesterday and it seemed to do the right thing. On Aug 28, 1:31 am, persianshadow wrote: > hi > > i want store array of ids into session but i explore API of cakep

Re: Where do you put code needed in controllers and models?

2009-08-28 Thread Nancy
lers thin and easy to > read. Since your function parses data I would put it into the model > indeed. If you need it in every model/controller, you can add it to > app_model. You could also create a behaviour (the model's equivalent > of a component). > > On 27 aug, 20:57

Re: saveAll with a hasMany relationship

2009-08-27 Thread Nancy
Ok, just caught something in the cakephp online docs: saveAll(array $data = null, array $options = array()) Used to save (a) multiple individual records for a single model or (b) this record, as well as all associated records So perhaps this means I'm just trying to do something that isn't suppo

Where do you put code needed in controllers and models?

2009-08-27 Thread Nancy
Would a component be the right thing to use? For instance, I have a routine that parses data and I need it both in models and controllers. How do you include a component in model? I guess I can always access the model from the controller, so perhaps app_model is a better choice. Any opinions w

Re: saveAll with a hasMany relationship

2009-08-27 Thread Nancy
I guess the looping method isn't a bad solution, I just kept thinking that I must be doing something wrong. The documentation on saveAll is pretty sketchy on details. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "

Re: saveAll with a hasMany relationship

2009-08-27 Thread Nancy
I think maybe the difference between what you and I was doing is that I was trying to save multiple "main" records at one time, whereas you were doing one. $this->data[1]['Recipe']['name'] = 'Delicious apple pie'; $this->data[1]['Recipe']['serves'] = 6; $this->data[1]['Recipe']['valid'] = 1; $thi

Re: Class and Model Naming Problems (wave becomes wafe)

2009-08-24 Thread Nancy
This isn't going to help but I bet maybe it uses the the same rules for waves/wafe as it does for wives/wife. :D On Aug 21, 12:10 pm, JDRopp wrote: > Thanks Marcelo for pointing to the relevant code. > > I decided to change the model, table, and controller names instead. > > I'll submit the defe

Re: saveAll with a hasMany relationship

2009-08-22 Thread Nancy
inlist']['name'] = 'poohbear'; $save['Layer'][0]['layer_id']=4; $save['Layer'][1]['layer_id']=2; $save['Layer'][2]['layer_id']=3; So I can only save one 'Constoptvalue' with it's r

Re: saveAll with a hasMany relationship

2009-08-22 Thread Nancy
does the main data. I wish that I could figure out a way to save ALL the data at once, rather than one row (and associated rows) at a time. It just seems like the way I ended up doing it is rather cheesy. On Aug 21, 2:22 am, Luke wrote: > Hi Nancy, > > I had the same issue lik

Re: saveAll with a hasMany relationship

2009-08-19 Thread Nancy
I just wanted to add, I'm saving multiple records at a time. So $this- >data might have an index going up to 5 or so with models for 3 or more different things. I did manage to get a hasMany to work, but not with multiple records. $save['Firstname']['firstname']='Margarie'; $sav

saveAll with a hasMany relationship

2009-08-19 Thread Nancy
I was so happy. I finally figured out how to make saveAll work with my HABTM relationship so I figured adding a hasMany would be a piece of cake. I have a little practice data structure set up to test it out. $save[1]['Constoptvalue']['device_id'] = 16; $save[1]['Constoptvalue']

Re: Is it an insert or an update?

2009-08-14 Thread Nancy
en the code will execute an update > statement. Otherwise, it'll insert. You don't need to check > beforehand, in other words, since the Cake code will determine from > the data passed whether it should update or insert. > > Nancy wrote: > > MySQL lets you use rep

Is it an insert or an update?

2009-08-13 Thread Nancy
MySQL lets you use replace syntax if you have data and you don't know if it's new or not. Is there anything in Cakephp that'll let you do that? In other words, I don't know if the data I'm putting into my database is brand spanking new or just updated. I'd rather not have to check and just let

Re: Strange association behavior

2009-07-21 Thread Nancy
Sorry, more info to add: It works fine if I do the query through the Layerrule model, but not through the Ruleitem model. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send e

Re: Strange association behavior

2009-07-21 Thread Nancy
I just wanted to add, I don't get any error from the query like I would if I added an unrelated model to the 'contain' array. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, sen

Strange association behavior

2009-07-21 Thread Nancy
I must be missing something... maybe fresh eyes can see the problem. Hopefully! I have a complex set of table associations that looks like this: layers id ruleexceptions id rulevaluetypes id layerrules id layer1_id layer2_id ruleexception_id ruleitem

Re: Beginning CakePHP from Novice to Professional book problem: has anyone read this book?

2009-07-12 Thread Nancy
I bought the book 8 months ago or so and it was already out of date. There weren't all that many errata but the code didn't work with current versions. However, the author has a web site and he was doing a good job of helping folks out with the example code using newer releases of Cakephp. http:

Re: Problem Storing Sessions from Login

2009-07-12 Thread Nancy
You'll want to use some of the session methods: http://book.cakephp.org/view/567/Methods For instance: $userId = $this->Session->read('user.id'); # OR something like that. Or to check to see if it's set: if (! $this->Session->check('user_id')) $this->logon(); Hope that helps. On Jul 11

Re: HATBM returning extra fields

2009-07-12 Thread Nancy
I think that's fine it is using a little too recursive for what you want. You can set recursive to -1 to only get the User table. It's an option you can put in your query or you can set it like this: $this->Model->recursive = -1 There's also a 'behavior' called "Containable" that lets you dete

Ajax question -- Updating multiple divs

2009-06-19 Thread Nancy
Ok, I've got one select list that needs to drive the contents of two other select boxes. I understand how to use observeField and apparently I can update multiple divs. My question is, do I have to do it from only one controller action or can more than one controller be used? It's just weird be

Re: Javascript in Ajax views

2009-06-11 Thread Nancy
Ok, here's what I ended up doing and I think it works. I have this getting loaded in my "main" page. function sethtml(div,content) { var search = content; var script; while( script = search.match(/(]+javascript[^>]+>\s* ()?\s*<\/script>)/))) break; block = search.substr(0, se

Re: Javascript in Ajax views

2009-06-11 Thread Nancy
Ok, I understand that. Thanks for the explanation. So it almost sounds like I need to either have the events external to the tags or else I need some code to evaluate the javascript in the tags (I found a pure javascript example). But where would I put that code? In my main page or inside the Aj

Javascript in Ajax views

2009-06-10 Thread Nancy
Something seems to happen when you have javascript embedded in an ajax rendered view and it is getting me confused! I have this line at the top, it works when I call the view directly, but doesn't seem to do anything when ajax renders the view: link('clearSelect'); ?> I see the alerts when the

Re: Submit/Cancel problem

2009-05-19 Thread Nancy
; In the controller (admin_edit) function, I'm dumping out the contents > > of $this->params['form'] and it always shows > > > Array > > ( > >     [Submit] => submit > > ) > > > Even if you press the cancel button.  Am I doing somet

Re: Submit/Cancel problem

2009-05-19 Thread Nancy
#x27;, 'value'=>$kitid)); echo $this->renderElement('all/btmbuttons'); echo $form->end('purposes'); ?> /* End of views/purposes/add.ctp Code */ Then all/btmbuttons is where the submit/cancel buttons are. /* Bottombtns currently: */ /* End of b

Re: Submit/Cancel problem

2009-05-19 Thread Nancy
Yeah, that's exactly how I started out but every time it only returns the submit. Eventually I hard coded the html just to make sure. On May 19, 1:55 pm, Brett Wilton wrote: > You can use something like this in your view (code snips):- > > >                         echo $form->submit('Save',

Submit/Cancel problem

2009-05-18 Thread Nancy
admin_edit) function, I'm dumping out the contents of $this->params['form'] and it always shows Array ( [Submit] => submit ) Even if you press the cancel button. Am I doing something wrong? Thanks! Nancy --~--~-~--~~~---~--~~ You receiv

Re: How to extend ajax helper?

2009-05-15 Thread Nancy
Great thanks! On May 14, 10:02 pm, Kyo wrote: > Use require_once() before the class statement and it'll do the trick. > > require_once LIBS . 'view'. DS . 'helpers' . DS . 'ajax.php'; > class MyAjaxHelper extends AjaxHelper { > > } > > hth --~--~-~--~~~---~--~~ Yo

How to extend ajax helper?

2009-05-14 Thread Nancy
I found some code which extends the AjaxHelper I dropped it into the app/views/helpers directory and called it myajax.php and it complains: Fatal error: Class 'AjaxHelper' not found in C:\xampp\www\pdkhi\app \views\helpers\myajax.php on line 2 Here's the header at the top: http://groups.google.c

Re: Ajax related question

2009-05-14 Thread Nancy
Oh hmmm... maybe this answers my question... I'm going to have to decipher all the code that got sanitized :p http://cakebaker.42dh.com/2006/06/29/how-to-update-multiple-divs-with-ajax/ On May 14, 10:50 am, Nancy wrote: > This isn't necessarily a Cake question but maybe someone

Re: Ajax related question

2009-05-14 Thread Nancy
of > updating the view. > > setTimeout ( expression, timeout ); > > Add that to the end of the ajax function that updates the views. > Timeout is the amount of time it waits in MS before it runs > expression. > Set expression to the ajax function, and it will update and loop

Ajax related question

2009-05-14 Thread Nancy
This isn't necessarily a Cake question but maybe someone here can give me an idea of how to solve this. I have a display with a lot of individual index views being generated by ajax. Each of these indexes has a ajax links to forms (related to that table) that'll update the DB and then show an up

Re: Append something to the Flash message

2009-05-11 Thread Nancy
What I do is save my messages to an array then do an join and setFlash to the results of that join. array_push($messages,'The Rule Exception has been saved'); $this->Session->setFlash(join('',$messages)); On May 11, 6:10 am, Roman Brunnemann wrote: > Hi, > > short q

Re: Same queries in different controllers

2009-05-07 Thread Nancy
This seems like a good time to say "Doh!". Thanks much. :) On May 6, 6:59 pm, "Dr. Loboto" wrote: > app_model.php > > On May 7, 12:00 am, Nancy wrote: > > > So, this was great but I'm wondering if I can go a bit further with > > this. > >

Re: Same queries in different controllers

2009-05-06 Thread Nancy
So, this was great but I'm wondering if I can go a bit further with this. All these tables have queries that are very similar, so similar that I could use exactly the same code in most of them, like here's an example: [code] function getByKit($type, $id) { $rows = $this->find($type, array

Re: Same queries in different controllers

2009-05-06 Thread Nancy
saying goes. > > On Tue, May 5, 2009 at 7:42 PM, Nancy wrote: > > > I have a bunch of tables that are highly inter-related and I have them > > all being displayed, like an initial index view, from one controller. > > They're getting updated and the index of each ta

Same queries in different controllers

2009-05-05 Thread Nancy
o keep the queries updated in two places, my main overview controller and then in each tables controller. Is there a way to share a query code between controllers? Thanks! Nancy --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Goo

Re: How to define a relationship where you use the same table more than once?

2009-05-04 Thread Nancy
Thanks Miles. I did figure it out. I decided to use whatever defaults "cake bake" came up with and tweaked the model slightly. That helped me figure out how to reference the data in the controller and views too, later on. Boy, cake bake sure is useful! Here's what I ended up with: [code]

How to define a relationship where you use the same table more than once?

2009-05-04 Thread Nancy
I am wondering the proper cake-ified way of doing this. I have "layers" and they're related to other layers and also a thing called a "relationship". So here's the layer table (simplified): Layers = id name Relationships id name Now I need to define how two layers relate to o

Re: Database question, How do I represent a zero in a zero to one relationship?

2009-02-08 Thread Nancy
I'm not exactly sure how to do this in Cake but it sounds like you want a left join, so that if there's no match you'll get back the row but nulls in the unmatched row. With a normal join you'd get nothing back. --~--~-~--~~~---~--~~ You received this message becau

Re: How do I access a HABTM relationship from another model?

2009-01-18 Thread Nancy
ider it, is when you need an absolutely > unrelated model... > Even still... within your action you can load the model just when you > need it... > > $MyModel = ClassRegistry::init('MyModel'); > > or even: > > $someData = ClassRegistry::init('MyModel')->g

Re: Nicer way to make a link to show/hide elements?

2009-01-18 Thread Nancy
Hi Miles! I did look at $ajax->link, fooled around with it for what seemed like hours, and couldn't figure out how to have it just show/hide the div without specifying a url or link to some controller function/view. An example would be great if you've got the code in your fingertips. On Jan 18,

Nicer way to make a link to show/hide elements?

2009-01-18 Thread Nancy
I want to make a simple link to hide or show div's without loading any new URLs. I just couldn't wrap my brain around it and resorted back to calling Prototype functions directly. [code] Search Results [/code] Is there a pretty way to do this in CakePHP? Thanks

Re: How do I access a HABTM relationship from another model?

2009-01-16 Thread Nancy
Thanks for you help, it has gotten me closer. Another thing I figured out is I needed to use the $uses array, which I didn't have. var $uses = array('User','Recipe','Mastercat'); --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Goo

Re: How do I access a HABTM relationship from another model?

2009-01-15 Thread Nancy
I'm getting closer! I have this right now: $mastercats = $this->User->find('all', array('conditions'=>array('User.id' => $id), 'contain' => array( 'Mastercat' => array( 'fields'=>array('id','desc')

Re: How do I access a HABTM relationship from another model?

2009-01-15 Thread Nancy
On Jan 15, 3:32 pm, Miles J wrote: > Set your recursive level to 2/3 and the User association will grab the > categories along with it. Use containable to filter the results. I'm new to cakephp so I'll try to echo back what I think you're saying. In my recipes controller then I'd do something l

How do I access a HABTM relationship from another model?

2009-01-15 Thread Nancy
Hopefully I can explain this adequately. I have 3 models Recipe: belongsTo User Recipe: HaBTM Category User: HaBTM Category (same categories as recipes) User: hasMany Recipe Category: HaBTM User Category: HaBTM Recipe (join tables categories_users and categories_recipes) Everything works g

Re: Select list created from hasOne/belongsTo

2009-01-07 Thread Nancy
Excellent! In all the books/tutorials I read, I don't think a single one mentioned that. :p On Jan 7, 1:58 pm, "Dardo Sordi Bogado" wrote: > http://book.cakephp.org/view/438/displayField > > On Wed, Jan 7, 2009 at 7:55 PM, Nancy wrote: > > > Probably a simple

Select list created from hasOne/belongsTo

2009-01-07 Thread Nancy
Probably a simple question but I haven't been able to find the answer. I have the table Recipes and another Difficulties In recipe model: var $belongsTo = array('Difficulty'); In difficulty model: var $hasMany = array('Recipe'); The scaffolding always display the id number, not the text field

API Documentation Question

2008-12-11 Thread Nancy
y? Thanks! Nancy --~--~-~--~~~---~--~~ 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