Hello!
We are about to start using salesforce integration in a Drupal 8 instance. Seems like it works, just this single warning:
Warning: count(): Parameter must be an array or an object that implements Countable in Drupal\salesforce_mapping\Plugin\SalesforceMappingField\RecordType::isAllowed() (line 78 of modules/contrib/salesforce/modules/salesforce_mapping/src/Plugin/SalesforceMappingField/RecordType.php).
Drupal\salesforce_mapping\Plugin\SalesforceMappingField\RecordType::isAllowed(Object)
call_user_func(Array, Object) (Line: 316)
Drupal\salesforce_mapping_ui\Form\SalesforceMappingFieldsForm->getDrupalTypeOptions(Object) (Line: 102)
Drupal\salesforce_mapping_ui\Form\SalesforceMappingFieldsForm->buildForm(Array, Object)
call_user_func_array(Array, Array) (Line: 519)
Drupal\Core\Form\FormBuilder->retrieveForm('salesforce_mapping_fields_form', Object) (Line: 276)
Drupal\Core\Form\FormBuilder->buildForm('salesforce_mapping_fields_form', Object) (Line: 93)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
when I visit the page /admin/structure/salesforce/mappings/manage/[map-id]/fields
The signature of RestClient::getRecordTypes() is:
/**
* Retrieve all record types for this org.
*
* If $name is provided, retrieve record types for the given object type only.
*
* @param string $name
* Object type name, e.g. Contact, Account, etc.
*
* @return array|false
* If $name is given, a record type array indexed by developer name.
* Otherwise, an array of record type arrays, indexed by object type name.
* FALSE if no record types found.
*/
public function getRecordTypes($name = NULL);
so it may actually return FALSE under some circumstances and we have to account for that within RecordType::isAllowed()
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | 3067057-php-warning-2.patch | 702 bytes | bucefal91 |
Comments
Comment #2
bucefal91 commentedHere's the patch that accounts for the fact the method could return FALSE.
With this patch applies the PHP warning is gone.
Comment #4
aaronbaumanLooks good, thanks for the patch.
Comment #5
bucefal91 commentedThanks to you! :)