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

Entity load multiple needed? #11

Open
laryn opened this issue Feb 7, 2023 · 4 comments · May be fixed by #12
Open

Entity load multiple needed? #11

laryn opened this issue Feb 7, 2023 · 4 comments · May be fixed by #12
Labels

Comments

@laryn
Copy link
Member

laryn commented Feb 7, 2023

I was looking through a codebase for something else and happened to see this line:

foreach (entity_load('file', FALSE, array('uri' => $uri)) as $file) {

It looks like that is an outdated use of entity_load that should be changed to entity_load_multiple.

laryn added a commit to laryn/views_data_export that referenced this issue Feb 7, 2023
@laryn laryn linked a pull request Feb 7, 2023 that will close this issue
@herbdool herbdool added the bug label Mar 9, 2023
@herbdool
Copy link
Contributor

herbdool commented Mar 9, 2023

Your PR works for me @laryn

@argiepiano
Copy link

This change is fine for clarity, but entity_load() in Backdrop actually invokes entity_load_multiple() if it finds that the second argument is an array or FALSE or NULL... so in the end the correct function is used either way.

@laryn
Copy link
Member Author

laryn commented Mar 11, 2023

Yes, I think I went on a little spree one day after greping my codebase and @argiepiano corrected me on another thread too. Oops!

@argiepiano
Copy link

To be honest I prefer entity_load_multiple()!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants