Skip to content

Commit

Permalink
feat: Added NodesSources getListingSortOptions method
Browse files Browse the repository at this point in the history
  • Loading branch information
ambroisemaupate committed Aug 28, 2023
1 parent a73b5b2 commit 26ff61f
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions lib/RoadizCoreBundle/src/Entity/NodesSources.php
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,31 @@ public function isReachable(): bool
return $this->getNode()->getNodeType()->isReachable();
}

/**
* @return array
*/
#[Serializer\Groups(['node_listing'])]
public function getListingSortOptions(): array
{
return match ($this->getNode()->getChildrenOrder()) {
'position' => [
'node.position' => $this->getNode()->getChildrenOrderDirection()
],
'nodeName' => [
'node.nodeName' => $this->getNode()->getChildrenOrderDirection()
],
'createdAt' => [
'node.createdAt' => $this->getNode()->getChildrenOrderDirection()
],
'updatedAt' => [
'node.updatedAt' => $this->getNode()->getChildrenOrderDirection()
],
default => [
'publishedAt' => $this->getNode()->getChildrenOrderDirection()
],
};
}

/**
* After clone method.
*
Expand Down

0 comments on commit 26ff61f

Please sign in to comment.