original_string: public function insert($entity)
      {
          $values = $this->getInsertValues($entity, $this->namingContention);
          $keyString = implode(array_keys($values), ', ');
          $questionMarkString = count($values) === 0 ? '' : ('?' . str_repeat(', ?', count($values) - 1));
  
          $sql = "INSERT INTO $this->tableName ($keyString) VALUES ($questionMarkString)";
          $sth = $this->pdo->prepare($sql);
          $sth->execute(array_values($values));
          $id = $this->pdo->lastInsertId();
  
          if ($this->idProperty !== null) {
              $this->idProperty->setValue($entity, $id);
          }
  
          return $id;
      }
code: public function insert($entity)
      {
          $values = $this->getInsertValues($entity, $this->namingContention);
          $keyString = implode(array_keys($values), ', ');
          $questionMarkString = count($values) === 0 ? '' : ('?' . str_repeat(', ?', count($values) - 1));
  
          $sql = "INSERT INTO $this->tableName ($keyString) VALUES ($questionMarkString)";
          $sth = $this->pdo->prepare($sql);
          $sth->execute(array_values($values));
          $id = $this->pdo->lastInsertId();
  
          if ($this->idProperty !== null) {
              $this->idProperty->setValue($entity, $id);
          }
  
          return $id;
      }
code_tokens: public function insert ( $ entity ) { $ values = $ this -> getInsertValues ( $ entity , $ this -> namingContention ) ; $ keyString = implode ( array_keys ( $ values ) , ', ' ) ; $ questionMarkString = count ( $ values ) === 0 ? '' : ( '?' . str_repeat ( ', ?' , count ( $ values ) - 1 ) ) ; $ sql = "INSERT INTO $this->tableName ($keyString) VALUES ($questionMarkString)" ; $ sth = $ this -> pdo -> prepare ( $ sql ) ; $ sth -> execute ( array_values ( $ values ) ) ; $ id = $ this -> pdo -> lastInsertId ( ) ; if ( $ this -> idProperty !== null ) { $ this -> idProperty -> setValue ( $ entity , $ id ) ; } return $ id ; }
docstring: Insert an entity into the database.
  You can optionally provide a property name. If you do the inserted id will be assigned to that property.
  @param $entity
  @return integer the id of the row that was inserted
docstring_tokens: Insert an entity into the database . You can optionally provide a property name . If you do the inserted id will be assigned to that property .