Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
bohanyang committed Sep 11, 2023
1 parent 0f20ad2 commit df4687e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions packages/mango/Doctrine/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -910,6 +910,10 @@ public function where(mixed ...$expressions): self
{
$where = [];
foreach ($expressions as $matchColumn => $expression) {
if ($expression === null) {
continue;
}

if (is_string($matchColumn)) {
if (is_array($expression)) {
$expression = $this->in($matchColumn, $expression);
Expand Down
7 changes: 7 additions & 0 deletions packages/mango/Doctrine/SchemaProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use Throwable;
use UnexpectedValueException;

use function array_keys;
use function array_map;
use function array_merge;
use function implode;
Expand Down Expand Up @@ -219,4 +220,10 @@ public function onConflictDoUpdate(Query $insert, array $conflict, array $update

return $rowNum;
}

public function upsertLock(string $table, array $data): void
{
$q = $this->createQuery();
$this->onConflictDoUpdate($q->insert($table, $data), array_keys($data), $data);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace Mango\Scheduler\Doctrine\Table;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Types\Types;
use Mango\Doctrine\Schema\TableBuilder;
use Mango\Doctrine\Table;
Expand Down

0 comments on commit df4687e

Please sign in to comment.