Skip to content

Commit

Permalink
Merge pull request #14 from ray-di/annotation-query
Browse files Browse the repository at this point in the history
Update README
  • Loading branch information
koriym authored Jun 24, 2019
2 parents de1b138 + 1942aa8 commit cf37388
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
14 changes: 8 additions & 6 deletions README.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,13 @@ class Todos

## メソッドをオーバーライド

`@AliasQuery`でメソッド全体をSQLの実行に置き換えることができます。
`@Query`でメソッド全体をSQLの実行に置き換えることができます。

```php
class Foo
{
/**
* @AliasQuery(id="todo_item_by_id")
* @Query(id="todo_item_by_id")
*/
public function get(string $id)
{
Expand All @@ -178,7 +178,7 @@ class Foo
class FooTempalted
{
/**
* @AliasQuery(id="todo_item_by_id?id={a}", templated=true)
* @Query(id="todo_item_by_id?id={a}", templated=true)
*/
public function get(string $a)
{
Expand All @@ -192,14 +192,16 @@ class FooTempalted
class FooRow
{
/**
* @AliasQuery(id="ticket_item_by_id", type="row")
* @Query(id="ticket_item_by_id", type="row")
*/
public function onGet(string $id) : ResourceObject
{
}
}
```

SELETした結果が無い場合にはcode 404が返ります。

## URIを実行オブジェクトに

`WebQueryModule`は設定で束縛したURIをWebアクセスする実行関数がインジェクトされます。
Expand Down Expand Up @@ -250,7 +252,7 @@ public function __construct(
($this->todo)(['id' => $uuid]);
```

`@AliasQuery`の利用コードも変わりません。
`@Query`の利用コードも変わりません。

## PHPクラスを束縛

Expand Down Expand Up @@ -282,7 +284,7 @@ class CreateTodo implements QueryInterface
$this->bind('')->annotatedWith('cretate_todo')->to(CreateTodo::class); // callableはインターフェイスなし
```

利用コードは同じです。`@AliasQuery`の利用コードも変わりません。
利用コードは同じです。`@Query`の利用コードも変わりません。

## ISO8601 DateTimeモジュール

Expand Down
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,13 @@ class Todos

## Override the method with callable object

Entire method invocation can be override with callable object in specified with `@AliasQuery`.
Entire method invocation can be override with callable object in specified with `@Query`.

```php
class Foo
{
/**
* @AliasQuery(id="todo_item_by_id")
* @Query(id="todo_item_by_id")
*/
public function get(string $id)
{
Expand All @@ -174,7 +174,7 @@ When parameter name is different method arguments and Query object arguments, ur
class FooTempalted
{
/**
* @AliasQuery(id="todo_item_by_id?id={a}", templated=true)
* @Query(id="todo_item_by_id?id={a}", templated=true)
*/
public function get(string $a)
{
Expand All @@ -188,14 +188,16 @@ Specify `type='row'` when single row result is expected to return.
class FooRow
{
/**
* @AliasQuery(id="ticket_item_by_id", type="row")
* @Query(id="ticket_item_by_id", type="row")
*/
public function onGet(string $id) : ResourceObject
{
}
}
```

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

## 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 Expand Up @@ -247,7 +249,7 @@ public function __construct(
($this->todo)(['id' => $uuid]);
```

The usage code of `@AliasQuery` does not change either.
The usage code of `@Query` does not change either.

## Bind to PHP class

Expand Down Expand Up @@ -279,7 +281,7 @@ Bind to `callable`.
$this->bind('')->annotatedWith('cretate_todo')->to(CreateTodo::class); // callableはインターフェイスなし
```

The usage codes are the same. The usage code of `@AliasQuery` does not change either.
The usage codes are the same. The usage code of `@Query` does not change either.

## ISO8601 DateTimeモジュール

Expand Down

0 comments on commit cf37388

Please sign in to comment.