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

[DataObject\Document] getChildren & getSiblings shouldn't load the listing #13899

Merged
merged 5 commits into from
Jan 3, 2023

Conversation

dvesh3
Copy link
Contributor

@dvesh3 dvesh3 commented Dec 23, 2022

Changes in this pull request

Resolves #11737

Additional info

@dvesh3 dvesh3 added this to the 11.0.0 milestone Dec 23, 2022
@github-actions
Copy link

github-actions bot commented Dec 23, 2022

Review Checklist

  • Target branch (10.5 for bug fixes, others 11.x)
  • Tests (if it's testable code, there should be a test for it - get help)
  • Docs (every functionality needs to be documented, see here)
  • Migration incl. install.sql (e.g. if the database schema changes, ...)
  • Upgrade notes (deprecations, important information, migration hints, ...)
  • Label
  • Milestone

@dvesh3 dvesh3 marked this pull request as ready for review December 23, 2022 16:08
@robertSt7 robertSt7 merged commit 6dd1f96 into 11.x Jan 3, 2023
@robertSt7 robertSt7 deleted the get_children_load branch January 3, 2023 11:28
@blankse
Copy link
Contributor

blankse commented Jan 9, 2023

@dvesh3 Why is only the getChildren() method changed of the Document Model and not the getSiblings() method?

@blankse
Copy link
Contributor

blankse commented Jan 9, 2023

And why isn't changed the Asset model to be consistent?

@@ -597,7 +594,7 @@ public function getChildren(bool $includingUnpublished = false): array
$list->setCondition('parentId = ?', $this->getId());
$list->setOrderKey('index');
$list->setOrder('asc');
$this->children[$cacheKey] = $list->load();
$this->children[$cacheKey] = $list;
} else {
$this->children[$cacheKey] = [];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dvesh3 The return type doesn't allow an array. Should be also a listing. Or should we return null if no Listing is possible?

Comment on lines +674 to +676
$listing = $target->getChildren();
$listing->setData(array_merge($listing->getData(), [$newElement]));
$target->setChildren($listing);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also used for Assets. So we must change it also there.

@dvesh3
Copy link
Contributor Author

dvesh3 commented Jan 9, 2023

@blankse thanks for the review. yes, we missed few points here so i'll create a follow up PR. thanks!

robertSt7 pushed a commit that referenced this pull request Jan 23, 2023
…low up to #13899 (#14008)

* [Elements] getChildren & getSiblings shouldn't load the listing - follow up to #13899

* [Elements] getChildren & getSiblings shouldn't load the listing - follow up to #13899

* [Elements] getChildren & getSiblings shouldn't load the listing - follow up to #13899

* [Elements] getChildren & getSiblings shouldn't load the listing - follow up to #13899

* Update models/Asset.php

Co-authored-by: Sebastian Blank <[email protected]>

* [Elements] getChildren & getSiblings shouldn't load the listing - follow up to #13899

* [Elements] getChildren & getSiblings shouldn't load the listing - follow up to #13899

* [Elements] getChildren & getSiblings shouldn't load the listing - follow up to #13899

* [Elements] getChildren & getSiblings shouldn't load the listing - follow up to #13899

* [Elements] getChildren & getSiblings shouldn't load the listing - follow up to #13899

Co-authored-by: Sebastian Blank <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

getChildren shouldn't load the listing
3 participants