Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8490541
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T22:09:10+00:00 2026-06-10T22:09:10+00:00

I am using Symfony2 flash messages in my forms to build different views after

  • 0

I am using Symfony2 flash messages in my forms to build different views after form submit.
So far everything is as expected, but now I want that the session.flash message (just in one form) do not still alive once this form response view has been rendered.

{% if app.session.hasFlash('something') %}
   ...some code...
{% endif %}

I have researched about that, but apart the official reference with functions to delete this flash, I have not found any information.

Someone knows which one is the best practice to do that? Remove this flash in some particular place (p.e. a controller or event) or maybe exists some option to limit the flash message lifetime.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T22:09:11+00:00Added an answer on June 10, 2026 at 10:09 pm

    Since you are just checking this, but not calling – flash still will be housed in session. To trigger session removing – you have to call getFlash() on it.

    Currently, the difference between calling getFlash() and removeFlash() is only in fact that first method returns value.

    For your particular case I recommend you to call getFlash() with second argument, which determines default return value in case if requested index does not exist.

    {% if app.session.getFlash('something', false) %}
       ...some code...
    {% endif %}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Symfony2 and CraueFormFlowBundle to create a multi-step form. Everything is going well
I am using Symfony2, everything is installed, my tests work so good so far.
I am using Symfony2 and Doctrine2 to build an application. One part of the
I´m currently developing a web site using Symfony2. On 'dev' environment everything works just
I'm using symfony2. I have a form, and I want to print it a
I am using Symfony2 with Doctrine and Twig. I have two forms created in
I'm using Symfony2 and FOSUserBundle. This question is extensible to any other bundled form
I can't seem to find any documentation on Symfony2 forms when using Propel ORM.
I'm using Symfony2 and Doctrine2. How would I go about using a different query
I'm using a flash component in my symfony2 application which uploads multiple images, and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.