Inserting NULL values in a Controller::save($args) function
Permalink
Hi there,
Since we moved away from ADODB to Doctrine, I can't find a way to set a block table field value to NULL,
before in your block controller save($args) function you would simply set the key to null :
But that does not work anymore... sniffing the query injected to MySQL it seems to insert a string "null" instead… I tried several other options (PDO::PARAM_NULL, null, 'NULL', 'null', '') but nothing.
(my field is a nullable integer, but I have the same issue on text etc…).
Any idea?
Since we moved away from ADODB to Doctrine, I can't find a way to set a block table field value to NULL,
before in your block controller save($args) function you would simply set the key to null :
public function save($args) { $args['mykey'] = null; return parent::save($args); }
But that does not work anymore... sniffing the query injected to MySQL it seems to insert a string "null" instead… I tried several other options (PDO::PARAM_NULL, null, 'NULL', 'null', '') but nothing.
(my field is a nullable integer, but I have the same issue on text etc…).
Any idea?
Did you ever figure this out, goutnet?
nope, I finally gave up to insert null values through the core…
Instead, I try to handle only these type of queries direclty through doctrine (with the built-in mapping), alas that only works for your classes … and not for Core queries … so I had to not rely on anything able to be NULL … (that sucks... but … we'll have to cope wiht it).
My null values basically meant that the corresponding parameter or toggle was unused. So instead I added a checkbox to signify the same thing, and did not rely on the null statement anymore.
Instead, I try to handle only these type of queries direclty through doctrine (with the built-in mapping), alas that only works for your classes … and not for Core queries … so I had to not rely on anything able to be NULL … (that sucks... but … we'll have to cope wiht it).
My null values basically meant that the corresponding parameter or toggle was unused. So instead I added a checkbox to signify the same thing, and did not rely on the null statement anymore.