original_string: public function insertTable($meta, $query)
      {
          $meta = $meta instanceof Meta ? $meta : $this->mapper->getMeta($meta);
          if (!$meta->canInsert) {
              throw new Exception("Class {$meta->class} prohibits insert");
          }
  
          $query = $query instanceof Query\Insert ? $query : new Query\Insert(['values'=>$query]);
          $query->values = $this->mapper->mapPropertiesToRow($meta, $query->values);
          if (!$query->table) {
              $query->table = $meta->table;
          }
  
          list ($sql, $params) = $query->buildQuery($meta);
          // no need to formatParams here - they're already field names
  
          $stmt = $this->getConnector()->prepare($sql);
          $stmt->execute($params);
          $lastInsertId = $this->getConnector()->lastInsertId();
          return $lastInsertId;
      }
code: public function insertTable($meta, $query)
      {
          $meta = $meta instanceof Meta ? $meta : $this->mapper->getMeta($meta);
          if (!$meta->canInsert) {
              throw new Exception("Class {$meta->class} prohibits insert");
          }
  
          $query = $query instanceof Query\Insert ? $query : new Query\Insert(['values'=>$query]);
          $query->values = $this->mapper->mapPropertiesToRow($meta, $query->values);
          if (!$query->table) {
              $query->table = $meta->table;
          }
  
          list ($sql, $params) = $query->buildQuery($meta);
          // no need to formatParams here - they're already field names
  
          $stmt = $this->getConnector()->prepare($sql);
          $stmt->execute($params);
          $lastInsertId = $this->getConnector()->lastInsertId();
          return $lastInsertId;
      }
code_tokens: public function insertTable ( $ meta , $ query ) { $ meta = $ meta instanceof Meta ? $ meta : $ this -> mapper -> getMeta ( $ meta ) ; if ( ! $ meta -> canInsert ) { throw new Exception ( "Class {$meta->class} prohibits insert" ) ; } $ query = $ query instanceof Query \ Insert ? $ query : new Query \ Insert ( [ 'values' => $ query ] ) ; $ query -> values = $ this -> mapper -> mapPropertiesToRow ( $ meta , $ query -> values ) ; if ( ! $ query -> table ) { $ query -> table = $ meta -> table ; } list ( $ sql , $ params ) = $ query -> buildQuery ( $ meta ) ; // no need to formatParams here - they're already field names $ stmt = $ this -> getConnector ( ) -> prepare ( $ sql ) ; $ stmt -> execute ( $ params ) ; $ lastInsertId = $ this -> getConnector ( ) -> lastInsertId ( ) ; return $ lastInsertId ; }
docstring: Insert values into a table
  
  insertTable ( $meta , array $propertyValues );
  insertTable ( $meta , Query\Insert $query );
  
  - $meta can be an instance of Amiss\Meta or a class name.
  - $propertyValues keys must exist in the corresponding Meta.
  
  @return int|null
docstring_tokens: Insert values into a table