Example #1
0
 public function save()
 {
     $this->modified = time();
     if (!$this->getId()) {
         $this->created = $this->modified;
     }
     parent::save();
 }
Example #2
0
 public function isAfter(Model_Ordered $target)
 {
     return $target->order < $this->order or $target->order == $this->order and $target->getId() < $this->getId();
 }
Example #3
0
File: Tree.php Project: kstep/pnut
 public function remove($recursive = false)
 {
     if ($recursive) {
         $children = $this->getDescendantsId();
         $this->_db->delete($this->_table, array($this->_pk => $children));
         parent::remove();
     } else {
         $children = $this->getChildren();
         if (count($children)) {
             throw new Model_Exception("Can't remove non-leaf tree item");
         } else {
             parent::remove();
         }
     }
 }