How to get the Product Entity targeted in a Scheduled Update?

I am using 2.3.x Magento Enterprise.

I am able to get the schedules updates. And for brevity I'm using the Object Manager in my example as a proof of concept:

$om = ObjectManager::getInstance();
/** @var \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria */
$searchCriteria = $om->get(\Magento\Framework\Api\SearchCriteriaInterface::class);
/** @var \Magento\Staging\Model\UpdateRepository $updateRepo */
$updateRepo = $om->get(\Magento\Staging\Api\UpdateRepositoryInterface::class);
/** @var \Magento\Staging\Model\ResourceModel\Update\Collection $updateList */
$updatesList = $updateRepo->getList($searchCriteria);
/** @var array $updateArray */
$updatesArray = $updatesList->getItems();

foreach ($updatesArray as $update) {
    /** @var \Magento\Staging\Model\Update $update */
}

I will further filter my results, (out of scope of my question) but I want to know how to get the Product entity that is related to my update (if it exists).

If I go into the admin to Content > Content Staging Dashboard I can see my target update and there is a product associated to that Update. It says

This update includes 1 Objects

And underneath it, there is a link to the update where the data for my Product resides.

How can I get that Product through the Magento\Staging\Model\Update or something similar?



from Active questions tagged magento-enterprise - Magento Stack Exchange

Click link to view all answer https://magento.stackexchange.com/questions/298450/how-to-get-the-product-entity-targeted-in-a-scheduled-update