You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The DataObjects returned by a ManyManyList do not have the ExtraField set if its value is Null.
For example, with this declaration:
public static $many_many_extraFields = array(
'ProductSpecifications' => array(
'Data' => 'Text',
'SortOrder' => 'Int'
)
);
Since Text fields in the database default to Null, if the extrafield hasn't been explicitly set, it will be missing from the DataObject.
While other fields like Int default to 0 for example, these even if not set will still be present on the DataObject.
This cause problems especially when displaying data in a GridField, because using 'Data' as a display field with the GridFieldDataColumns component will return an error if not set.
The error can be avoided if using setFieldFormatting() and an anonymous function testing the value, but this seems a bit much and inconsistent I think?
The text was updated successfully, but these errors were encountered:
created by: @colymba (colymba)
created at: 2013-01-04
original ticket: http://open.silverstripe.org/ticket/8169
The DataObjects returned by a ManyManyList do not have the ExtraField set if its value is Null.
For example, with this declaration:
Since Text fields in the database default to Null, if the extrafield hasn't been explicitly set, it will be missing from the DataObject.
While other fields like Int default to 0 for example, these even if not set will still be present on the DataObject.
This cause problems especially when displaying data in a GridField, because using 'Data' as a display field with the GridFieldDataColumns component will return an error if not set.
The error can be avoided if using setFieldFormatting() and an anonymous function testing the value, but this seems a bit much and inconsistent I think?
The text was updated successfully, but these errors were encountered: