| Total Complexity | 6 |
| Total Lines | 44 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 8 | class QueryBuilder extends \Doctrine\DBAL\Query\QueryBuilder |
||
| 9 | { |
||
| 10 | private string $table; |
||
| 11 | private array $relations= []; |
||
| 12 | |||
| 13 | private Database $db; |
||
| 14 | |||
| 15 | public function __construct(Database $db) |
||
| 19 | |||
| 20 | } |
||
| 21 | |||
| 22 | public function with(string $relation): QueryBuilder |
||
| 23 | { |
||
| 24 | array_push($this->relations, $relation); |
||
| 25 | return $this; |
||
| 26 | } |
||
| 27 | |||
| 28 | public function from($from, $alias = null): QueryBuilder |
||
| 29 | { |
||
| 30 | $this->table = $from; |
||
| 31 | return $this->add('from', [ |
||
| 32 | 'table' => $from, |
||
| 33 | 'alias' => $alias, |
||
| 34 | ], true); |
||
| 35 | } |
||
| 36 | |||
| 37 | public function get(): Collection |
||
| 44 | } |
||
| 45 | |||
| 46 | public function first(): Model |
||
| 52 | } |
||
| 53 | } |