private function saveData($source, $entityType, $row, $data_index)
{
$data = $this->processedRows[$data_index];
$entity = $this->{"{$entityType}Repo"}->save($data);
// update the entity maps
$mapFunction = 'add' . ucwords($entity->getEntityType()) . 'ToMaps';
$this->{$mapFunction}($entity);
// if the invoice is paid we'll also create a payment record
if ($entityType === ENTITY_INVOICE && isset($data['paid']) && $data['paid'] > 0) {
$this->createPayment($source, $row, $data['client_id'], $entity->id);
}
return $entity;
}