Model/Sync/Review.php
public function sync()
    {
        $response = ['success' => true, 'message' => 'Done.'];

        $this->countReviews = 0;
        $this->reviews      = [];
        $this->start        = microtime(true);
        $websites           = $this->helper->getwebsites(true);
        foreach ($websites as $website) {
            $apiEnabled = $this->helper->isEnabled($website);
            $reviewEnabled = $this->helper->getWebsiteConfig(
                \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_SYNC_REVIEW_ENABLED,
                $website
            );
            $storeIds = $website->getStoreIds();
            if ($apiEnabled && $reviewEnabled && !empty($storeIds)) {
                $this->_exportReviewsForWebsite($website);
            }

            if (isset($this->reviews[$website->getId()])) {
                $reviews = $this->reviews[$website->getId()];
                //send reviews as transactional data
                //register in queue with importer
                $this->importerFactory->create()
                    ->registerQueue(
                        \Dotdigitalgroup\Email\Model\Importer::IMPORT_TYPE_REVIEWS,
                        $reviews,
                        \Dotdigitalgroup\Email\Model\Importer::MODE_BULK,
                        $website->getId()
                    );
                //if no error then set imported
                $this->_setImported($this->reviewIds);
                $this->countReviews += count($reviews);
            }
        }

        if ($this->countReviews) {
            $message = '----------- Review sync ----------- : ' .
                gmdate('H:i:s', microtime(true) - $this->start) .
                ', synced = ' . $this->countReviews;
            $this->helper->log($message);
            $response['message'] = $message;
        }

        return $response;
    }
public function sync()
    {
        $response = ['success' => true, 'message' => 'Done.'];

        $this->countReviews = 0;
        $this->reviews      = [];
        $this->start        = microtime(true);
        $websites           = $this->helper->getwebsites(true);
        foreach ($websites as $website) {
            $apiEnabled = $this->helper->isEnabled($website);
            $reviewEnabled = $this->helper->getWebsiteConfig(
                \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_SYNC_REVIEW_ENABLED,
                $website
            );
            $storeIds = $website->getStoreIds();
            if ($apiEnabled && $reviewEnabled && !empty($storeIds)) {
                $this->_exportReviewsForWebsite($website);
            }

            if (isset($this->reviews[$website->getId()])) {
                $reviews = $this->reviews[$website->getId()];
                //send reviews as transactional data
                //register in queue with importer
                $this->importerFactory->create()
                    ->registerQueue(
                        \Dotdigitalgroup\Email\Model\Importer::IMPORT_TYPE_REVIEWS,
                        $reviews,
                        \Dotdigitalgroup\Email\Model\Importer::MODE_BULK,
                        $website->getId()
                    );
                //if no error then set imported
                $this->_setImported($this->reviewIds);
                $this->countReviews += count($reviews);
            }
        }

        if ($this->countReviews) {
            $message = '----------- Review sync ----------- : ' .
                gmdate('H:i:s', microtime(true) - $this->start) .
                ', synced = ' . $this->countReviews;
            $this->helper->log($message);
            $response['message'] = $message;
        }

        return $response;
    }
public function sync ( ) { $ response = [ 'success' => true , 'message' => 'Done.' ] ; $ this -> countReviews = 0 ; $ this -> reviews = [ ] ; $ this -> start = microtime ( true ) ; $ websites = $ this -> helper -> getwebsites ( true ) ; foreach ( $ websites as $ website ) { $ apiEnabled = $ this -> helper -> isEnabled ( $ website ) ; $ reviewEnabled = $ this -> helper -> getWebsiteConfig ( \ Dotdigitalgroup \ Email \ Helper \ Config :: XML_PATH_CONNECTOR_SYNC_REVIEW_ENABLED , $ website ) ; $ storeIds = $ website -> getStoreIds ( ) ; if ( $ apiEnabled && $ reviewEnabled && ! empty ( $ storeIds ) ) { $ this -> _exportReviewsForWebsite ( $ website ) ; } if ( isset ( $ this -> reviews [ $ website -> getId ( ) ] ) ) { $ reviews = $ this -> reviews [ $ website -> getId ( ) ] ; //send reviews as transactional data //register in queue with importer $ this -> importerFactory -> create ( ) -> registerQueue ( \ Dotdigitalgroup \ Email \ Model \ Importer :: IMPORT_TYPE_REVIEWS , $ reviews , \ Dotdigitalgroup \ Email \ Model \ Importer :: MODE_BULK , $ website -> getId ( ) ) ; //if no error then set imported $ this -> _setImported ( $ this -> reviewIds ) ; $ this -> countReviews += count ( $ reviews ) ; } } if ( $ this -> countReviews ) { $ message = '----------- Review sync ----------- : ' . gmdate ( 'H:i:s' , microtime ( true ) - $ this -> start ) . ', synced = ' . $ this -> countReviews ; $ this -> helper -> log ( $ message ) ; $ response [ 'message' ] = $ message ; } return $ response ; }
Sync reviews.

@return array
Sync reviews .