src/Table/Table.php
protected function store($updateNulls=false)
  {
    $row = TableRow::create();
    
    foreach($this->getFields() as $fieldName => $fieldInfos){
      $fieldValue = $this->row->get($fieldName);
      
      switch($fieldInfos->Type){
        case 'bigint':
        case 'mediumint':
        case 'smallint':
        case 'tinyint':
          $fieldValue = (int)$fieldValue;
          break;
        
        case 'datetime':
        case 'timestamp':
          if ( !$fieldValue ){
            $fieldValue = $this->db->getNullDate(true);
          }
          break;
        
        case 'date':
          if ( !$fieldValue ){
            $fieldValue = $this->db->getNullDate(false);
          }
          break;
        
        case 'time':
          if ( !$fieldValue ){
            $fieldValue = '00:00:00';
          }
          break;
      }
      
      $row->set($fieldName, $fieldValue);
    }
    
    if ( $row->get($this->tbl_key) ){
      $ret = $this->db->updateObject($this->tbl, $row, $this->tbl_key, $updateNulls);
    }
    else {
      $ret = $this->db->insertObject($this->tbl, $row, $this->tbl_key);
      $this->row->set($this->tbl_key, (int)$row->get($this->tbl_key));      
    }
    
    if ( $ret ){
      if ( $this->orderingAble() ){
        $this->reorder( $this->getReorderConditions() );
      }
      return true;
    }
    
    return false;
  }
protected function store($updateNulls=false)
  {
    $row = TableRow::create();
    
    foreach($this->getFields() as $fieldName => $fieldInfos){
      $fieldValue = $this->row->get($fieldName);
      
      switch($fieldInfos->Type){
        case 'bigint':
        case 'mediumint':
        case 'smallint':
        case 'tinyint':
          $fieldValue = (int)$fieldValue;
          break;
        
        case 'datetime':
        case 'timestamp':
          if ( !$fieldValue ){
            $fieldValue = $this->db->getNullDate(true);
          }
          break;
        
        case 'date':
          if ( !$fieldValue ){
            $fieldValue = $this->db->getNullDate(false);
          }
          break;
        
        case 'time':
          if ( !$fieldValue ){
            $fieldValue = '00:00:00';
          }
          break;
      }
      
      $row->set($fieldName, $fieldValue);
    }
    
    if ( $row->get($this->tbl_key) ){
      $ret = $this->db->updateObject($this->tbl, $row, $this->tbl_key, $updateNulls);
    }
    else {
      $ret = $this->db->insertObject($this->tbl, $row, $this->tbl_key);
      $this->row->set($this->tbl_key, (int)$row->get($this->tbl_key));      
    }
    
    if ( $ret ){
      if ( $this->orderingAble() ){
        $this->reorder( $this->getReorderConditions() );
      }
      return true;
    }
    
    return false;
  }
protected function store ( $ updateNulls = false ) { $ row = TableRow :: create ( ) ; foreach ( $ this -> getFields ( ) as $ fieldName => $ fieldInfos ) { $ fieldValue = $ this -> row -> get ( $ fieldName ) ; switch ( $ fieldInfos -> Type ) { case 'bigint' : case 'mediumint' : case 'smallint' : case 'tinyint' : $ fieldValue = ( int ) $ fieldValue ; break ; case 'datetime' : case 'timestamp' : if ( ! $ fieldValue ) { $ fieldValue = $ this -> db -> getNullDate ( true ) ; } break ; case 'date' : if ( ! $ fieldValue ) { $ fieldValue = $ this -> db -> getNullDate ( false ) ; } break ; case 'time' : if ( ! $ fieldValue ) { $ fieldValue = '00:00:00' ; } break ; } $ row -> set ( $ fieldName , $ fieldValue ) ; } if ( $ row -> get ( $ this -> tbl_key ) ) { $ ret = $ this -> db -> updateObject ( $ this -> tbl , $ row , $ this -> tbl_key , $ updateNulls ) ; } else { $ ret = $ this -> db -> insertObject ( $ this -> tbl , $ row , $ this -> tbl_key ) ; $ this -> row -> set ( $ this -> tbl_key , ( int ) $ row -> get ( $ this -> tbl_key ) ) ; } if ( $ ret ) { if ( $ this -> orderingAble ( ) ) { $ this -> reorder ( $ this -> getReorderConditions ( ) ) ; } return true ; } return false ; }
Store the record

@param  bool  $updateNulls    True to update properties that are null
@return bool  True if the record was successfully stored.
Store the record