[TYPO3-mvc] Extbase: No way to store NULL / leave form fields empty?

Philipp Wrann philippwrann at gmail.com
Mon Apr 20 19:09:33 CEST 2015


Its more a hard-to-achieve thing in an ORM i think. If a models property is defined as integer, of what use would it be to store null in the database?

If you realy need the field to be null try to use a Hook, the persistenceManager emits signals before and after it updates objects, you could simply get the objects values in the afterPersistChanges Signal and if it is 0 or -1 you set it to null.

Anyway... If a property is configured to be an integer it is the common behaviour that it will be mapped as integer, so the code is more robust.

I would go for a different approach. You could create those values as 1:N Relation, so only relations WITH a value would be persisted. You base model would be smaller and you would not need so many keys if you want to filter on those fields.

Also you could extend those properties domain-specific very without manipulating the code itself.


More information about the TYPO3-project-typo3v4mvc mailing list