# |
Jul 20th 2009, 15:31 |
ADmad |
screw them.. |
# |
Jul 20th 2009, 15:30 |
alkemann |
but then i think i will leave my code in for backwards compability for now. as there are enough people out there using it, but it would be more effective to ignore the setting and set 'enabled' false |
# |
Jul 20th 2009, 15:29 |
ADmad |
there must an eg |
# |
Jul 20th 2009, 15:29 |
alkemann |
ok |
# |
Jul 20th 2009, 15:29 |
ADmad |
check the test cases |
# |
Jul 20th 2009, 15:28 |
ADmad |
https://trac.cakephp.org/browser/branches/1.2.x.x/cake/libs/model/behavior.php#L330 |
# |
Jul 20th 2009, 15:28 |
ADmad |
as i said you set 'enabled'=>false in config array of actsAs.. it has same effect as calling disable() |
# |
Jul 20th 2009, 15:27 |
alkemann |
but where to place that disable() if u want it always? |
# |
Jul 20th 2009, 15:27 |
ADmad |
atleast i think so |
# |
Jul 20th 2009, 15:27 |
ADmad |
actually yes.. instead of your usage of 'auto' everything can be achieved with enable()/disable() |
# |
Jul 20th 2009, 15:26 |
ADmad |
not exactly.. the BehaviorCollection::attach checks if 'enabled' key is false and disables the behavior.. dont think it has any relation with 'enabled' member var of a behavior |
# |
Jul 20th 2009, 15:26 |
alkemann |
or are you saying that somehow that would have the same effect? |
# |
Jul 20th 2009, 15:24 |
alkemann |
so just a name change? |
# |
Jul 20th 2009, 15:24 |
ADmad |
so 'enabled' => false in config array |
# |
Jul 20th 2009, 15:22 |
alkemann |
makes more sense to me to disable automatic behavior in the actsAs than to implement model constructor to disable it |
# |
Jul 20th 2009, 15:22 |
ADmad |
yes.. disable() just turns off callbakc.. all rest functions are accessible |
# |
Jul 20th 2009, 15:22 |
alkemann |
1. where would u permantently disable it? 2. will the methods you call work if it is disable? |
# |
Jul 20th 2009, 15:21 |
ADmad |
but from what i understand it achieves the same purpose.. you have $this->settings[$Model->alias]['auto'] === false check at beginning of all callbacks |
# |
Jul 20th 2009, 15:20 |
alkemann |
so that auto setting is just suppose to be set at init |
# |
Jul 20th 2009, 15:19 |
alkemann |
wouldnt make sense to add a behaviour and permanently disable it |
# |
Jul 20th 2009, 15:19 |
alkemann |
it's not about disabling it, it's about permanent setting for not automatically creating revisions |
# |
Jul 20th 2009, 15:18 |
alkemann |
auto isnt meant to be used how i was using it. |
# |
Jul 20th 2009, 15:18 |
ADmad |
you should be able to get rid of 'auto' use in most places |
# |
Jul 20th 2009, 15:18 |
alkemann |
what about it? |
# |
Jul 20th 2009, 15:17 |
ADmad |
*and |
# |
Jul 20th 2009, 15:17 |
ADmad |
now go an cleanup your behavior itself :P |
# |
Jul 20th 2009, 15:17 |
alkemann |
http://thechaw.com/bakery/commits/view/17384eff18cdac76055877fa6891abd9416c6267 |
# |
Jul 20th 2009, 15:14 |
ADmad |
yup |
# |
Jul 20th 2009, 15:14 |
alkemann |
enable() too? |
# |
Jul 20th 2009, 15:14 |
ADmad |
) |
# |
Jul 20th 2009, 15:14 |
alkemann |
that works :) |
# |
Jul 20th 2009, 15:14 |
ADmad |
$this->ArticlePage->Behaviors->disable('Revision') |
# |
Jul 20th 2009, 15:13 |
alkemann |
undefined method |
# |
Jul 20th 2009, 15:13 |
ADmad |
try calling disable() https://trac.cakephp.org/browser/branches/1.2.x.x/cake/libs/model/behavior.php#L371 |
# |
Jul 20th 2009, 15:12 |
ADmad |
https://trac.cakephp.org/browser/branches/1.2.x.x/cake/libs/model/behavior.php#L453 |
# |
Jul 20th 2009, 15:11 |
alkemann |
u sure that isnt something that people build into their behaviors? |
# |
Jul 20th 2009, 15:11 |
ADmad |
yup |
# |
Jul 20th 2009, 15:11 |
alkemann |
$this->ArticlePage->Behaviors->Revision->enabled = false; right? |
# |
Jul 20th 2009, 15:11 |
alkemann |
did not work * |
# |
Jul 20th 2009, 15:11 |
alkemann |
ADmad: did work |
# |
Jul 20th 2009, 15:10 |
alkemann |
interesting.. |