Closed (fixed)
Project:
Commerce Core
Version:
3.x-dev
Component:
Order
Priority:
Normal
Category:
Task
Assigned:
Reporter:
Created:
16 Jul 2025 at 10:33 UTC
Updated:
6 Aug 2025 at 15:14 UTC
Jump to comment: Most recent
Currently, all of our methods for getting the completed, placed and created timestamps can return strings (even though the documented return type is int (See the example below):
/**
* Gets the order placed timestamp.
*
* @return int
* The order placed timestamp.
*/
public function getPlacedTime();
drush ev "var_dump(\Drupal\commerce_order\Entity\Order::load(120)->getPlacedTime())"
string(10) "1752501150"Also, we need to specify that NULL can be returned and explicitly return NULL when the field is empty.
Let's also return NULL for various other fields for which we aren't explicitly returning NULL (the total price, the email and the IP address for example.
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 #3
jsacksick commentedComment #4
zaporylieLet's target both getPlacedTime and getCompletedTime. Not sure about setting the return type on the interface though - I am all for having it, but this will break things for those who override/decorate the entity class
Comment #5
jsacksick commentedActually, more in favor of increasing the scope and doing this once for all... This change is long overdue and should have been part of 3.0.0
Comment #6
jsacksick commentedComment #7
jsacksick commentedComment #8
jsacksick commentedComment #10
jsacksick commentedOk the change shouldn't be disruptive as I finally skipped return types, will go ahead and merge this.
Comment #12
ivnishIs it fixing my issue https://www.drupal.org/project/commerce/issues/3485574 ?