original_string: public function write($id, $data)
      {
          if (!$id) {
              return false;
          }
          $expires = time() + $this->_timeout;
          $record = compact('data', 'expires');
          $record[$this->_table->getPrimaryKey()] = $id;
          $result = $this->_table->save(new Entity($record));
  
          return (bool)$result;
      }
code: public function write($id, $data)
      {
          if (!$id) {
              return false;
          }
          $expires = time() + $this->_timeout;
          $record = compact('data', 'expires');
          $record[$this->_table->getPrimaryKey()] = $id;
          $result = $this->_table->save(new Entity($record));
  
          return (bool)$result;
      }
code_tokens: public function write ( $ id , $ data ) { if ( ! $ id ) { return false ; } $ expires = time ( ) + $ this -> _timeout ; $ record = compact ( 'data' , 'expires' ) ; $ record [ $ this -> _table -> getPrimaryKey ( ) ] = $ id ; $ result = $ this -> _table -> save ( new Entity ( $ record ) ) ; return ( bool ) $ result ; }
docstring: Helper function called on write for database sessions.
  
  @param string|int $id ID that uniquely identifies session in database.
  @param mixed $data The data to be saved.
  @return bool True for successful write, false otherwise.
docstring_tokens: Helper function called on write for database sessions .