Issues (590)

src/Query/Contract/Projectionable.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace Bdf\Prime\Query\Contract;
4
5
/**
6
 * Query which can restrict the returning data (or columns) by performing a projection
7
 *
8
 * @psalm-type ColumnType = string|\Bdf\Prime\Query\Expression\ExpressionInterface|\Bdf\Prime\Query\QueryInterface
9
 */
10
interface Projectionable
11
{
12
    /**
13
     * Perform a projection
14
     * This method is an alias of select()
15
     *
16
     * @param ColumnType|ColumnType[]|null $columns The selection expressions
0 ignored issues
show
The type Bdf\Prime\Query\Contract\ColumnType 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...
17
     *
18
     * @return $this
19
     *
20
     * @see Projectionable::select()
21
     */
22
    public function project($columns = null);
23
24
    /**
25
     * Specifies an item that is to be returned in the query result.
26
     * Replaces any previously specified selections, if any.
27
     *
28
     * To define an alias, an associative array must be used, with the alias as key, and expression as value.
29
     *
30
     * Note: To ensure that expressions string will not be parsed, use expression objects, or wrap with `new Raw('...')`
31
     *
32
     * <code>
33
     *     // SELECT u.id, p.id
34
     *     $query
35
     *         ->select('u.id', 'p.id')
36
     *         ...
37
     *         ;
38
     *
39
     *     // With alias : SELECT id, n as name
40
     *     $query
41
     *         ->select(['id', 'name' => 'n'])
42
     *         ...
43
     *         ;
44
     *
45
     *     // Use expression : SELECT max(id) as maxId
46
     *     $query
47
     *         ->select(['maxId' => new Raw('max(id)')])
48
     *         ...
49
     *         ;
50
     * </code>
51
     *
52
     * @param ColumnType|ColumnType[]|null $columns The selection expressions.
53
     *
54
     * @return $this This Query instance.
55
     */
56
    public function select($columns = null);
57
58
    /**
59
     * Adds an item that is to be returned in the query result.
60
     *
61
     * To define an alias, an associative array must be used, with the alias as key, and expression as value.
62
     *
63
     * Note: To ensure that expressions string will not be parsed, use expression objects, or wrap with `new Raw('...')`
64
     *
65
     * <code>
66
     *     $query
67
     *         ->select('u.id')
68
     *         ->addSelect('p.id')
69
     *         ->from('users', 'u');
70
     * </code>
71
     *
72
     * @param ColumnType|ColumnType[]|null $columns The selection expression.
73
     *
74
     * @return $this This Query instance.
75
     * @see Projectionable::select() for exemples
76
     */
77
    public function addSelect($columns);
78
}
79