Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
We will soon have pricing and payment APIs that require price values as arguments.
The problem with the object used for entity fields is that it can't be instantiated standalone, which means people can't pass their own amounts without creating an entity first, and then using that entity's field item. That's clunky. Instead, let's introduce a value object for this purpose.
Plan:
- Rename Price to PriceItem (matches core conventions)
- Add a Price value object (no interface, getDecimalAmount, getCurrencyCode)
- Add PriceItem::toPrice(), and allow setValue() to accept the price.
Comments
Comment #3
bojanz CreditAttribution: bojanz at Centarro commentedDone.