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

Add path enumerable trait #155

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from
Prev Previous commit
Next Next commit
Fix comments
  • Loading branch information
bennothommo committed Dec 12, 2023
commit f27ded72e48293cbd2521832c24a82923998d3a4
12 changes: 10 additions & 2 deletions src/Database/Traits/PathEnumerable.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,14 @@ public function getEnumerablePath(): string
return '/' . $this->getEnumerableSegment();
}

/**
* Gets the column that determines each segment of the path.
*
* You can change the column that makes up the path segments by defining another column name in the `$segmentColumn`
* property.
*
* @return string
*/
public function getSegmentColumn(): string
{
if (!property_exists($this, 'segmentColumn')) {
Expand Down Expand Up @@ -272,7 +280,7 @@ public function storeNewParent(): void
/**
* Moves a record, and all of its children, to a new parent.
*
* This will update the enumerated paths of all records.
* This will update the enumerated paths of all records affected.
*/
public function moveToNewParent(): void
{
Expand Down Expand Up @@ -307,7 +315,7 @@ public function deleteDescendants(): void
}

/**
* Deletes all descendants.
* Restores all descendants.
*/
public function restoreDescendants(): void
{
Expand Down
Loading