[FLOW3-general] Storing JSON object

"Christian Müller (Kitsunet)" christian.mueller at typo3.org
Thu Feb 9 08:34:22 CET 2012


On 08/02/12 22:26, Dominique Feyer wrote:
> Hello,

Hi,


> My current idea is to stored this custom field as JSON object
> (serialized). It's not a problem for searching and/or ordering, we use
> an external ElasticSearch for that.
>
> For an Example model object with those fields:
>
> ExampleObject:
> - id
> - type
> - customFields
>
> The type will store the name of a serialized object, and the fields
> customFields will store the content of the object, but during the life
> of the object, this property will store the normal PHP object.

Maybe an array of customFields would be enough? We do the same in our 
TYPO3CR node model. A node also has a type and some fields which depend 
on the type. They are stored in an simple array with methods like 
getProperty(), setProperty() and so on.

This array is serialized into one database field.

There is also a doctrine mapping type named object which will be 
serialized to the parent:
http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/basic-mapping.html#doctrine-mapping-types

But I don't know if that would work out with FLOW3, maybe you give it a 
try and report back. If you do that your customFields model should not 
have an entity annotation as it hasn't got its own representation in the 
database.

>
> Bests,
>
> Dominique Feyer

Cheers,
Christian


More information about the FLOW3-general mailing list