Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change RowInterface and RowListInterface return type #18

Open
wants to merge 9 commits into
base: 1.x
Choose a base branch
from

Conversation

koriym
Copy link
Member

@koriym koriym commented Jul 13, 2020

No description provided.

@yuki777
Copy link

yuki777 commented Sep 2, 2020

@koriym
簡単な例ですが、

<?php
use BEAR\Resource\ResourceObject;
use Ray\Di\Di\Named;
use Ray\Query\RowInterface;

class Foo extends ResourceObject
{
    private RowInterface $getFoo;

    /**
     * @Named("getFoo=getFoo")
     */
    public function __construct(RowInterface $getFoo)
    {
        $this->getFoo = $getFoo;
    }

    public function onGet(int $id): ResourceObject
    {
        $foo = (array) ($this->getFoo)(['id' => $id]); // Before
        // ...
        $this->body['foo'] = $foo;
        return $this;
    }
}

(array)によるキャストをしていたコードで、キャストが不要になる。
という理解であってるでしょうか?

$foo = (array) ($this->getFoo)(['id' => $id]); // Before
=>
$foo = ($this->getFoo)(['id' => $id]); // After

@koriym
Copy link
Member Author

koriym commented Sep 3, 2020

そうです。このcommitを参照してもらえると!
https://github.com/ray-di/Ray.QueryModule/pull/18/files#diff-0f4ac58ba8511f1b46b7988a690f8572L10

@return iterable<mixed>から@return array

@yuki777
Copy link

yuki777 commented Sep 3, 2020

@koriym ありがとうございます!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants