Код: Выделить всё
public function edit($title, $content, $icon)
{
$this->title = $title;
$this->content = $content;
$this->icon = $icon;
}
public function behaviors()
{
return [
NestedSetsBehavior::class,
];
}
public function transactions()
{
return [
self::SCENARIO_DEFAULT => self::OP_ALL
];
}
Как при edit запретить пересчет lft и rgt?
Сохраняется help в сервисе:
Код: Выделить всё
public function edit($id, HelpForm $form): void
{
$page = $this->pages->get($id);
$page->edit(
$form->title,
$form->content,
$form->icon
);
if (!$page->isRoot()) {
if ($form->parentId !== $page->parent->id) {
$parent = $this->pages->get($form->parentId);
$page->appendTo($parent);
}
}
$this->pages->save($page);
}