In Magento 2 there is a table called flag.
The table is created Magento\Setup\Model\Installer.
What does this table do / hold?


1 Answer 1


Magento components uses this table as key-values storage for any data, if creation additional table is overhead. But many developers doesn't know about this functionality and uses config or special custom tables for such data.

You can find all usages of this table using search among childs of \Magento\Framework\Flag class.

Moreover, this functionality available beginning from Magento 1.

For example:

Your module creates additional attribute set in InstallData, but you need to store attribute set id for usage in future.

  • So basically, If I need one value stored for something I can store it here? For example to know the last time a script was executed.
    – Marius
    Jan 31, 2018 at 13:21
  • 1
    @Marius yes. Look at github.com/magento/magento2/blob/… for example
    – Max
    Jan 31, 2018 at 13:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.