예제 #1
0
 /**
  * Table update method
  *
  * @param  object	A KDatabaseRow object
  * @return boolean  TRUE if successfull, otherwise false
  */
 public function update(KDatabaseRowInterface $row)
 {
     $this->_setLevel($row);
     //This is because we need behavior.nestable to set the right path, before we set the path_sort
     //row->getModified() returns a blank array after parent::update have run
     $modified = $row->getModified();
     $result = parent::update($row);
     $this->_setSort($row, $modified);
     return $result;
 }
예제 #2
0
 /**
  * Table insert method
  *
  * @param  object	A KDatabaseRow object
  * @return boolean  TRUE if successfull, otherwise false
  */
 public function insert(KDatabaseRowAbstract $row)
 {
     $query = $this->_database->getQuery();
     $query->where('tbl.name', '=', $row->name, 'or');
     if ($this->count($query)) {
         $asset = $this->select($query, KDatabase::FETCH_ROW);
         $data = array_merge($asset->getData(), array_filter($row->getData()));
         return parent::update($asset->setData($data));
     }
     return parent::insert($row);
 }