From 2be10e4197b7bbeb042dd0df702bf694b57ed6e9 Mon Sep 17 00:00:00 2001 From: Akihito Koriyama Date: Thu, 13 Jun 2024 10:04:36 +0900 Subject: [PATCH] Remove unused BC comment, add PHP class binding docs 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. --- README.md | 10 ++++++++++ src/QueryInterceptor.php | 1 - 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9b99bb0..67004c4 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/src/QueryInterceptor.php b/src/QueryInterceptor.php index 5deb598..5201401 100644 --- a/src/QueryInterceptor.php +++ b/src/QueryInterceptor.php @@ -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);