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

Move original request to container #69

Closed
wants to merge 1 commit into from
Closed

Move original request to container #69

wants to merge 1 commit into from

Conversation

yiiliveext
Copy link
Contributor

Q A
Is bugfix?
New feature?
Breaks BC?
Tests pass? ✔️

@yiiliveext yiiliveext requested a review from a team March 18, 2020 12:48
@samdark samdark added status:code review The pull request needs review. status:under discussion labels Mar 18, 2020
@samdark
Copy link
Member

samdark commented Mar 18, 2020

What's the use case for it? That is original request that is not modified by any middleware.

@yiiliveext
Copy link
Contributor Author

yiiliveext commented Mar 18, 2020

What's the use case for it? That is original request that is not modified by any middleware.

See yiisoft/di#120

 ServerRequestInterface::class => function (ContainerInterface $container) {
        $request = $container->get(ServerRequestFactory::class)->createFromGlobals();
        $request->setAttribute('RequestID', uniqid('', true));
        return $request;
    },
IdentityRepositoryInterface::class => [
        '__definition' => static function (ContainerInterface $container) {
            return $container->get(\Cycle\ORM\ORMInterface::class)->getRepository(\App\Entity\User::class);
        },
        '__cacheTag' => function (ContainerInterface $container) {
            return $container->get(ServerRequestInterfcae::class)->getAtribute('RequestID');
        },
    ],

Also we can remove getLastMatchedRequest() from the UrlMatcher

@yiiliveext
Copy link
Contributor Author

Maybe it makes sense to move the part from config/web.php to the yii-web package.

@samdark
Copy link
Member

samdark commented Mar 18, 2020

@yiiliveext I know it's useful for yiisoft/di#120 as is but it's very confusing in general.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:code review The pull request needs review. status:under discussion
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants