diff --git a/app/code/Magento/Customer/Model/Address.php b/app/code/Magento/Customer/Model/Address.php index ea9b103f42273..9d4866f4319db 100644 --- a/app/code/Magento/Customer/Model/Address.php +++ b/app/code/Magento/Customer/Model/Address.php @@ -332,10 +332,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']); return parent::afterSave(); } diff --git a/app/code/Magento/Customer/Model/Customer.php b/app/code/Magento/Customer/Model/Customer.php index 2692d1edf0143..51ee4a947c9e1 100644 --- a/app/code/Magento/Customer/Model/Customer.php +++ b/app/code/Magento/Customer/Model/Customer.php @@ -62,7 +62,7 @@ class Customer extends \Magento\Framework\Model\AbstractModel const XML_PATH_RESET_PASSWORD_TEMPLATE = 'customer/password/reset_password_template'; /** - * @deprecated + * @deprecated due to movement of the account confirmation into another class * @see AccountConfirmation::XML_PATH_IS_CONFIRM */ const XML_PATH_IS_CONFIRM = 'customer/create_account/confirm'; @@ -1075,10 +1075,7 @@ public function resetErrors() */ 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(); } diff --git a/app/code/Magento/Customer/Setup/RecurringData.php b/app/code/Magento/Customer/Setup/Patch/Data/ReindexCustomerGrid.php similarity index 50% rename from app/code/Magento/Customer/Setup/RecurringData.php rename to app/code/Magento/Customer/Setup/Patch/Data/ReindexCustomerGrid.php index fbef4c05d126d..edc72500665af 100644 --- a/app/code/Magento/Customer/Setup/RecurringData.php +++ b/app/code/Magento/Customer/Setup/Patch/Data/ReindexCustomerGrid.php @@ -4,18 +4,16 @@ * 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 @@ -23,21 +21,36 @@ class RecurringData implements InstallDataInterface 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 []; + } }