Export single wishlist for website.

@param \Magento\Store\Api\Data\WebsiteInterface $website

@return null
198834
public function exportWishlistForWebsiteInSingle(\Magento\Store\Api\Data\WebsiteInterface $website)
    {
        //transactional data limit
        $limit             = $this->helper->getWebsiteConfig(
            \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_TRANSACTIONAL_DATA_SYNC_LIMIT,
            $website
        );
        $collection        = $this->getModifiedWishlistToImport(
            $website,
            $limit
        );
        $this->wishlistIds = [];
        //email_wishlist wishlist ids
        $wishlistIds = $collection->getColumnValues('wishlist_id');

        $wishlistCollection = $this->wishlist->create()
                                             ->getWishlistByIds($wishlistIds);

        foreach ($wishlistCollection as $wishlist) {
            $wishlistId    = $wishlist->getid();
            $wishlistItems = $this->itemCollection->create()
                                                  ->addWishlistFilter($wishlist);

            $connectorWishlist = $this->wishlistFactory->create();
            $connectorWishlist->setId($wishlistId)
                              ->setUpdatedAt($wishlist->getUpdatedAt())
                              ->setCustomerId($wishlist->getCustomerId())
                              ->setEmail($wishlist->getEmail());

            if ($wishlistItems->getSize()) {
                /** @var \Magento\Wishlist\Model\Item $item */
                foreach ($wishlistItems as $item) {
                    try {
                        $product = $item->getProduct();
                        $connectorWishlistItem = $this->createConnectorWishlistItem($product, $item);
                        if ($connectorWishlistItem) {
                            $connectorWishlist->setItem($connectorWishlistItem);
                        }
                        $this->countWishlists++;
                    } catch (\Exception $e) {
                        //Product does not exist. Continue to next item
                        continue;
                    }
                }
                //send wishlist as transactional data
                $this->start = microtime(true);
                //register in queue with importer
                $check = $this->importerFactory->create()
                                               ->registerQueue(
                                                   Importer::IMPORT_TYPE_WISHLIST,
                                                   $connectorWishlist->expose(),
                                                   Importer::MODE_SINGLE,
                                                   $website->getId()
                                               );
                if ($check) {
                    $this->wishlistIds[] = $wishlistId;
                }
            } else {
                //register in queue with importer
                $check = $this->importerFactory->create()
                                               ->registerQueue(
                                                   Importer::IMPORT_TYPE_WISHLIST,
                                                   [$wishlist->getId()],
                                                   Importer::MODE_SINGLE_DELETE,
                                                   $website->getId()
                                               );
                if ($check) {
                    $this->wishlistIds[] = $wishlistId;
                }
            }
        }
        if (! empty($this->wishlistIds)) {
            $this->setImported($this->wishlistIds, true);
        }
    }
