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

Implement InitializePersistenceIdInterface #52

Merged

Conversation

michal-izewski
Copy link
Contributor

@michal-izewski michal-izewski commented May 16, 2024

Q A
Documentation no
Bugfix no
BC Break no
New Feature yes
RFC no
QA yes

Description

Introducing an InitilalizePersistenceIdInterface implementation will enable the ability to access sessionId before it's transmitted in a cookie to the client by a SessionMiddleware.

@froschdesign froschdesign added the Enhancement New feature or request label May 17, 2024
@froschdesign froschdesign requested a review from gsteel May 17, 2024 07:40
@froschdesign froschdesign added this to the 1.14.0 milestone May 17, 2024
@michal-izewski
Copy link
Contributor Author

Hi @gsteel, any chance you'll find time to review this PR?

Copy link
Member

@gsteel gsteel left a comment

Choose a reason for hiding this comment

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

Thanks @michal-izewski 👍


public function initializeId(SessionInterface $session): SessionInterface
{
if ($session->getId() === '' || $session->isRegenerated()) {
Copy link
Member

Choose a reason for hiding this comment

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

Ideally, we would assert the $session instance implements SessionIdentifierAwareInterface, but, we should probably get mezzio-session v2 out the door and make that method part of SessionInterface. See mezzio/mezzio-session#59

@gsteel gsteel self-assigned this Jun 29, 2024
@gsteel gsteel merged commit b99e723 into mezzio:1.14.x Jun 29, 2024
22 of 31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants