Magento : Difference between Registry and Session

Magento Registry vs Session

Please find the difference between Registry and Session in Magento explained below.

-> The Magento registry never persists after page load, as we go to a new page we will not see those registry variables set yet. Registry is generally used to communicate between blocks and controllers.

-> The session will persist, but internally magento uses its own sessions which can be cleared on magento core calls. Ex. if you place an order, all data will be lost for checkout/session. It’s best practice to create your own custom session to avoid any issues like clearing it at the wrong time.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s