public function save()
    {
    	if($this->exists())
    	{
			// update
			$query = new Query(static::table());
			$query->update($this->getData(), $this->getIdentifyCondition());
			return $query->execute();
    	}
    	else
    	{
    		// insert
			$query = new Query(static::table());
			$query->insert($this->getData());
            if($query->execute())
                $this->from_db = true;
            return $query->success();
    	}
    }
public function save()
    {
    	if($this->exists())
    	{
			// update
			$query = new Query(static::table());
			$query->update($this->getData(), $this->getIdentifyCondition());
			return $query->execute();
    	}
    	else
    	{
    		// insert
			$query = new Query(static::table());
			$query->insert($this->getData());
            if($query->execute())
                $this->from_db = true;
            return $query->success();
    	}
    }
public function save ( ) { if ( $ this -> exists ( ) ) { // update $ query = new Query ( static :: table ( ) ) ; $ query -> update ( $ this -> getData ( ) , $ this -> getIdentifyCondition ( ) ) ; return $ query -> execute ( ) ; } else { // insert $ query = new Query ( static :: table ( ) ) ; $ query -> insert ( $ this -> getData ( ) ) ; if ( $ query -> execute ( ) ) $ this -> from_db = true ; return $ query -> success ( ) ; } }
altrimenti la update
altrimenti la update