-
Notifications
You must be signed in to change notification settings - Fork 29
Unable to set a value to NULL anymore since release 0.4.0 #12
Comments
@benn-be Do you have an excerpt from your yaml file that you could share to demonstrate this issue? |
The command I launch :
config.yaml
Expected result : That was what I actually expected for some values (to be able to recheck the use default checkbox in the admin), but since the basic assomption that null is not a valid value for a field in core_config_data is untrue, this does not work correctly then. I'm not sure how we could overcome that matter, I tried to change LoadCommand.php to find a right way to do it but I was not able to find a clever solution. The lines involved are actually those :
|
@punkstar Follow up information, if I blank any field on Magento config, it sets it to null. So maybe a fix could be
I'm currently looking into Mage core to find evidence that a field set to blank in the admin is automatically translated to null. |
I can confirm the above statement. Mage_Core_Model_Resource_Db_Abstract::save is calling _prepareDataForSave
app/code/core/Mage/Core/sql/core_setup/install-1.6.0.0.php
So the field is indeed nullable and a text, it is then reassigned to null by the above Varien_Db_Adapter_Pdo_Mysql::prepareColumnValue. So if you set a field to blank in core_config_data Magento ORM will 'cast' it to null. |
For some fields, blanking the value is actually resulting as a NULL in the database and not an empty string, but since 0.4.0 NULL is considered as 'inherit from parent scope'.
This is not totally true in this case because the inheriting will then be done on the config.xml of the module, so it will side effect the value to be 90 when the intended purpose was to have it NULL, so disable the functionality (as the comment on the field is prompting it).
Module is from an EE version : Enterprise_Pci
Admin field
Database state when the field is blanked
Extract from app/code/core/Enterprise/Pci/etc/config.xml where we can see that, if the value is removed out of the database it will side effet to 90
And here is how this value is actually used in the Observer of the module :
The text was updated successfully, but these errors were encountered: