Where are default API Platform operations are stor

2019-08-25 01:59发布

I would like to know where are default API Platform operations (CRUD methods) are stored so that I can call them wherever I need.

I need it because when I define my custom operations, I want to call them (default operations) so that I don't need to rewrite the code (like, get a collection of resource).

For example:

class GetResourceListAction
{
    public function __invoke()
    {
        //Do my things here

        //And finally call default operation which return collection
    }    
}

Thank you

1条回答
2楼-- · 2019-08-25 02:39

As described in the documentation you can directly return your Collection and the API Platform operation will do the rest.

Ex :

    public function __invoke(Book $data): Book
    {
        $this->bookPublishingHandler->handle($data);

        return $data;
    }
查看更多
登录 后发表回答