• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

valkyrjaio / valkyrja / 20156277091

12 Dec 2025 04:26AM UTC coverage: 73.416% (-0.6%) from 74.002%
20156277091

push

github

MelechMizrachi
CI: Trying to fix coveralls.

8125 of 11067 relevant lines covered (73.42%)

17.9 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/Valkyrja/Orm/QueryBuilder/SqlUpdateQueryBuilder.php
1
<?php
2

3
declare(strict_types=1);
4

5
/*
6
 * This file is part of the Valkyrja Framework package.
7
 *
8
 * (c) Melech Mizrachi <melechmizrachi@gmail.com>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13

14
namespace Valkyrja\Orm\QueryBuilder;
15

16
use Override;
17
use Valkyrja\Orm\Constant\Statement;
18
use Valkyrja\Orm\Data\Value;
19
use Valkyrja\Orm\QueryBuilder\Contract\UpdateQueryBuilder;
20

21
/**
22
 * Class SqlUpdateQueryBuilder.
23
 *
24
 * @author Melech Mizrachi
25
 */
26
class SqlUpdateQueryBuilder extends SqlQueryBuilder implements UpdateQueryBuilder
27
{
28
    /** @var Value[] */
29
    protected array $values = [];
30

31
    /**
32
     * @inheritDoc
33
     */
34
    #[Override]
×
35
    public function withSet(Value ...$values): static
36
    {
37
        $new = clone $this;
×
38

39
        $new->values = $values;
×
40

41
        return $new;
×
42
    }
43

44
    /**
45
     * @inheritDoc
46
     */
47
    #[Override]
×
48
    public function withAddedSet(Value ...$values): static
49
    {
50
        $new = clone $this;
×
51

52
        $new->values = array_merge($new->values, $values);
×
53

54
        return $new;
×
55
    }
56

57
    /**
58
     * @inheritDoc
59
     */
60
    public function __toString(): string
×
61
    {
62
        return Statement::UPDATE
×
63
            . " $this->from"
×
64
            . $this->getAliasQuery()
×
65
            . $this->getSetQuery()
×
66
            . $this->getWhereQuery()
×
67
            . $this->getJoinQuery();
×
68
    }
69

70
    /**
71
     * Get the SET part of an INSERT query.
72
     *
73
     * @return string
74
     */
75
    protected function getSetQuery(): string
×
76
    {
77
        $values = [];
×
78

79
        foreach ($this->values as $value) {
×
80
            $values[] = "$value->name = " . ((string) $value);
×
81
        }
82

83
        return Statement::SET . ' ' . implode(', ', $values);
×
84
    }
85
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc