-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merged PR 54830: Product created_date falls back to old date if missing
## What's being changed The product schema for catalog sync. Products without a `created_at` value will now have the `created_date` of '1970-01-01 01:00:00' (not '1970-01-01 00:00:00' because that ends up returning the current time, it must be after the start of the Unix epoch). ## Why it's being changed Somehow it is possible for catalog products to have no `created_at` value. ## How to review / test this change - Erase the created_at value for a product row in catalog_product_entity (or replace `$product->getCreatedAt()` with null in the code) - Now try to sync the matching product - Import data should show 1970-01-01 as the created_date - Data should be successfully imported into DD ## Notes As an alternative we could simply unset created_date if not supplied, but my understanding was this value was important for some functionality platform-side. Related work items: #257276
- Loading branch information
Showing
4 changed files
with
43 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
namespace Dotdigitalgroup\Email\Model\Validator\Schema\Rule; | ||
|
||
class DateFormatAtomRule implements ValidatorRuleInterface | ||
{ | ||
/** | ||
* Validate ATOM date format | ||
* | ||
* @param mixed $value | ||
* @return bool | ||
*/ | ||
public function passes($value):bool | ||
{ | ||
$date = \DateTime::createFromFormat(\DateTimeInterface::ATOM, $value); | ||
$formattedDate = $date->format(\DateTimeInterface::ATOM); | ||
return ($formattedDate === $value); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters