Skip to content
This repository has been archived by the owner on Mar 8, 2021. It is now read-only.

Commit

Permalink
fix #1271 childrens should be children
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmi3yy committed Nov 25, 2019
1 parent 8c0334d commit 41f00c6
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion core/src/Controllers/MoveDocument.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ protected function handle()

$parentDocument->isfolder = true;
$parentDocument->save();
if ($document->ancestor && $document->ancestor->childrens()->count() <= 1) {
if ($document->ancestor && $document->ancestor->children()->count() <= 1) {
$document->ancestor->isfolder = false;
$document->ancestor->save();
}
Expand Down
10 changes: 5 additions & 5 deletions core/src/Models/SiteContent.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
* @property SiteTemplate|null $tpl
*
* HasMany
* @property Eloquent\Collection $childrens
* @property Eloquent\Collection $children
* @property Eloquent\Collection $templateValues
*
* BelongsToMany
Expand Down Expand Up @@ -267,12 +267,12 @@ public function getAlreadyEditInfoAttribute(): ?array
/**
* @return array
*/
public function getAllChildrens($parent): array
public function getAllChildren($parent): array
{
$ids = [];
foreach ($parent->childrens as $child) {
foreach ($parent->children as $child) {
$ids[] = $child->id;
$ids = array_merge($ids, $this->getAllChildrens($child));
$ids = array_merge($ids, $this->getAllChildren($child));
}
return $ids;
}
Expand Down Expand Up @@ -344,7 +344,7 @@ public function ancestor(): Eloquent\Relations\BelongsTo
/**
* @return Eloquent\Relations\HasMany
*/
public function childrens(): Eloquent\Relations\HasMany
public function children(): Eloquent\Relations\HasMany
{
return $this->hasMany(__CLASS__, 'parent')
->withTrashed();
Expand Down
2 changes: 1 addition & 1 deletion manager/processors/delete_content.processor.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
$modx->webAlertAndQuit($_lang["access_permission_denied"]);
}

$children = $document->getAllChildrens($document);
$children = $document->getAllChildren($document);

// invoke OnBeforeDocFormDelete event
$modx->invokeEvent("OnBeforeDocFormDelete",
Expand Down
2 changes: 1 addition & 1 deletion manager/processors/undelete_content.processor.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
$modx->webAlertAndQuit("Couldn't find document to determine it's date of deletion!");
}

$children = $document->getAllChildrens($document);
$children = $document->getAllChildren($document);

$documentDeleteIds = $children;
array_unshift($documentDeleteIds, $id);
Expand Down

0 comments on commit 41f00c6

Please sign in to comment.