[TYPO3-mvc] Extbase: No way to store NULL / leave form fields empty?
Jonas Eberle
jonas.eberle at d-mind.de
Thu Apr 16 17:33:24 CEST 2015
Hi Till,
I would say you should try to stay away from NULL values in Typo3.
You might run into problems in other places, e.g. the Backend not able
to store (or correctly display) NULL values.
I would set the value to something specific (e.g. -1) in your
controller. To make this in an elegant way you could set a class
constant, e.g. \My\Ext\Domain\Model\MyModel::NullValue and use it.
Your pain is even greater because you are using floats, meaning you
cannot strictly compare them with -1 for equality ( (-1 === -1.0) might
be FALSE due to the nature of float). The check for null should therefor
be something like
function isNull($v) {
$fuzzy = 1;
return
$v
<
\My\Ext\Domain\Model\MyModel::NullValue + $fuzzy
}
It makes me sad, but I would just say: NULL is a hard-to-use persistence
value in Typo3. Even float needs more configuration to work fluently
with it and I experienced backend problems with it.
Sticking to bool, int, string makes Typo3 programming easier.
Regards,
Jonas
Am 14.04.2015 um 08:48 schrieb Gianluca Strafella:
> Hi Till,
> it sounds as strange. Can you post source code of the domain Model and
> TCA?
>
> Cheers,
> Gianluca
--
Neu: welcome.region-stuttgart.de
Neu: ladenbackofen.de
Neu: beltamor.de
--------------------------------
d-mind bei Facebook:
http://www.facebook.com/werbeagentur.internetagentur.stuttgart
--------------------------------
d-mind GmbH
Mörikestraße 69
70199 Stuttgart
Tel.: +49 711 2804811-0 (Durchwahl: -8)
Fax: +49 711 280481-3
Internet: www.d-mind.de
Geschäftsführer:
Jens Fuchs
Michael Weiß
Jens Strobel
Sitz Stuttgart
Amtsgericht Stuttgart
HRB 751842
More information about the TYPO3-project-typo3v4mvc
mailing list