I'm working on the performance of a code block that contains 3 lines that are the main contributors to latency:

  • A paragraph library item is loaded from the DB
  • A paragraph is loaded from the DB using library items reference
  • The above paragraphs render array is generated from ->getViewBuilder()->view()

I originally figured it was these loads from the DB that were the biggest culprits, but it turns out that ->getViewBuilder()->view() is.

When I have a loaded entity, is it possible to get its render array from it without calling ->getViewBuilder()->view()? Alternatively, can I get a render array from just an entity ID without first loading it?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.