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