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
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
slackerzz marked this conversation as resolved.
Show resolved Hide resolved
return parent::afterSave();
}

Expand Down
7 changes: 2 additions & 5 deletions app/code/Magento/Customer/Model/Customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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();
}

Expand Down
Original file line number Diff line number Diff line change
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 [];
}
}