Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Magento/Customer/Setup/RecurringData.php #21235

5 changes: 1 addition & 4 deletions app/code/Magento/Customer/Model/Address.php
Expand Up @@ -325,10 +325,7 @@ public function getEntityTypeId()
*/
public function afterSave()
{
$indexer = $this->indexerRegistry->get(Customer::CUSTOMER_GRID_INDEXER_ID);
if ($indexer->getState()->getStatus() == StateInterface::STATUS_VALID) {
$this->_getResource()->addCommitCallback([$this, 'reindex']);
}
$this->_getResource()->addCommitCallback([$this, 'reindex']);
slackerzz marked this conversation as resolved.
Show resolved Hide resolved
return parent::afterSave();
}

Expand Down
5 changes: 1 addition & 4 deletions app/code/Magento/Customer/Model/Customer.php
Expand Up @@ -1072,10 +1072,7 @@ public function beforeDelete()
*/
public function afterSave()
{
$indexer = $this->indexerRegistry->get(self::CUSTOMER_GRID_INDEXER_ID);
if ($indexer->getState()->getStatus() == StateInterface::STATUS_VALID) {
$this->_getResource()->addCommitCallback([$this, 'reindex']);
}
$this->_getResource()->addCommitCallback([$this, 'reindex']);
return parent::afterSave();
}

Expand Down
Expand Up @@ -4,40 +4,53 @@
* See COPYING.txt for license details.
*/

namespace Magento\Customer\Setup;
namespace Magento\Customer\Setup\Patch\Data;

use Magento\Framework\Indexer\IndexerRegistry;
use Magento\Framework\Setup\InstallDataInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\Customer\Model\Customer;
use Magento\Framework\Indexer\IndexerRegistry;
use Magento\Framework\Setup\Patch\DataPatchInterface;

/**
* Upgrade registered themes.
* Reindex customer grid during setup process.
*/
class RecurringData implements InstallDataInterface
class ReindexCustomerGrid implements DataPatchInterface
{
/**
* @var IndexerRegistry
*/
private $indexerRegistry;

/**
* Init
*
* @param IndexerRegistry $indexerRegistry
*/
public function __construct(IndexerRegistry $indexerRegistry)
{
public function __construct(
IndexerRegistry $indexerRegistry
) {
$this->indexerRegistry = $indexerRegistry;
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
public function apply()
{
$indexer = $this->indexerRegistry->get(Customer::CUSTOMER_GRID_INDEXER_ID);
$indexer->reindexAll();
}

/**
* @inheritdoc
*/
public static function getDependencies()
{
return [];
}

/**
* @inheritdoc
*/
public function getAliases()
{
return [];
}
}