1 | <?php |
||
18 | class JoinClause extends QueryBuilder |
||
19 | { |
||
20 | /** |
||
21 | * The type of join being performed. |
||
22 | * |
||
23 | * @var string |
||
24 | */ |
||
25 | public $type; |
||
26 | |||
27 | /** |
||
28 | * The table the join clause is joining to. |
||
29 | * |
||
30 | * @var string |
||
31 | */ |
||
32 | public $table; |
||
33 | |||
34 | /** |
||
35 | * The parent query builder instance. |
||
36 | * |
||
37 | * @var QueryBuilder |
||
38 | */ |
||
39 | private $parentQuery; |
||
40 | |||
41 | /** |
||
42 | * Create a new join clause instance. |
||
43 | * |
||
44 | * @param QueryBuilder $parentQuery |
||
45 | * @param string $type |
||
46 | * @param string $table |
||
47 | * @return void |
||
|
|||
48 | */ |
||
49 | public function __construct(QueryBuilder $parentQuery, $type, $table) |
||
59 | |||
60 | /** |
||
61 | * Add an "on" clause to the join. |
||
62 | * |
||
63 | * On clauses can be chained, e.g. |
||
64 | * |
||
65 | * $join->on('contacts.user_id', '=', 'users.id') |
||
66 | * ->on('contacts.info_id', '=', 'info.id') |
||
67 | * |
||
68 | * will produce the following SQL: |
||
69 | * |
||
70 | * on `contacts`.`user_id` = `users`.`id` and `contacts`.`info_id` = `info`.`id` |
||
71 | * |
||
72 | * @param \Closure|string $first |
||
73 | * @param string|null $operator |
||
74 | * @param string|null $second |
||
75 | * @param string $boolean |
||
76 | * @return $this |
||
77 | * |
||
78 | * @throws \InvalidArgumentException |
||
79 | */ |
||
80 | public function on($first, $operator = null, $second = null, $boolean = 'and') |
||
88 | |||
89 | /** |
||
90 | * Add an "or on" clause to the join. |
||
91 | * |
||
92 | * @param \Closure|string $first |
||
93 | * @param string|null $operator |
||
94 | * @param string|null $second |
||
95 | * @return JoinClause |
||
96 | */ |
||
97 | public function orOn($first, $operator = null, $second = null) |
||
101 | |||
102 | /** |
||
103 | * Get a new instance of the join clause builder. |
||
104 | * |
||
105 | * @return JoinClause |
||
106 | */ |
||
107 | public function newQuery() |
||
111 | |||
112 | /** |
||
113 | * Create a new query instance for sub-query. |
||
114 | * |
||
115 | * @return QueryBuilder |
||
116 | */ |
||
117 | protected function forSubQuery() |
||
121 | } |
||
122 |
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.