method move documentation in bbn\Appui\Option

Changes the id_parent of an option

Example

X::dump($this->getIdParent(21)); // (int) 13 X::dump($this->move(21, 12)); // (int) 1 X::dump($this->getIdParent(21)); // (int) 12 function($id, $id_parent) { $res = null; if (($o = $this->option($id)) && ($target = $this->option($id_parent)) ) { $upd = [$this->fields['id_parent'] => $id_parent]; if ($this->isSortable($id_parent)) { $upd[$this->fields['num']] = empty($target['num_children']) ? 1 : $target['num_children'] + 1; } $res = $this->db->update( $this->class_cfg['table'], $upd, [ $this->fields['id'] => $id ] ); $this->deleteCache($id_parent); $this->deleteCache($id); $this->deleteCache($o[$this->fields['id_parent']]); } return $res; }

Changes the id_parent of an option BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way

This website uses cookies to ensure you get the best experience on our website.