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

tempestphp / tempest-framework / 14104357584

27 Mar 2025 10:27AM UTC coverage: 79.581% (+0.2%) from 79.334%
14104357584

Pull #1076

github

web-flow
Merge 476693e50 into 6af05d563
Pull Request #1076: refactor(database): remove `DatabaseModel` interface

471 of 480 new or added lines in 34 files covered. (98.13%)

1 existing line in 1 file now uncovered.

10679 of 13419 relevant lines covered (79.58%)

92.77 hits per line

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

89.47
/src/Tempest/Database/src/Builder/QueryBuilders/DeleteQueryBuilder.php
1
<?php
2

3
namespace Tempest\Database\Builder\QueryBuilders;
4

5
use Tempest\Database\Builder\ModelDefinition;
6
use Tempest\Database\Builder\TableDefinition;
7
use Tempest\Database\Query;
8
use Tempest\Database\QueryStatements\DeleteStatement;
9
use Tempest\Database\QueryStatements\WhereStatement;
10

11
/**
12
 * @template TModelClass of object
13
 */
14
final class DeleteQueryBuilder
15
{
16
    private DeleteStatement $delete;
17

18
    private array $bindings = [];
19

20
    public function __construct(
5✔
21
        private string|object $model,
22
    ) {
23
        $table = ModelDefinition::tryFrom($this->model)?->getTableDefinition() ?? new TableDefinition($this->model);
5✔
24
        $this->delete = new DeleteStatement($table);
5✔
25

26
        if (is_object($this->model)) {
5✔
27
            $this->where('`id` = :id', id: $this->model->id);
3✔
28
        }
29
    }
30

NEW
31
    public function execute(): void
×
32
    {
NEW
33
        $this->build()->execute();
×
34
    }
35

36
    public function allowAll(): self
1✔
37
    {
38
        $this->delete->allowAll = true;
1✔
39

40
        return $this;
1✔
41
    }
42

43
    public function where(string $where, mixed ...$bindings): self
4✔
44
    {
45
        $this->delete->where[] = new WhereStatement($where);
4✔
46

47
        $this->bind(...$bindings);
4✔
48

49
        return $this;
4✔
50
    }
51

52
    public function bind(mixed ...$bindings): self
4✔
53
    {
54
        $this->bindings = [...$this->bindings, ...$bindings];
4✔
55

56
        return $this;
4✔
57
    }
58

59
    public function build(): Query
5✔
60
    {
61
        return new Query($this->delete, $this->bindings);
5✔
62
    }
63
}
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