yii\rbac\DbManager::updateItem PHP Method

updateItem() protected method

protected updateItem ( $name, $item )
    protected function updateItem($name, $item)
    {
        if ($item->name !== $name && !$this->supportsCascadeUpdate()) {
            $this->db->createCommand()->update($this->itemChildTable, ['parent' => $item->name], ['parent' => $name])->execute();
            $this->db->createCommand()->update($this->itemChildTable, ['child' => $item->name], ['child' => $name])->execute();
            $this->db->createCommand()->update($this->assignmentTable, ['item_name' => $item->name], ['item_name' => $name])->execute();
        }
        $item->updatedAt = time();
        $this->db->createCommand()->update($this->itemTable, ['name' => $item->name, 'description' => $item->description, 'rule_name' => $item->ruleName, 'data' => $item->data === null ? null : serialize($item->data), 'updated_at' => $item->updatedAt], ['name' => $name])->execute();
        $this->invalidateCache();
        return true;
    }

Usage Example

コード例 #1
0
 /**
  * @inheritdoc
  */
 protected function updateItem($name, $item)
 {
     parent::updateItem($name, $item);
     if ($item->name !== $name) {
         $this->_assignments = [];
         $this->_children = null;
         $this->invalidate(self::PART_CHILDREN);
     }
     $this->_items = null;
     $this->invalidate(self::PART_RULES);
     return true;
 }
All Usage Examples Of yii\rbac\DbManager::updateItem