add(new BoolCast(['unrestricted'])); $behaviors->add(new MillisecondTimestamp(['ctime', 'mtime'])); } public function createRelations(Relations $relations): void { $relations->belongsTo('parent', self::class) ->setCandidateKey('parent_id') ->setJoinType('LEFT'); $relations->hasMany('children', self::class) ->setForeignKey('parent_id') ->setJoinType('LEFT'); $relations->hasMany('users', RoleUser::class) ->setForeignKey('role_id') ->setJoinType('LEFT'); $relations->hasMany('groups', RoleGroup::class) ->setForeignKey('role_id') ->setJoinType('LEFT'); $relations->hasMany('permissions', RolePermission::class) ->setForeignKey('role_id') ->setJoinType('LEFT'); $relations->hasMany('restrictions', RoleRestriction::class) ->setForeignKey('role_id') ->setJoinType('LEFT'); } }