Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[HttpFoundation] Allow dynamic session "ttl" when using a remote storage#45873

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fabpot merged 1 commit intosymfony:6.1fromnicolas-grekas:hf-ttl-closure
Mar 30, 2022

Conversation

@nicolas-grekas
Copy link
Member

@nicolas-grekasnicolas-grekas commentedMar 28, 2022
edited
Loading

QA
Branch?6.1
Bug fix?no
New feature?yes
Deprecations?no
TicketsFix#44368
LicenseMIT
Doc PR-

This is my proposal instead of#44368. My goal here it tonot make the session handler mutable.
Instead, I propose to allow defining the "ttl" option as a closure.
Here is how this would work in practice:

services:my.session.handler:parent:session.abstract_handlerarguments:index_0:'redis://localhost'index_1:{ttl: !closure ['@my.ttl.handler']}

Wheremy.ttl.handler would be an invokable that returns the ttl for the current user (based on the session object from the request stack, or from the token storage I suppose).

/cc@Seldaek I'd be happy to have your thoughts here (and also your help for tests/doc ideally 👼)

@nicolas-grekas
Copy link
MemberAuthor

PR is ready with basic tests.

Copy link
Member

@chalasrchalasr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Nice. Worth some changelog entry though

fabpot added a commit that referenced this pull requestMar 30, 2022
…elp passing closures to services (nicolas-grekas)This PR was merged into the 6.1 branch.Discussion----------[DependencyInjection] Add argument type `closure` to help passing closures to services| Q             | A| ------------- | ---| Branch?       | 6.1| Bug fix?      | no| New feature?  | yes| Deprecations? | no| Tickets       | -| License       | MIT| Doc PR        | -Inspired by#45873This makes it easier to inject invokable services as closures.Before:```yamlservices:  # [...]    arguments:      - !service          class: Closure          factory: [Closure, fromCallable]          arguments: ['@my.invokable']```After:```yamlservices:  # [...]    arguments:      - !closure '@my.invokable'```As a bonus, PhpDumper now optimizes Closure::fromCallable into first-class callable syntax.Commits-------fe1404f [DependencyInjection] Add argument type `closure` to help passing closures to services
Copy link
Member

@fabpotfabpot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I agree that it deserves a note in the CHANGELOG file.

@nicolas-grekas
Copy link
MemberAuthor

changelog updated

@fabpot
Copy link
Member

Thank you@nicolas-grekas.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@fabpotfabpotfabpot approved these changes

@chalasrchalasrchalasr approved these changes

+1 more reviewer

@SeldaekSeldaekSeldaek approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

6.1

Development

Successfully merging this pull request may close these issues.

5 participants

@nicolas-grekas@fabpot@Seldaek@chalasr@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp