This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
i'm having problem developing octobercms backend. currently i have 2 model :
- User
- UserRole
in the user model, i have afterSave() event :
public function afterSave()
{
$db_role = new UserRole;
$db_role ->unbindEvent( 'model.afterSave' );
$db_role->user_id = $this->id;
$db_role->role_id = 1;
$db_role->save()
}
in the user_role model i have afterSave() event too.
public function afterSave()
{
if( $this->role_id == 1 )
{
$db_user->status = true;
$db_user->save();
}
}
this event forcing my $db_user current status to TRUE;
the problem is i dont want afterSave() event in USER ROLE MODEL to be called when im saving in USER MODEL.
i tried using $this->unbindEvent( 'model.afterSave' ), it didnt work too. Anyone know how to stop octoberCms from calling unnecessary event, or is it other way like saving in Controller ? thanks
Last updated
1-2 of 2