Issues (90)

src/database/Query.php (1 issue)

Labels
Severity
1
<?php
2
namespace yentu\database;
3
4
class Query extends DatabaseItem implements Commitable, Initializable
5
{
6
    private string $query;
7
    private array $bindData;
8
    private array $queryData;
9
10
    
11
    public function __construct(string $query, array $bindData = []) 
12
    {
13
        $this->query = $query;
14
        $this->bindData = $bindData;
15
    }
16
    
17
    #[\Override]
18
    public function initialize(): void
19
    {
20
        $this->queryData = [
21
            'query' => $this->query,
22
            'bind' => $this->bindData
23
        ]; 
24
        $this->new = true;
25
    }
26
    
27
    public function rollback(string $query, array $bindData = []): DatabaseItem
28
    {
29
        $this->queryData['rollback_query'] = $query;
30
        $this->queryData['rollback_bind'] = $bindData;
31
        $this->new = true;
32
        return $this;
33
    }
34
35
    #[\Override]
36
    public function commitNew()
37
    {
38
        $this->getChangeLogger()->executeQuery($this->queryData);
0 ignored issues
show
The method executeQuery() does not exist on yentu\ChangeLogger. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

38
        $this->getChangeLogger()->/** @scrutinizer ignore-call */ executeQuery($this->queryData);
Loading history...
39
    }
40
}
41