private function hydrateResourceFields(Resource $resource, array $row) { $allNull = true; $res = array(); /** @var \FlyRRM\Mapping\Field $f */ foreach ($resource->getFields() as $f) { $rawValue = $row[$resource->getResourceUniqueIdentifier() . '_' . $f->getAlias()]; $hydrator = $this->fieldHydrationFactory->buildFieldHydratorForField($f); $res[$f->getAlias()] = $hydrator->hydrate($rawValue); if ($rawValue !== null) { $allNull = false; } } // TODO // GT: at the moment we don't know what's the referenced resource id, so we check if all fields are null // in order to assert that the referenced resource is null. if ($allNull) { return null; } return $res; }