Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Data Object] Provide properties for sorting #694

Merged
merged 2 commits into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/DataIndex/Hydrator/DataObject/FolderHydrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ public function hydrate(Folder $item): DataObjectFolder
$item->getFullPath(),
$this->permissionsHydrator->hydrate($item->getPermissions()),
$item->getIndex(),
$item->getChildrenSortBy(),
$item->getChildrenSortOrder(),
$item->getId(),
$item->getParentId(),
$item->getPath(),
Expand Down
2 changes: 2 additions & 0 deletions src/DataIndex/Hydrator/DataObjectHydrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ public function hydrate(DataObjectSearchResultItem $dataObject): DataObject
$dataObject->getFullPath(),
$this->permissionsHydrator->hydrate($dataObject->getPermissions()),
$dataObject->getIndex(),
$dataObject->getChildrenSortBy(),
$dataObject->getChildrenSortOrder(),
$dataObject->getId(),
$dataObject->getParentId(),
$dataObject->getPath(),
Expand Down
14 changes: 14 additions & 0 deletions src/DataObject/Schema/DataObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ public function __construct(
private readonly DataObjectPermissions $permissions,
#[Property(description: 'Custom index', type: 'integer', example: 0)]
private readonly int $index,
#[Property(description: 'Sort mode of children', type: 'string', example: 'index')]
private readonly string $childrenSortBy,
#[Property(description: 'Sort order of children', type: 'string', example: 'asc')]
private readonly string $childrenSortOrder,
int $id,
int $parentId,
string $path,
Expand Down Expand Up @@ -153,6 +157,16 @@ public function getIndex(): int
return $this->index;
}

public function getChildrenSortBy(): string
{
return $this->childrenSortBy;
}

public function getChildrenSortOrder(): string
{
return $this->childrenSortOrder;
}

public function setObjectData(array $objectData): void
{
$this->objectData = $objectData;
Expand Down
Loading