예제 #1
0
 protected function doUpdateObject($values)
 {
     if (isset($values['parent_id'])) {
         if (!dmDb::query('DmPage p')->where('p.id = ?', $values['parent_id'])->exists()) {
             throw new dmException('Move page to unknown parent ' . $values['parent_id']);
         }
         if ($values['parent_id'] != $this->object->getNodeParentId()) {
             $this->object->getNode()->moveAsLastChildOf(dmDb::table('DmPage')->find($values['parent_id']));
         }
     }
     $this->object->PageView->dmLayoutId = $values['dm_layout_id'];
     parent::doUpdateObject($values);
 }
예제 #2
0
 protected function doUpdateObject($values)
 {
     $parent = dmDb::table('DmPage')->find($values['parent_id']);
     if (!$parent instanceof DmPage) {
         throw new dmException('Create page with unknown parent ' . $values['parent_id']);
     }
     parent::doUpdateObject($values);
     $this->object->module = $parent->module;
     $action = dmString::modulize(str_replace('-', '_', dmString::slugify($values['name'])));
     if (dmDb::query('DmPage p')->where('p.module = ? AND p.action = ?', array($this->object->module, $action))->exists()) {
         $iterator = 2;
         while (dmDb::query('DmPage p')->where('p.module = ? AND p.action = ?', array($this->object->module, $action . $iterator))->exists()) {
             $iterator++;
         }
         $action .= $iterator;
     }
     $this->object->action = $action;
     $this->object->title = $this->object->name;
     $this->object->Node->insertAsLastChildOf($parent);
     $this->object->PageView->Layout = dmDb::table('DmLayout')->find($values['dm_layout_id']);
     $this->object->PageView->save();
     $this->object->save();
 }