Re: unbind a behavior / ActsAs

2007-11-11 Thread AD7six



On Nov 11, 7:49 pm, Zoltan [EMAIL PROTECTED] wrote:
 I'm doing a save on a model inside a controller to update one field,
 however it is triggering a behavior attached to that model. Is there a
 way to temporarily (like unbind) disable this ActAs so it isn't
 called.

 Zoltanwww.yyztech.ca

https://trac.cakephp.org/browser/branches/1.2.x.x/cake/libs/model/behaviors/tree.php?rev=5912#L123

and put something like:

function enableNameOfBehavior($model, $enable = null) {
if ($enable !== null) {
$this-settings[$model-name]['enabled'] = $enable;
}
return $this-settings[$model-name]['enabled'];
}

in your behavior such that you have a means to edit this parameter.

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: unbind a behavior / ActsAs

2007-11-11 Thread francky06l

There is also something about this there :

http://www.sanisoft.com/blog/2007/06/26/attach-detach-behaviors-at-run-time-in-cakephp-models/


On Nov 11, 8:58 pm, AD7six [EMAIL PROTECTED] wrote:
 On Nov 11, 7:49 pm, Zoltan [EMAIL PROTECTED] wrote:

  I'm doing a save on a model inside a controller to update one field,
  however it is triggering a behavior attached to that model. Is there a
  way to temporarily (like unbind) disable this ActAs so it isn't
  called.

  Zoltanwww.yyztech.ca

 https://trac.cakephp.org/browser/branches/1.2.x.x/cake/libs/model/beh...

 and put something like:

 function enableNameOfBehavior($model, $enable = null) {
 if ($enable !== null) {
 $this-settings[$model-name]['enabled'] = $enable;
 }
 return $this-settings[$model-name]['enabled'];
 }

 in your behavior such that you have a means to edit this parameter.

 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
-~--~~~~--~~--~--~---