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

Warning if using sub-property on empty field in publicFieldsInfo() #13

Open
rroblik opened this issue Aug 21, 2015 · 0 comments
Open

Warning if using sub-property on empty field in publicFieldsInfo() #13

rroblik opened this issue Aug 21, 2015 · 0 comments

Comments

@rroblik
Copy link

rroblik commented Aug 21, 2015

There is a lot of warnings if we are mapping a field and using sub-propertyon it if this field is empty. As we speak about search results, some entities (nodes) can have optional(s) field(s), and some of them on some entities can be empty.

Message (watchdog) :
Notice : Undefined index: und in RestfulDataProviderSearchAPI->mapSearchResultToPublicFields() (line 344 in /xxx/sites/all/modules/contrib/restful_search_api/include/RestfulDataProviderSearchAPI.php).

Example :

public function publicFieldsInfo() {
    $fields_info = array(
      'illustration' => array(
        'property' => 'field_content_picture',
        'sub-property' => LANGUAGE_NONE . '::0',
      ),
      // ...
    );

    return $fields_info;
}

This example throw warning if in one (or more) result, the field_content_picture is empty.

In mapSearchResultToPublicFields(), existence of field / key in set of results should be done to avoid that.

Regards

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

No branches or pull requests

1 participant