/** * Insert an array of values into the database table and return the ID. * * @param array $values * @param string $sequence * @return int */ public function insert_get_id($values, $sequence = null) { $sql = $this->grammar->insert($this, $values); $this->connection->statement($sql, array_values($values)); // Some database systems (Postgres) require a sequence name to be // given when retrieving the auto-incrementing ID, so we'll pass // the given sequence into the method just in case. return (int) $this->connection->pdo->lastInsertId($sequence); }