Want to understand the structure of a value stored in table 'form_fields'

Your software
My Mautic version is: 2.16.2
My PHP version is: 7.3

Your problem
My problem is: Want to understand the structure of value stored in table.
Was looking into database and found this strange value for column ‘properties’ in ‘form_fields’ table
The value is:
a:3:{s:8:“syncList”;i:0;s:10:“optionlist”;a:1:{s:4:“list”;a:2:{i:0;a:2:{s:5:“label”;s:4:“Rent”;s:5:“value”;s:4:“rent”;}i:1;a:2:{s:5:“label”;s:3:“Own”;s:5:“value”;s:3:“own”;}}}s:15:“labelAttributes”;N;}

Please help me out here in understanding the structure of the value; so that I can use appropriate parser to extract the value from it. I am looking to collect JSON data from it. Want to understand the structure of the value stored in this column.

Some additional Information about the environment
DB Version: 10.1.44 (MariaDB)
ubuntu - 18.04

After going through the Developer’s documentation by Mautic, I came to know that " Mautic uses Doctrine, a database object relational mapper (ORM) and database abstraction layer (DBAL) library." - https://developer.mautic.org/#database.

Type of column: longtext, Doc2Type: array

So column stores deserialized (by Doctrine) array; which gets serialized when accessed by the application.

How to deserialize a DC2Type array datatype stored with Doctrine in your database

You may think initially that this must be a complex format and that can be only decoded with Doctrine, however this string is just a normal serialized array created by the serialize function of PHP. Think of this as another notation to represent information like JSON or XML.

How to deserialize a DC2Type array datatype stored with Doctrine in your database

1 Like