type fixes
This commit is contained in:
@@ -718,6 +718,10 @@ class FieldManager
|
||||
|
||||
$actualCustomFieldDefs = $this->getCustomFieldDefs($scope, $name, []);
|
||||
$actualFieldDefs = $this->getFieldDefs($scope, $name, (object) []);
|
||||
|
||||
assert($actualFieldDefs !== null);
|
||||
assert($actualCustomFieldDefs !== null);
|
||||
|
||||
$permittedParamList = array_keys($params);
|
||||
|
||||
$filteredFieldDefs = !empty($actualCustomFieldDefs) ? $actualCustomFieldDefs : [];
|
||||
|
||||
@@ -85,7 +85,7 @@ class NumberType implements Di\EntityManagerAware
|
||||
->findOne();
|
||||
|
||||
if (!$number) {
|
||||
$number = $this->entityManager->getEntity('NextNumber');
|
||||
$number = $this->entityManager->getNewEntity('NextNumber');
|
||||
|
||||
$number->set('entityType', $scope);
|
||||
$number->set('fieldName', $name);
|
||||
|
||||
@@ -218,6 +218,8 @@ class Import
|
||||
|
||||
$enclosure = $params->getTextQualifier() ?? self::DEFAULT_TEXT_QUALIFIER;
|
||||
|
||||
assert(is_string($this->entityType));
|
||||
|
||||
if (!$this->user->isAdmin()) {
|
||||
$forbiddenAttributeList =
|
||||
$this->aclManager->getScopeForbiddenAttributeList($this->user, $this->entityType, 'edit');
|
||||
@@ -248,7 +250,7 @@ class Import
|
||||
$startFromIndex = null;
|
||||
|
||||
if ($this->id) {
|
||||
$import = $this->entityManager->getEntity('Import', $this->id);
|
||||
$import = $this->entityManager->getEntityById('Import', $this->id);
|
||||
|
||||
if (!$import) {
|
||||
throw new Error('Import: Could not find import record.');
|
||||
@@ -261,7 +263,7 @@ class Import
|
||||
$import->set('status', ImportEntity::STATUS_IN_PROCESS);
|
||||
}
|
||||
else {
|
||||
$import = $this->entityManager->getEntity(ImportEntity::ENTITY_TYPE);
|
||||
$import = $this->entityManager->getNewEntity(ImportEntity::ENTITY_TYPE);
|
||||
|
||||
$import->set([
|
||||
'entityType' => $this->entityType,
|
||||
@@ -423,6 +425,8 @@ class Import
|
||||
}
|
||||
}
|
||||
|
||||
assert(is_string($this->entityType));
|
||||
|
||||
$recordService = $this->recordServiceContainer->get($this->entityType);
|
||||
|
||||
if (in_array($action, [Params::ACTION_CREATE_AND_UPDATE, Params::ACTION_UPDATE])) {
|
||||
@@ -445,7 +449,7 @@ class Import
|
||||
|
||||
if (!$entity) {
|
||||
if ($action === Params::ACTION_CREATE_AND_UPDATE) {
|
||||
$entity = $this->entityManager->getEntity($this->entityType);
|
||||
$entity = $this->entityManager->getNewEntity($this->entityType);
|
||||
|
||||
if (array_key_exists('id', $whereClause)) {
|
||||
$entity->set('id', $whereClause['id']);
|
||||
@@ -611,7 +615,7 @@ class Import
|
||||
$nameValue = $entity->get($attribute);
|
||||
|
||||
if ($isPerson) {
|
||||
$where = $this->parsePersonName($nameValue, $this->params->getPersonNameFormat());
|
||||
$where = $this->parsePersonName($nameValue, $this->params->getPersonNameFormat() ?? '');
|
||||
}
|
||||
else {
|
||||
$where = [
|
||||
@@ -698,7 +702,7 @@ class Import
|
||||
$lastNameAttribute = 'last' . ucfirst($attribute);
|
||||
$middleNameAttribute = 'middle' . ucfirst($attribute);
|
||||
|
||||
$personNameData = $this->parsePersonName($value, $params->getPersonNameFormat());
|
||||
$personNameData = $this->parsePersonName($value, $params->getPersonNameFormat() ?? '');
|
||||
|
||||
if (!$entity->get($firstNameAttribute) && isset($personNameData['firstName'])) {
|
||||
$personNameData['firstName'] = $this->prepareAttributeValue(
|
||||
|
||||
@@ -123,6 +123,10 @@ class Service
|
||||
$entityType = $source->getTargetEntityType();
|
||||
$attributeList = $source->getTargetAttributeList() ?? [];
|
||||
|
||||
if (!$entityType) {
|
||||
throw new Error("No entity-type.");
|
||||
}
|
||||
|
||||
$params = Params::fromRaw($source->getParams())
|
||||
->withIdleMode(false)
|
||||
->withManualMode(false);
|
||||
@@ -156,11 +160,19 @@ class Service
|
||||
$entityType = $import->getTargetEntityType();
|
||||
$attributeList = $import->getTargetAttributeList() ?? [];
|
||||
|
||||
if (!$entityType) {
|
||||
throw new Error("No entity-type.");
|
||||
}
|
||||
|
||||
$params = Params::fromRaw($import->getParams())
|
||||
->withStartFromLastIndex($startFromLastIndex);
|
||||
|
||||
$attachmentId = $import->getFileId();
|
||||
|
||||
if (!$attachmentId) {
|
||||
throw new Error("No file-id.");
|
||||
}
|
||||
|
||||
return $this->factory
|
||||
->create()
|
||||
->setEntityType($entityType)
|
||||
@@ -255,7 +267,7 @@ class Service
|
||||
*/
|
||||
public function uploadFile(string $contents): string
|
||||
{
|
||||
$attachment = $this->entityManager->getEntity(Attachment::ENTITY_TYPE);
|
||||
$attachment = $this->entityManager->getNewEntity(Attachment::ENTITY_TYPE);
|
||||
|
||||
$attachment->set('type', 'text/csv');
|
||||
$attachment->set('role', 'Import File');
|
||||
|
||||
@@ -167,7 +167,7 @@ class OrdererProcessor
|
||||
->create('KanbanOrder');
|
||||
|
||||
foreach ($ids as $i => $id) {
|
||||
$item = $this->entityManager->getEntity('KanbanOrder');
|
||||
$item = $this->entityManager->getNewEntity('KanbanOrder');
|
||||
|
||||
$item->set([
|
||||
'id' => Util::generateId(),
|
||||
|
||||
@@ -145,6 +145,7 @@ class LayoutManager
|
||||
|
||||
protected function sanitizeInput(string $name): string
|
||||
{
|
||||
/** @var string */
|
||||
return preg_replace("([\.]{2,})", '', $name);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user