public function changeItem($oldTitle, $newTitle, $href, $parentId, $regularLink = false)
{
$menuItem = MenuItem::model()->findByAttributes(['title' => $oldTitle]);
if ($menuItem === null) {
return $this->addItem($newTitle, $href, $parentId, $regularLink);
}
$menuItem->parent_id = (int) $parentId;
$menuItem->menu_id = $this->id;
$menuItem->title = $newTitle;
$menuItem->href = $href;
$menuItem->regular_link = $regularLink;
if ($menuItem->save()) {
Yii::app()->getCache()->clear(['menu', $this->code]);
return true;
}
return false;
}