Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2013-01-04] Error with ManyManyList with extrafields and GridField #1664

Closed
silverstripe-issues opened this issue Apr 3, 2013 · 1 comment

Comments

@silverstripe-issues
Copy link

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:

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?

@maxime-rainville
Copy link
Contributor

This appears to have been fixed at the same time #4067 got fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants