Closed hiscaler closed 11 months ago
What is "CurrentRequest" from issue theme?
Is problem with "UserRequest"? Please, show code of this class.
UserRequest class
<?php
declare(strict_types=1);
namespace App\User;
use Yiisoft\Auth\Middleware\Authentication;
use Yiisoft\Input\Http\Attribute\Parameter\Request;
use Yiisoft\Input\Http\RequestInputInterface;
final class UserRequest implements RequestInputInterface
{
#[Request(Authentication::class)]
private User $user;
public function getUser(): User
{
return $this->user;
}
}
Seems, you need to use request catcher. There are to make it two ways.
1) Use RequestCatcherParametersResolver
in middleware dispatcher. Example here: https://github.com/yiisoft/demo/blob/master/blog-api/config/web/di/middleware-dispatcher.php#L12
2) Add RequestCatcherMiddleware
to list of your middlewares
I already use first way, but invalid
Is setting error?
Hm. Does it work before release Yii User 2.1?
i used 2.0, i upgrade reference blog example. It was okay before
I tested demo, everything is working correctly.
May be you don't configure hydrator: https://github.com/yiisoft/demo/blob/master/blog-api/config/common/di/hydrator.php ?
PR with demo adaptation: https://github.com/yiisoft/demo/pull/599. May be it help you...
Have been configured
I rollback it, Wait till I have time to test
A lot of things have not been officially released, and there are still a lot of questions. Of course, it has something to do with my unfamiliarity.
When are you ready to release Yii3?
When are you ready to release Yii3?
I hope that soon. Currently we hard work with code (hydrator and forms almost ready), then planned create/improve docs.
I rollback it, Wait till I have time to test
I moved tihs issue to demo repo.
Sorry , i don't add auth middleware to rule. so can't get it. Very very sorry!
public function update(#[RouteArgument('id')] int $id, EditThirdPartyAccountRequest $editThirdPartyAccountRequest, UserRequest $userRequest): Response
$userRequest is invalid
object(App\User\UserRequest)[559] private App\User\User 'user' => uninitialized
this is my config
What's setting todo?