Skip to content

Commit 0422a5c

Browse files
committed
wip: break Query into SqlQuery and PhpQuery
1 parent 67f2e46 commit 0422a5c

File tree

6 files changed

+458
-384
lines changed

6 files changed

+458
-384
lines changed

src/Query/PhpQuery.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
namespace Gt\Database\Query;
3+
4+
use Gt\Database\Connection\Driver;
5+
6+
class PhpQuery extends Query {
7+
private string $functionName;
8+
9+
public function __construct(string $filePathWithFunction, Driver $driver) {
10+
[$filePath, $functionName] = explode("::", $filePathWithFunction);
11+
// TODO: Allow PHP files with :: separators to function names
12+
if(!is_file($filePath)) {
13+
throw new QueryNotFoundException($filePath);
14+
}
15+
16+
$this->filePath = $filePath;
17+
$this->functionName = $functionName;
18+
$this->connection = $driver->getConnection();
19+
}
20+
21+
/** @param array<string, mixed>|array<mixed> $bindings */
22+
public function getSql(array &$bindings = []):string {
23+
// TODO: Include similarly to page logic files, with optional namespacing (I think...)
24+
}
25+
}

0 commit comments

Comments
 (0)