Yeah thats where im stuck is with the id....no matter what all I get is $Profile is undefined object or other error. I tried setting the profile id in the controller debug in behaviour and I just cant get anything.
So I don’t know... Keep trying I guess -----Original Message----- From: Anthony [mailto:[email protected]] Sent: October-13-10 11:04 AM To: CakePHP Subject: Re: AutoUpdate Modified Component / Behavior I don't know much about behaviors but they seem pretty straight forward, it looks like you can use some call back functions in the behavior to automatically update the profile. You would just need to attach it to any of the related models you want to update the profile field. http://book.cakephp.org/view/1641/Creating-a-behavior-callback As far as getting the id's that part I'm not too sure about and don't have a sandbox to take a look but what I would do is setup the behavior and attach it to a model you should be able to use debug to figure out what variables are available to you. On Oct 12, 1:06 pm, "Dave Maharaj" <[email protected]> wrote: > I currently have that setup in the model aftersave but with 30+ related > models it’s a real pain in the ass as you can imagine. I figured a behaviour > would be the best idea so I am trying but cant get it to save. > > So that’s where I am. > > Not much info on behaviours...do I save in the behaviour itself? How do I > get the ID? Is it found automagicaly thru the "has" relationships? > > So I will keep at it. > > Thanks. > > Dave > > -----Original Message----- > From: Anthony [mailto:[email protected]] > Sent: October-12-10 3:33 PM > To: CakePHP > Subject: Re: AutoUpdate Modified Component / Behavior > > I haven't done much with the beforeSave, afterSave, etc functions but > I would look into adding a section to afterSave on your related models > that touches the profile its related too. > > On Oct 12, 11:50 am, "Dave Maharaj" <[email protected]> wrote: > > A Profile has a bunch of hasMany relations. Now when viewing the Profile I > > have Last Modified nothing crazy there. > > > What would be the best way to update the Profile['modified'] field when a > > change is made to a hasMany related table so it updates? So if Friend ( > > Profile hasMany Friend ) gets a new record added / deleted / edited it > > modifies the Profile['modidied'] field also? > > > Thanks > > > Dave > > Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 [email protected] > To unsubscribe from this group, send email to > [email protected] For more options, visit this group athttp://groups.google.com/group/cake-php?hl=en > > Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] 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 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 [email protected] 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
