Skip to content

Commit

Permalink
[Elements] getChildren & getSiblings shouldn't load the listing - fol…
Browse files Browse the repository at this point in the history
…low up to #13899
  • Loading branch information
dvesh3 committed Jan 9, 2023
1 parent 3608386 commit 566d7d6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
10 changes: 3 additions & 7 deletions models/Asset.php
Original file line number Diff line number Diff line change
Expand Up @@ -904,17 +904,13 @@ public function getSiblings(): Listing
return $this->siblings;
}

public function hasSiblings(): ?bool
public function hasSiblings(): bool
{
if (is_bool($this->hasSiblings)) {
if (($this->hasSiblings && empty($this->siblings->getAssets())) || (!$this->hasSiblings && !empty($this->siblings->getAssets()))) {
return $this->getDao()->hasSiblings();
} else {
return $this->hasSiblings;
}
return $this->hasSiblings;
}

return $this->getDao()->hasSiblings();
return $this->hasSiblings = $this->getDao()->hasSiblings();
}

public function hasChildren(): bool
Expand Down
6 changes: 1 addition & 5 deletions models/Asset/Folder.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,10 @@ public function getChildren(): Listing
public function hasChildren(): bool
{
if (is_bool($this->hasChildren)) {
if (($this->hasChildren && empty($this->children->getAssets())) || (!$this->hasChildren && !empty($this->children->getAssets()))) {
return $this->getDao()->hasChildren();
}

return $this->hasChildren;
}

return $this->getDao()->hasChildren();
return $this->hasChildren = $this->getDao()->hasChildren();
}

/**
Expand Down

0 comments on commit 566d7d6

Please sign in to comment.