Skip to content

Commit

Permalink
Remove unused BC comment, add PHP class binding docs
Browse files Browse the repository at this point in the history
The BC (backward compatibility) comment in QueryInterceptor.php was removed, as it served no meaningful purpose. Added to README.md, is a section explaining how to bind a PHP class to a query, instead of specifying an SQL file. The usage and behavior are described, with a corresponding PHP annotation example provided.
  • Loading branch information
koriym committed Jun 13, 2024
1 parent 96340c2 commit 2be10e4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,16 @@ class FooRow

If there is no SELECT result, it returns `404 Not Found`.

### PHP class binding

This Query can also be a dependency on a PHP class rather than specifying an SQL file.

```php
#[Query("ticket_item_by_id"]
```

If the SQL file `ticket_item_by_id.sql` does not exist with such an attribute, the Query interface bound by `RowListInterfce` and `ticket_item_by_id` is executed with the arguments passed to the method The method is executed with the arguments passed to the method.

## Convert URI to Web request object

With `WebQueryModule`, it converts the URI bound in the configuration into an invocation object for web access and injects it.
Expand Down
1 change: 0 additions & 1 deletion src/QueryInterceptor.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ public function invoke(MethodInvocation $invocation)
try {
$sql = ($this->fileGetContents)($filePath);
} catch (SqlFileNotReadableException $e) {
// For BC
// @codeCoverageIgnoreStart
try {
$sqlQuery = $this->injector->getInstance(RowListInterface::class, $queryId);
Expand Down

0 comments on commit 2be10e4

Please sign in to comment.