Problem/Motivation
I'm profiling a drush script that exports a large number of entities to CSV.
A lot of time is pent in normalizing the entities, even though only a subset of fields are required.
JSON:API's ResourceObjectNormalizer supports $context['sparse_fields'] to restrict the number of fields that need to be normalized.
However when normalizing to csv or other formats via drush or similar, there is no such equivalent. We can adopt the same approach.
Steps to reproduce
Proposed resolution
Support $context['sparse_fieldset'] in EntityNormalizer and ContentEntityNormalizer.
Remaining tasks
User interface changes
Introduced terminology
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|
Issue fork drupal-3599844
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
catchComment #4
catchThis doesn't work in ComplexDataNormalizer because it's recursive, but it can work one level up in EntityNormalizer.
Comment #5
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #6
catchComment #7
catchCoving both EntityNormalizer and ContentEntityNormalizer now, also added test coverage to their respective unit tests.