Chg #2665: CBehavior change _attachEventHandlers to protected #2805

Closed
wants to merge 2 commits into
from

3 participants

@KJLJon
Contributor
KJLJon commented Aug 23, 2013

This allows for someone to change the order of attaching events.

Owner
samdark commented Aug 23, 2013

What do you need it for?

Contributor
KJLJon commented Aug 24, 2013

basically explained: #2665

In short:
if you have 2 behaviors attached to a model they always will perform tasks in the order they were attached, but sometimes it is useful to nest the behaviors (example I gave in the link was with a date converting behavior and encryption behavior).

So it takes the user imputed date and converts it to a timestamp and then it encrypts it. When it receives the data it needs to decrypt the data before it converts it to the users formatted date.

The only other way I can think of doing something like this is to have 3 behaviors (decrypt behavior, date converting behavior, encrypt behavior), but I think the encrypt and decrypt behavior should be together because they share a lot of common variables (algo, key, etc.)

Basically it is nice to have the method protected so if someone needs the order of the behaviors to be attached changed they can implement it in their own behavior classes.

Owner
cebe commented Aug 15, 2014

in this case it is better to attach event handles manually not using events() method.

@cebe cebe closed this Aug 15, 2014
@cebe cebe removed this from the 1.1.16 milestone Aug 15, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment