示例#1
0
 /**
  * Insert a row into the rowset
  *
  * The row will be stored by it's identity_column if set or otherwise by
  * it's object handle.
  *
  * @param  object   A KDatabaseRow object to be inserted
  * @return boolean  TRUE on success FALSE on failure
  */
 public function insert(KDatabaseRowInterface $row)
 {
     if (isset($this->_identity_column)) {
         $handle = $row->{$this->_identity_column};
     } else {
         $handle = $row->getHandle();
     }
     if ($handle) {
         $this->_object_set->offsetSet((string) $handle, $row);
     }
     return true;
 }
 /**
  * Add a row in the rowset
  * 
  * Since joomla user group maps at the time being uses 0 as the value of unregistered users,
  * we override this method as Koowa does not allow 0 keys to be inserted
  *
  * @param  object   A KDatabaseRow object to be inserted
  * @return KDatabaseRowsetAbstract
  */
 public function insert(KDatabaseRowInterface $row)
 {
     if (isset($this->_identity_column)) {
         $handle = $row->{$this->_identity_column};
     } else {
         $handle = $row->getHandle();
     }
     $this->_object_set->offsetSet($handle, $row);
     //Add the columns, only if they don't exist yet
     $columns = array_keys($row->toArray());
     foreach ($columns as $column) {
         if (!in_array($column, $this->_columns)) {
             $this->_columns[] = $column;
         }
     }
     return $this;
 }
示例#3
0
 	/**
     * Removes a row
     * 
     * The row will be removed based on it's identity_column if set or otherwise by
     * it's object handle.
     *
     * @param  object   A KDatabaseRow object to be removed
     * @return KDatabaseRowsetAbstract
     */
    public function extract(KDatabaseRowInterface $row)
    {
        if(isset($this->_identity_column)) {
           $handle = $row->{$this->_identity_column};
        } else {
           $handle = $row->getHandle();
        }
        
        if($this->_object_set->offsetExists($handle)) {
           $this->_object_set->offsetUnset($handle);
        }
    
        return $this;
    }