- Issue created by @dmouse
- First commit to issue fork.
- 🇦🇷Argentina tguerineau
Hi,
I've been working on the issue.
Here's a summary of the approach and the progress made:Implementation Details:
- Enhanced the
filter
method inCollection
to differentiate between Drupal entities and non-entity items. - Added a
processEntityFields
method to simplify entity fields for consistent handling by the filter method's callback. - The
whereNotNull
method utilizes this updatedfilter
method to check for non-null values in both entities and non-entity items, making it versatile across various types of collections.
Manual testing that I made (using Devel module):
- Conducted tests with collections of nodes, ensuring that
whereNotNull
works as expected, particularly for fields within nodes. - Verified the functionality with non-entity items to ensure broad applicability.
- Tests included various scenarios, including fields with simple values and more complex structures like paragraphs.
- All tests indicate that the method behaves correctly, filtering items based on the presence of non-null field values.
I am in the process of designing and implementing tests that will be added to ensure the correct operation of the whereNotNull method with collections of paragraphs or nodes, as per the issue description.
I look forward to your feedback.
- Enhanced the
- Merge request !173395886-Implement the whereNotNull method for Collection class → (Open) created by tguerineau
- 🇦🇷Argentina tguerineau
Hi,
I wanted to provide an update on the Merge Request. Based on further review and considerations regarding performance, I have updated the Merge Request with a new approach that enhances performance.
Here's a summary of the revised implementation:
1. Revised Approach: The previous implementation involved enhancing the `filter` method and adding a `processEntityFields` method to handle both Drupal entities and non-entity items. However, this approach, while functional, had potential performance implications, especially when dealing with large collections or complex entities.
2. New Implementation: The new whereNotNull method has been streamlined to directly check the existence and non-nullity of the specified field in the collection items.