1 | <?php |
||
12 | class Subquery extends Expression |
||
13 | { |
||
14 | /** |
||
15 | * Query builder instance. |
||
16 | * |
||
17 | * @var QueryBuilder |
||
18 | */ |
||
19 | protected $query; |
||
20 | |||
21 | /** |
||
22 | * Alias for the subquery. |
||
23 | * |
||
24 | * @var string |
||
25 | */ |
||
26 | protected $alias; |
||
27 | |||
28 | /** |
||
29 | * Create new subquery instance. |
||
30 | * |
||
31 | * @param QueryBuilder|EloquentBuilder |
||
32 | * @param string $alias |
||
33 | */ |
||
34 | public function __construct($query, $alias = null) |
||
44 | |||
45 | /** |
||
46 | * Set underlying query builder. |
||
47 | * |
||
48 | * @param QueryBuilder $query |
||
49 | */ |
||
50 | public function setQuery(QueryBuilder $query) |
||
54 | |||
55 | /** |
||
56 | * Get underlying query builder. |
||
57 | * |
||
58 | * @return QueryBuilder |
||
59 | */ |
||
60 | public function getQuery() |
||
64 | |||
65 | /** |
||
66 | * Evaluate query as string. |
||
67 | * |
||
68 | * @return string |
||
69 | */ |
||
70 | public function getValue() |
||
82 | |||
83 | /** |
||
84 | * Get subquery alias. |
||
85 | * |
||
86 | * @return string |
||
87 | */ |
||
88 | public function getAlias() |
||
92 | |||
93 | /** |
||
94 | * Set subquery alias. |
||
95 | * |
||
96 | * @param string $alias |
||
97 | * @return $this |
||
98 | */ |
||
99 | public function setAlias($alias) |
||
105 | |||
106 | /** |
||
107 | * Pass property calls to the underlying builder. |
||
108 | * |
||
109 | * @param string $property |
||
110 | * @param mixed $value |
||
111 | * @return mixed |
||
112 | */ |
||
113 | public function __set($property, $value) |
||
117 | |||
118 | /** |
||
119 | * Pass property calls to the underlying builder. |
||
120 | * |
||
121 | * @param string $property |
||
122 | * @return mixed |
||
123 | */ |
||
124 | public function __get($property) |
||
128 | |||
129 | /** |
||
130 | * Pass method calls to the underlying builder. |
||
131 | * |
||
132 | * @param string $method |
||
133 | * @param array $params |
||
134 | * @return mixed |
||
135 | */ |
||
136 | public function __call($method, $params) |
||
140 | } |
||
141 |