annotate src/Database/Builder.php @ 7:e6132a1e8e24 default tip

Adding better support for test among other base changes.
author Luka Sitas <sitas.luka.97@gmail.com>
date Thu, 25 Sep 2025 19:58:32 -0400
parents b44434aaa767
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
b44434aaa767 Moving around the components.
luka
parents:
diff changeset
1 <?php
b44434aaa767 Moving around the components.
luka
parents:
diff changeset
2
b44434aaa767 Moving around the components.
luka
parents:
diff changeset
3 namespace Wizard\Framework\Database;
b44434aaa767 Moving around the components.
luka
parents:
diff changeset
4
b44434aaa767 Moving around the components.
luka
parents:
diff changeset
5 use Illuminate\Database\Eloquent\Builder as BaseBuilder;
b44434aaa767 Moving around the components.
luka
parents:
diff changeset
6
b44434aaa767 Moving around the components.
luka
parents:
diff changeset
7 class Builder extends BaseBuilder {
b44434aaa767 Moving around the components.
luka
parents:
diff changeset
8
b44434aaa767 Moving around the components.
luka
parents:
diff changeset
9 public $named_joins = [];
b44434aaa767 Moving around the components.
luka
parents:
diff changeset
10
b44434aaa767 Moving around the components.
luka
parents:
diff changeset
11 /*
b44434aaa767 Moving around the components.
luka
parents:
diff changeset
12 * Add's a named join to the query, this will only add the joins
b44434aaa767 Moving around the components.
luka
parents:
diff changeset
13 * a single time, and keep track of joins that are already in the query.
b44434aaa767 Moving around the components.
luka
parents:
diff changeset
14 *
b44434aaa767 Moving around the components.
luka
parents:
diff changeset
15 */
b44434aaa767 Moving around the components.
luka
parents:
diff changeset
16 public function addNamedJoin($join = '') {
b44434aaa767 Moving around the components.
luka
parents:
diff changeset
17 $available_joins = $this->model?->named_joins() ?? [];
b44434aaa767 Moving around the components.
luka
parents:
diff changeset
18 if(isset($available_joins[$join]) && ($named_joins[$join] ?? false) == false) {
b44434aaa767 Moving around the components.
luka
parents:
diff changeset
19 $this->named_joins[$join] = true;
b44434aaa767 Moving around the components.
luka
parents:
diff changeset
20 $available_joins[$join]($this);
b44434aaa767 Moving around the components.
luka
parents:
diff changeset
21 }
b44434aaa767 Moving around the components.
luka
parents:
diff changeset
22 }
b44434aaa767 Moving around the components.
luka
parents:
diff changeset
23 }