- Issue created by @dmouse
Enhance the Drupal\fluent\Collection class to integrate and optimize various "where" methods for Drupal entities, primarily those implementing the ContentEntityInterface.
Laravel's Collection offers multiple "where" methods that provide filtering capabilities on the collection. Our aim is to optimize these methods for Drupal entities, ensuring compatibility and efficiency with the Drupal entity system through Fluent's capabilities.
Review the "where" methods in Laravel Collection to understand their core behavior.
Identify the specific nuances and challenges when dealing with Drupal entities.
For each "where" method, create an override in the Drupal\fluent\Collection class.
Leverage the custom logic in operatorForWhere to ensure correct handling of Drupal entities. This involves checking if an item belongs to ContentEntityInterface and fetching its values accordingly.
Draft unit tests for each newly overridden "where" method, ensuring their correct functionality with Drupal entities and standard data.
Create test cases that encompass both positive and negative outcomes.
Incorporate the overridden methods into real-world Drupal scenarios, such as filtering a collection of nodes using Fluent Collection.
Validate that the results align with expectations and that no unexpected behaviors or errors surface.
Once the "where" methods are successfully integrated, our long-term vision is to extend support for all methods present in the Laravel Collection library, broadening the capabilities of the Fluent module.
Upon completing this task, the Drupal\fluent\Collection class should proficiently support the "where" methods, ensuring compatibility with Drupal entities. Developers can then effortlessly utilize these methods, reaping the benefits of both Laravel's collection functionality and Drupal's robust entity system.
Active
10.1
Code