Issues (590)

bench/Query/JoinBench.php (4 issues)

Labels
1
<?php
2
3
namespace Bdf\Prime\Query;
4
5
require_once __DIR__ . '/../_files/BenchData.php';
6
7
use Bdf\Prime\Bench\BenchData;
8
use Bdf\Prime\Bench\User as BenchUser;
9
use Bdf\Prime\Cache\ArrayCache;
10
use Bdf\Prime\Connection\ConnectionConfig;
0 ignored issues
show
The type Bdf\Prime\Connection\ConnectionConfig 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...
11
use Bdf\Prime\ConnectionManager;
12
use Bdf\Prime\Locatorizable;
13
use Bdf\Prime\Repository\EntityRepository;
14
use Bdf\Prime\ServiceLocator;
15
use Bdf\Prime\Types\ArrayType;
16
17
/**
18
 * Bench query generation with dynamic join
19
 * @Revs(10)
20
 */
21
class JoinBench extends \BenchCaseAdapter
22
{
23
    /**
24
     * @var ServiceLocator
25
     */
26
    protected $prime;
27
28
    /**
29
     * @var BenchData
30
     */
31
    protected $data;
32
33
    /**
34
     * @var ArrayCache
35
     */
36
    protected $cache;
37
38
    /**
39
     * @var EntityRepository
40
     */
41
    protected $repository;
42
43
44
45
    public function setUp()
46
    {
47
        $this->cache = new ArrayCache();
48
        $this->prime = new ServiceLocator();
49
        $this->prime->connections()->declareConnection('test', BENCH_CONNECTION);
50
        $this->prime->connection('test')->getConfiguration()->getTypes()->register(ArrayType::class, 'array');
0 ignored issues
show
The method getConfiguration() does not exist on Bdf\Prime\Connection\ConnectionInterface. Since it exists in all sub-types, consider adding an abstract or default implementation to Bdf\Prime\Connection\ConnectionInterface. ( Ignorable by Annotation )

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

50
        $this->prime->connection('test')->/** @scrutinizer ignore-call */ getConfiguration()->getTypes()->register(ArrayType::class, 'array');
Loading history...
51
        Locatorizable::configure($this->prime);
0 ignored issues
show
$this->prime of type Bdf\Prime\ServiceLocator is incompatible with the type Closure expected by parameter $locator of Bdf\Prime\Locatorizable::configure(). ( Ignorable by Annotation )

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

51
        Locatorizable::configure(/** @scrutinizer ignore-type */ $this->prime);
Loading history...
52
53
        $this->data = new BenchData($this->prime);
54
        $this->data->addAllData();
55
56
        $this->repository = $this->prime->repository(BenchUser::class);
57
    }
58
59
    /**
60
     * {@inheritdoc}
61
     */
62
    public function tearDown()
63
    {
64
        $this->data->clear();
65
    }
66
67
68
    /**
69
     * @ParamProviders({"joins"})
70
     */
71
    public function bench($params)
72
    {
73
        list($clause, $value) = $params;
74
75
        $this->repository
76
            ->where($clause, $value)
77
            ->toSql();
0 ignored issues
show
The method toSql() does not exist on Bdf\Prime\Query\QueryInterface. Since it exists in all sub-types, consider adding an abstract or default implementation to Bdf\Prime\Query\QueryInterface. ( Ignorable by Annotation )

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

77
            ->/** @scrutinizer ignore-call */ toSql();
Loading history...
78
    }
79
80
    /**
81
     *
82
     */
83
    public function joins()
84
    {
85
        return [
86
            ['customer.packs.label', 'Simply'],
87
            ['customer.name', 'customer Common name'],
88
            ['customer.id', '330000'],
89
        ];
90
    }
91
}