get(EntityManager::class); $subscribersRepository = ContainerWrapper::getInstance()->get(SubscribersRepository::class); $subscribersTable = $entityManager->getClassMetadata(SubscriberEntity::class)->getTableName(); $connection = $entityManager->getConnection(); $count = $subscribersRepository->countBy(['linkToken' => null]); if ($count) { $authKey = defined('AUTH_KEY') ? AUTH_KEY : ''; $connection->executeStatement( "UPDATE {$subscribersTable} SET link_token = SUBSTRING(MD5(CONCAT(:authKey, email)), 1, :tokenLength) WHERE link_token IS NULL LIMIT :limit", ['authKey' => $authKey, 'tokenLength' => SubscriberEntity::OBSOLETE_LINK_TOKEN_LENGTH, 'limit' => self::BATCH_SIZE], ['authKey' => ParameterType::STRING, 'tokenLength' => ParameterType::INTEGER, 'limit' => ParameterType::INTEGER] ); $this->schedule(); } return true; } public function getNextRunDate() { return Carbon::now()->millisecond(0); } }