original_string: public function update($entity)
      {
          if ($this->idProperty === null) {
              throw new ConfigurationException('No idProperty set');
          }
  
          $id = $this->idProperty->getValue($entity);
  
          if ($id === null) {
              throw new ConfigurationException('Value of ' . $this->idProperty->getName() . ' is null');
          }
  
          $values = $this->getInsertValues($entity, $this->namingContention);
          $keyString = implode(array_keys($values), ' = ?,') . ' = ?';
          $idColumn = $this->namingContention->propertyToColumnName($this->idProperty);
          $onlyValues = array_values($values);
          $onlyValues[] = $id;
  
          $sql = "UPDATE $this->tableName SET $keyString WHERE $idColumn = ?";
          $sth = $this->pdo->prepare($sql);
          $sth->execute($onlyValues);
          return $id;
      }
code: public function update($entity)
      {
          if ($this->idProperty === null) {
              throw new ConfigurationException('No idProperty set');
          }
  
          $id = $this->idProperty->getValue($entity);
  
          if ($id === null) {
              throw new ConfigurationException('Value of ' . $this->idProperty->getName() . ' is null');
          }
  
          $values = $this->getInsertValues($entity, $this->namingContention);
          $keyString = implode(array_keys($values), ' = ?,') . ' = ?';
          $idColumn = $this->namingContention->propertyToColumnName($this->idProperty);
          $onlyValues = array_values($values);
          $onlyValues[] = $id;
  
          $sql = "UPDATE $this->tableName SET $keyString WHERE $idColumn = ?";
          $sth = $this->pdo->prepare($sql);
          $sth->execute($onlyValues);
          return $id;
      }
code_tokens: public function update ( $ entity ) { if ( $ this -> idProperty === null ) { throw new ConfigurationException ( 'No idProperty set' ) ; } $ id = $ this -> idProperty -> getValue ( $ entity ) ; if ( $ id === null ) { throw new ConfigurationException ( 'Value of ' . $ this -> idProperty -> getName ( ) . ' is null' ) ; } $ values = $ this -> getInsertValues ( $ entity , $ this -> namingContention ) ; $ keyString = implode ( array_keys ( $ values ) , ' = ?,' ) . ' = ?' ; $ idColumn = $ this -> namingContention -> propertyToColumnName ( $ this -> idProperty ) ; $ onlyValues = array_values ( $ values ) ; $ onlyValues [ ] = $ id ; $ sql = "UPDATE $this->tableName SET $keyString WHERE $idColumn = ?" ; $ sth = $ this -> pdo -> prepare ( $ sql ) ; $ sth -> execute ( $ onlyValues ) ; return $ id ; }
docstring: Update an existing entity in the database.
  @param mixed $entity the entity
  @return int the id of the entity
  @throws ConfigurationException if no idProperty was set
docstring_tokens: Update an existing entity in the database .