Extend Drupal\fluent\Collection to Support firstWhere method Description:

Created on 22 October 2023, about 1 year ago
Updated 16 January 2024, 10 months ago

Add support for the firstWhere method in the Drupal\fluent\Collection class.
Ensure that it properly interfaces with ContentEntityInterface instances to retrieve values using Fluent.
Write tests to ensure that the method works correctly when called on a collection of paragraphs or nodes.

📌 Task
Status

Active

Version

10.1

Component

Code

Created by

🇲🇽Mexico dmouse Mexico City

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @dmouse
  • 🇲🇽Mexico dmouse Mexico City
  • First commit to issue fork.
  • 🇦🇷Argentina tguerineau

    Hi,

    I've been working on the issue described here and have made progress in implementing the feature. Below is a brief overview of the changes and updates made:

    1. Implementation Details: firstWhere method added in the src/Collection.php file.

    2. Manual testing that I made (using Devel module):

    • Conducted tests with collections of nodes, ensuring that the method 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.

    3. Automated Tests: Unfortunately, I am currently facing issues with my test environment, which has prevented me from creating automated tests for these changes.

    4. Merge Request: I have created a Merge Request (MR) with the code for the implemented method.

    Thank you for considering these updates, and I look forward to your feedback.

Production build 0.71.5 2024