1185051
public function export()
	{
		$view = $this->getView();
		$context = $this->getContext();

		try
		{
			$params = $this->storeSearchParams( $view->param(), 'order' );
			$msg = ['sitecode' => $context->getLocale()->getSite()->getCode()];

			if( isset( $params['filter'] ) ) {
				$msg['filter'] = $this->getCriteriaConditions( $params['filter'] );
			}

			if( isset( $params['sort'] ) ) {
				$msg['sort'] = $this->getCriteriaSortations( $params['sort'] );
			}

			$mq = $context->getMessageQueueManager()->get( 'mq-admin' )->getQueue( 'order-export' );
			$mq->add( json_encode( $msg ) );

			$msg = $context->getI18n()->dt( 'admin', 'Your export will be available in a few minutes for download' );
			$view->info = $view->get( 'info', [] ) + ['order-item' => $msg];
		}
		catch( \Aimeos\MShop\Exception $e )
		{
			$error = array( 'order-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) );
			$view->errors = $view->get( 'errors', [] ) + $error;
			$this->logException( $e );
		}
		catch( \Exception $e )
		{
			$error = array( 'order-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() );
			$view->errors = $view->get( 'errors', [] ) + $error;
			$this->logException( $e );
		}

		return $this->search();
	}
389737
public function export($item, array $extraAttributes = []): array
    {
        /** @var CategoryGroup $item */
        $attributeObj = [];
        $extraAttributes = array_merge($extraAttributes, $this->additionalAttributes(\get_class($item)));
        foreach($extraAttributes as $attribute) {
            $attributeObj[$attribute] = $item->$attribute;
        }

        $categoryGroupObj = array_merge([
            'name' => $item->name,
            'handle' => $item->handle,
            'maxLevels' => $item->maxLevels,
            'siteSettings' => [],
            'fieldLayout' => $this->exportFieldLayout($item->getFieldLayout()),
            'requiredFields' => $this->exportRequiredFields($item->getFieldLayout()),
        ], $attributeObj);

        $siteSettings = $item->getSiteSettings();
        foreach ($siteSettings as $siteSetting) {
            $categoryGroupObj['siteSettings'][] = [
                'siteId' => $siteSetting->getSite()->primary ? null : $siteSetting->getSite()->handle,
                'uriFormat' => $siteSetting->uriFormat,
                'template' => $siteSetting->template,
            ];
        }

        if (\count($categoryGroupObj['requiredFields']) <= 0) {
            unset($categoryGroupObj['requiredFields']);
        }

        return $this->stripNulls($categoryGroupObj);
    }
1332404
public function export(NodeInterface $node, array $options = [])
    {
        $options = array_replace_recursive(
            [
                'writer'            => 'graphviz'
            ],
            $options
        );

        if (is_string($options['writer'])) {
            switch ($options['writer']) {
                case 'graphviz':
                    $options['path'] = $options['path'] ?? $this->generateRandomFilePath();
                    $options['writer'] = new GraphvizWriter();

                    break;
                default:
                    throw InvalidWriterTypeException::create($options['writer']);
            }
        }

        $config = new Config(
            [
                'node'              => $node
            ],
            [
                'writer'            => $options['writer']
            ]
        );

        $config->save(
            [
                'writerOptions'        => $options
            ]
        );

        $response = new Response();

        $response->setPath($options['path']);

        return $response;
    }
146202
protected function exportProperty(PropertyInterface $property)
    {
        $value = $property->getValue();
        return ($value instanceof ThingInterface) ? $this->exportThing($value) : $value;
    }
267998
public function findPages(Website $website, $pageIds, $isAdmin, $isAPI = false)
    {
        $queryBuilder = $this->createQueryBuilder('page');
        if ($isAPI) {
            $queryBuilder->select('
                page.id,
                page.visible,
                page.title,
                page.isSection,
                page.left,
                page.level,
                page.right,
                page.root,
                IDENTITY(page.parent)
                ');
        } else {
            $queryBuilder->select('page');
        }
        $queryBuilder->andWhere('page.website = :website')
            ->andWhere($queryBuilder->expr()->in('page.id', $pageIds))
            ->orderBy('page.root, page.left', 'ASC')
            ->setParameter('website', $website);
        if ($isAdmin === false) {
            $queryBuilder
                ->andWhere('page.visible = :visible')
                ->setParameter('visible', true);
        }

        return $queryBuilder->getQuery()->getResult();
    }
303512
public function getWebsiteApiClient($website = 0, $username = '', $password = '')
    {
        if ($username && $password) {
            $apiUsername = $username;
            $apiPassword = $password;
        } else {
            $apiUsername = $this->getApiUsername($website);
            $apiPassword = $this->getApiPassword($website);
        }

        $client = $this->clientFactory->create();
        $client->setApiUsername($apiUsername)
            ->setApiPassword($apiPassword);

        $websiteId = $this->storeManager->getWebsite($website)->getId();
        //Get api endpoint
        $apiEndpoint = $this->getApiEndpoint($websiteId, $client);

        //Set api endpoint on client
        if ($apiEndpoint) {
            $client->setApiEndpoint($apiEndpoint);
        }

        return $client;
    }
611974
protected function exportThing(ThingInterface $thing)
    {
        $iri = $this->iri;

        return (object)[
            'type' => array_map(
                function (TypeInterface $type) use ($iri) {
                    return $iri ?
                        (object)[
                            'profile' => $type->getVocabulary()->getUri(),
                            'name' => $type->getType(),
                        ] :
                        $type->getVocabulary()->expand($type->getType());
                },
                $thing->getTypes()
            ),
            'id' => $thing->getResourceId(),
            'properties' => $this->exportProperties($thing),
        ];
    }
320091
protected function createSingleImports($ordersForSingleSync, $website)
    {
        foreach ($ordersForSingleSync as $order) {
            //register in queue with importer
            $this->importerFactory->create()
                ->registerQueue(
                    \Dotdigitalgroup\Email\Model\Importer::IMPORT_TYPE_ORDERS,
                    $order,
                    \Dotdigitalgroup\Email\Model\Importer::MODE_SINGLE,
                    $website[0]
                );
        }
    }
408125
public function exportAction( Request $request, $resource, $site = 'default' )
	{
		$cntl = $this->createAdmin( $request, $site, $resource );

		if( ( $html = $cntl->export() ) == '' ) {
			return $cntl->getView()->response();
		}

		return $this->getHtml( $html );
	}
667481
public function getSiteWidePluginsList($siteId)
    {
        $queryBuilder = $this->_em->createQueryBuilder();
        $queryBuilder->select('partial site.{siteId}, plugins')
            ->from(\Rcm\Entity\Site::class, 'site')
            ->join('site.sitePlugins', 'plugins')
            ->where('site.siteId = :siteId')
            ->setParameter('siteId', $siteId);

        $result = $queryBuilder->getQuery()->getSingleResult(
            \Doctrine\ORM\Query::HYDRATE_ARRAY
        );

        if (empty($result) || empty($result['sitePlugins'])) {
            return [];
        }

        return $result['sitePlugins'];
    }
1318293
public function setDefault($websiteId)
    {
        /** @var ConfigInterface $config */
        $config = $this->configFactory->create();

        $foundDifference = false;

        foreach ($this->defaultConfig as $key => $value) {
            if ($config->setConfigValue($key, $value, $websiteId)) {
                $foundDifference = true;
            }
        }

        if ($foundDifference) {
            $config->cleanScope();
        }

        return $this->statusResponseFactory->create()
            ->setStatus('ok');
    }
678818
public function exportById($id): array
    {
        $site = Craft::$app->sites->getSiteById((int) $id);

        return $this->export($site);
    }
212487
public function getHybridPages(SiteInterface $site)
    {
        return $this->getEntityManager()->createQueryBuilder()
            ->select('p')
            ->from($this->class, 'p')
            ->where('p.routeName <> :routeName and p.site = :site')
            ->setParameters([
                'routeName' => PageInterface::PAGE_ROUTE_CMS_NAME,
                'site' => $site->getId(),
            ])
            ->getQuery()
            ->execute();
    }
457379
public function exportSubscribers($website, $emailContactCollection)
    {
        $updated = 0;
        $websiteId = $website->getId();
        $subscribersFilename = strtolower($website->getCode() . '_subscribers_' . date('d_m_Y_His') . '.csv');
        $consentModel = $this->consentFactory->create();
        //get mapped storename
        $subscriberStorename = $this->helper->getMappedStoreName($website);
        //file headers
        $headers = ['Email', 'EmailType', $subscriberStorename, 'OptInType'];
        //contentinsight is enabled include additional headers
        $isConsentSubscriberEnabled = $this->configHelper->isConsentSubscriberEnabled($websiteId);
        if ($isConsentSubscriberEnabled) {
            $headers = array_merge($headers, \Dotdigitalgroup\Email\Model\Consent::$bulkFields);
            $emailContactCollection->getSelect()
                ->joinLeft(
                    ['ecc' => $emailContactCollection->getTable(Schema::EMAIL_CONTACT_CONSENT_TABLE)],
                    "ecc.email_contact_id = main_table.email_contact_id",
                    ['consent_url', 'consent_datetime', 'consent_ip', 'consent_user_agent']
                );
        }
        $subscribersData = $this->subscriberCollectionFactory->create()
            ->addFieldToFilter(
                'subscriber_email',
                ['in' => $emailContactCollection->getColumnValues('email')]
            )
            ->addFieldToSelect(['subscriber_email', 'store_id']);
        //csv file data with headers
        $this->file->outputCSV($this->file->getFilePath($subscribersFilename), $headers);

        foreach ($emailContactCollection as $contact) {
            $email = $contact->getEmail();
            $storeId = $this->getStoreIdForSubscriber(
                $email,
                $subscribersData->getItems()
            );
            $store = $this->storeManager->getStore($storeId);
            $storeName = $store->getName();
            $optInType = $this->configHelper->getOptInType($store);
            // save data for subscribers
            $outputData = [$email, 'Html', $storeName, $optInType];
            $consentUrl = $contact->getConsentUrl();
            //check for any subscribe or customer consent enabled
            if ($isConsentSubscriberEnabled && $consentUrl) {
                $consentText = $consentModel->getConsentTextForWebsite($consentUrl, $websiteId);
                $consentData = [
                    $consentText,
                    $consentUrl,
                    $this->dateTime->date(\Zend_Date::ISO_8601, $contact->getConsentDatetime()),
                    $contact->getConsentIp(),
                    $contact->getConsentUserAgent()
                ];
                $outputData = array_merge($outputData, $consentData);
            }
            $this->contactIds[] = $contact->getId();
            //csv subscriber data
            $this->file->outputCSV($this->file->getFilePath($subscribersFilename), $outputData);

            $updated++;
        }
        //mark is subscriber imported for contacts
        if (! empty($this->contactIds)) {
            $this->contactResource->updateSubscribers($this->contactIds);
        }
        $this->helper->log('Subscriber filename: ' . $subscribersFilename);
        //register in queue with importer
        $this->importerFactory->create()
            ->registerQueue(
                \Dotdigitalgroup\Email\Model\Importer::IMPORT_TYPE_SUBSCRIBERS,
                '',
                \Dotdigitalgroup\Email\Model\Importer::MODE_BULK,
                $websiteId,
                $subscribersFilename
            );

        return $updated;
    }
122031
protected function getPages(ContainerInterface $container)
	{
		if (null === $this->pages) 
		{
			$siteMainId = 0;
			
			$melisPage = $this->serviceLocator->get('MelisEnginePage');
			$actualPage = $melisPage->getDatasPage($this->idpage);
			if ($actualPage)
			{
				$siteId = 0;
				$datasTemplate = $actualPage->getMelisTemplate();
				if (!empty($datasTemplate->tpl_site_id))
					$siteId = $datasTemplate->tpl_site_id;
				
				if (!empty($siteId) && $siteId > 0)
				{
					$melisTableSite = $this->serviceLocator->get('MelisEngineTableSite');
					$datasSite = $melisTableSite->getSiteById($siteId, getenv('MELIS_PLATFORM'));
					if (!empty($datasSite))
					{
						$datasSite = $datasSite->toArray();
						if (count($datasSite) > 0)
							$siteMainId = $datasSite[0]['site_main_page_id'];
					}
				}
			}

			$navigation = $this->getChildrenRecursive($siteMainId);
			
			$pages      = $this->getPagesFromConfig($navigation);
	
			$this->pages = $this->injectComponents(
					$pages
			);
		}
		
		return $this->pages;
	}
441759
public function getCustomerAddressBook($website = 0)
    {
        $website = $this->storeManager->getWebsite($website);

        return $this->scopeConfig->getValue(
            \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_CUSTOMERS_ADDRESS_BOOK_ID,
            \Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE,
            $website
        );
    }