dektrium\rbac\models\AuthItem::init PHP Method

init() public method

public init ( )
    public function init()
    {
        parent::init();
        $this->manager = \Yii::$app->authManager;
        if ($this->item instanceof Item) {
            $this->name = $this->item->name;
            $this->description = $this->item->description;
            $this->children = array_keys($this->manager->getChildren($this->item->name));
            try {
                if (is_object($this->item->data)) {
                    $this->dataCannotBeDecoded = true;
                } else {
                    if ($this->item->data !== null) {
                        $this->data = Json::encode($this->item->data);
                    }
                }
            } catch (InvalidParamException $e) {
                $this->dataCannotBeDecoded = true;
            }
            if ($this->item->ruleName !== null) {
                $this->rule = get_class($this->manager->getRule($this->item->ruleName));
            }
        }
    }