customerFactory = $customerFactory; parent::__construct($context, $data); $this->setSyncStatusData(); } /** * @return $this * @throws \Magento\Framework\Exception\LocalizedException */ public function setSyncStatusData() { $customersData = $this->customerFactory->create() ->addAttributeToFilter([ ['attribute' => self::AC_SYNC_STATUS,'null' => true ], ['attribute' => self::AC_SYNC_STATUS,'eq' => CronConfig::SYNCED ], ['attribute' => self::AC_SYNC_STATUS,'eq' => CronConfig::NOT_SYNCED ], ['attribute' => self::AC_SYNC_STATUS,'eq' => CronConfig::FAIL_SYNCED ] ])->getData(); $this->totalCustomer = count($customersData); $this->syncedCustomer = count(array_keys(array_column($customersData, self::AC_SYNC_STATUS), CronConfig::SYNCED)); $this->notSyncedCustomer = count(array_keys(array_column($customersData, self::AC_SYNC_STATUS), CronConfig::NOT_SYNCED)); $this->failSyncedCustomer = count(array_keys(array_column($customersData, self::AC_SYNC_STATUS), CronConfig::FAIL_SYNCED)); return $this; } }