Issues (65)

src/Relation/AbstractRelation.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace HexMakina\Crudites\Relation;
4
5
use HexMakina\BlackBox\Database\ConnectionInterface;
6
use HexMakina\BlackBox\Database\TableInterface;
7
use HexMakina\Crudites\Crudites;
8
use HexMakina\Crudites\Table\Table;
0 ignored issues
show
The type HexMakina\Crudites\Table\Table was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
10
abstract class AbstractRelation
11
{
12
    protected ConnectionInterface $connection;
13
14
    protected $primary_table;
15
    protected $primary_col;
16
17
    protected $secondary_table;
18
    protected $secondary_col;
19
20
    public const NAME='ABSTRACT_RELATION';
21
22
    
23
    public function __debugInfo()
24
    {
25
        return [
26
            'primary_table' => $this->primary_table,
27
            'primary_col' => $this->primary_col,
28
            'secondary_table' => $this->secondary_table,
29
            'secondary_col' => $this->secondary_col,
30
        ];
31
    }
32
33
    
34
    public function __toString()
35
    {
36
        return $this->nss();
37
    }
38
    
39
    public function nss()
40
    {
41
        return sprintf('%s-%s-%s', $this->primary_table, static::NAME, $this->secondary_table);
42
    }
43
44
    public function setConnection(ConnectionInterface $c)
45
    {
46
        $this->connection = $c;
47
    }
48
49
    public function source(){
50
        return $this->primary_table;
51
    }
52
53
    public function target(){
54
        return $this->secondary_table;
55
    }
56
57
    abstract public function link(int $primary_id, $mixed_id);
58
    abstract public function unlink(int $primary_id, $mixed_id);
59
}