Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
4rthem committed Nov 25, 2024
1 parent 285abc5 commit e4d6e47
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion databox/api/src/Api/Provider/FieldTypeProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ protected function provideCollection(
$t->setName($name);

return $t;
}, $this->attributeTypeRegistry->getTypes());
}, array_filter($this->attributeTypeRegistry->getTypes(), fn (AttributeTypeInterface $type): bool => $type->isListed()));

usort($results, fn (FieldType $a, FieldType $b): int => $a->getTitle() <=> $b->getTitle());

Expand Down
5 changes: 5 additions & 0 deletions databox/api/src/Attribute/Type/AbstractAttributeType.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,9 @@ public function supportsElasticSearchFuzziness(): bool
{
return false;
}

public function isListed(): bool
{
return true;
}
}
2 changes: 2 additions & 0 deletions databox/api/src/Attribute/Type/AttributeTypeInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,6 @@ public function validate($value, ExecutionContextInterface $context): void;
public function getAggregationField(): ?string;

public function normalizeBucket(array $bucket): ?array;

public function isListed(): bool;
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,9 @@ public function supportsAggregation(): bool
{
return true;
}

public function isListed(): bool
{
return false;
}
}
4 changes: 3 additions & 1 deletion lib/php/es-bundle/Indexer/DependencyStack.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function __construct(
private readonly array $currentBatch,
array $previousParents
) {
$this->parents = array_map(fn (string $c): string => ClassUtils::getRealClass($c), $previousParents);
$this->parents = $previousParents;
}

public function getParents(): array
Expand All @@ -50,6 +50,7 @@ public function getObjects(): array

public function addDependency(string $class, string $id, Operation $operation = Operation::Upsert): self
{
$class = ClassUtils::getRealClass($class);
if (
(isset($this->parents[$class]) && $this->parents[$class]->has($id))
|| $this->isInBatch($class, $id)
Expand Down Expand Up @@ -90,6 +91,7 @@ private function isInBatch(string $class, string $id): bool

public function addParent(string $class, string $id): void
{
$class = ClassUtils::getRealClass($class);
$this->parents[$class] ??= new EntityGroup();
$this->parents[$class]->add($id);
}
Expand Down

0 comments on commit e4d6e47

Please sign in to comment.