Skip to content

Commit

Permalink
[fix] execution of queries
Browse files Browse the repository at this point in the history
  • Loading branch information
georgehristov committed Oct 30, 2020
1 parent dbd22ee commit 1e313dc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Persistence/Sql.php
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ public function lastInsertId(Model $model): string
$query = $this->connection->dsql()->table($model->table);
$query->field($query->expr('max({id_col})', ['id_col' => $model->id_field]), 'max_id');

return $query->getOne();
return (string) $query->getOne();
}

return $this->connection->lastInsertId($this->getIdSequenceName($model));
Expand Down
5 changes: 5 additions & 0 deletions src/Persistence/Sql/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,11 @@ protected function doGetOne()
return $this->dsql->getOne();
}

public function getIterator(): iterable
{
return $this->dsql->getIterator();
}

public function getDsqlExpression($expression = null)
{
return $this->dsql;
Expand Down
2 changes: 1 addition & 1 deletion tests/ExpressionSqlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public function testExpressions()
} elseif ($this->getDatabasePlatform() instanceof OraclePlatform) {
$this->assertSame(
'select "id","name","surname","cached_name",("name" || \' \' || "surname") "full_name" from "user" where (("name" || \' \' || "surname") != "cached_name")',
$m->action('select')->render()
$m->toQuery()->select()->render()
);
} elseif ($this->getDatabasePlatform() instanceof MySQLPlatform) {
$this->assertSame(
Expand Down

0 comments on commit 1e313dc

Please sign in to comment.