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

Fix method signatures in Element::setEagerLoadedElements() example #662

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/5.x/extend/element-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -1151,14 +1151,14 @@ You may be able to create the source-target map without another database query,
If you need to override where eager-loaded elements are stored, add a `setEagerLoadedElements()` method to your element class as well:

```php
public function setEagerLoadedElements(string $handle, array $elements): void
public function setEagerLoadedElements(string $handle, array $elements, EagerLoadPlan $plan): void
{
// The handle can be anything, so long as it matches what is used in `eagerLoadingMap()`:
if ($handle === 'author') {
$author = $elements[0] ?? null;
$this->setAuthor($author);
} else {
parent::setEagerLoadedElements($handle, $elements);
parent::setEagerLoadedElements($handle, $elements, $plan);
}
}
```
Expand Down