Skip to content

docs: Port "Session" service page to 7.2#577

Open
promptless-for-oss wants to merge 1 commit into
mautic:7.2from
Promptless:promptless/docs-issue-387-session-7.2
Open

docs: Port "Session" service page to 7.2#577
promptless-for-oss wants to merge 1 commit into
mautic:7.2from
Promptless:promptless/docs-issue-387-session-7.2

Conversation

@promptless-for-oss

Copy link
Copy Markdown
Contributor

Open this suggestion in Promptless to view citations and reasoning process

Ports the legacy Session service guide into docs/plugin_services/session.rst, converting the Markdown to RST and updating the example for Mautic 7. Obtains the session from the current Request via RequestStack::getSession() instead of the removed session service. Resolves docs issue #387 (content sourced from parent 7.0 issue #386).

Trigger Events


Tip: Tell your friends working on non-commercial open-source projects to apply for free Promptless access at promptless.ai/oss ❤️


In Mautic 7, the session is part of the request. Obtain it from the current ``Request`` rather than from a ``session`` service. Inject ``Symfony\Component\HttpFoundation\RequestStack`` and call ``getSession()`` on the current request:

.. code-block:: php

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ported the session operations (all(), get() with a default, has(), set(), remove(), clear()) from the legacy _plugin_services_session.md guide. Updated the access pattern to RequestStack::getSession() for Mautic 7, since the legacy $this->get('session') service getter (and Symfony 2.8 Session class) no longer applies.

Source: https://github.com/mautic/developer-documentation/blob/main/source/includes/_plugin_services_session.md

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant