"doesParameterExists" vs "getParameter"
Looking at CreateUpdateIndividual::doAction(), we can see that there is a mix of getParameter
and doesParameterExists
methods for determining whether to add a field to params. For instance:
if ($parameters->doesParameterExists('last_name')) {
$params['last_name'] = $parameters->getParameter('last_name');
}
if ($parameters->getParameter('middle_name')) {
$params['middle_name'] = $parameters->getParameter('middle_name');
}
When a new contact is being created, there's no difference. However, when updating a contact, fields with doesParameterExists()
(like last_name
) will be overwritten with a blank string if left blank, whereas fields like middle_name
with getParameter()
will preserve the existing record's data.
It seems like we should a) standardize on one or the other, b) perhaps it should be a setting on the action that determines the correct behavior.
Thoughts?