controller/jobs/src/Controller/Jobs/Subscription/Export/Csv/Standard.php
protected function export( array $processors, $msg, $maxcnt )
	{
		$lcontext = $this->getLocaleContext( $msg );
		$baseRef = ['order/base/address', 'order/base/product'];

		$manager = \Aimeos\MShop::create( $lcontext, 'subscription' );
		$baseManager = \Aimeos\MShop::create( $lcontext, 'order/base' );

		$container = $this->getContainer();
		$content = $container->create( 'subscription-export_' . date( 'Y-m-d_H-i-s' ) );
		$search = $this->initCriteria( $manager->createSearch()->setSlice( 0, 0x7fffffff ), $msg );
		$start = 0;

		do
		{
			$baseIds = [];
			$search->setSlice( $start, $maxcnt );
			$items = $manager->searchItems( $search );

			foreach( $items as $item ) {
				$baseIds[] = $item->getOrderBaseId();
			}

			$baseSearch = $baseManager->createSearch();
			$baseSearch->setConditions( $baseSearch->compare( '==', 'order.base.id', $baseIds ) );
			$baseSearch->setSlice( 0, count( $baseIds ) );

			$baseItems = $baseManager->searchItems( $baseSearch, $baseRef );

			foreach( $items as $id => $item )
			{
				foreach( $processors as $type => $processor )
				{
					foreach( $processor->process( $item, $baseItems[$item->getOrderBaseId()] ) as $line ) {
						$content->add( [0 => $type, 1 => $id] + $line );
					}
				}
			}

			$count = count( $items );
			$start += $count;
		}
		while( $count === $search->getSliceSize() );

		$path = $content->getResource();
		$container->add( $content );
		$container->close();

		$path = $this->moveFile( $lcontext, $path );
		$this->addJob( $lcontext, $path );
	}
protected function export( array $processors, $msg, $maxcnt )
	{
		$lcontext = $this->getLocaleContext( $msg );
		$baseRef = ['order/base/address', 'order/base/product'];

		$manager = \Aimeos\MShop::create( $lcontext, 'subscription' );
		$baseManager = \Aimeos\MShop::create( $lcontext, 'order/base' );

		$container = $this->getContainer();
		$content = $container->create( 'subscription-export_' . date( 'Y-m-d_H-i-s' ) );
		$search = $this->initCriteria( $manager->createSearch()->setSlice( 0, 0x7fffffff ), $msg );
		$start = 0;

		do
		{
			$baseIds = [];
			$search->setSlice( $start, $maxcnt );
			$items = $manager->searchItems( $search );

			foreach( $items as $item ) {
				$baseIds[] = $item->getOrderBaseId();
			}

			$baseSearch = $baseManager->createSearch();
			$baseSearch->setConditions( $baseSearch->compare( '==', 'order.base.id', $baseIds ) );
			$baseSearch->setSlice( 0, count( $baseIds ) );

			$baseItems = $baseManager->searchItems( $baseSearch, $baseRef );

			foreach( $items as $id => $item )
			{
				foreach( $processors as $type => $processor )
				{
					foreach( $processor->process( $item, $baseItems[$item->getOrderBaseId()] ) as $line ) {
						$content->add( [0 => $type, 1 => $id] + $line );
					}
				}
			}

			$count = count( $items );
			$start += $count;
		}
		while( $count === $search->getSliceSize() );

		$path = $content->getResource();
		$container->add( $content );
		$container->close();

		$path = $this->moveFile( $lcontext, $path );
		$this->addJob( $lcontext, $path );
	}
protected function export ( array $ processors , $ msg , $ maxcnt ) { $ lcontext = $ this -> getLocaleContext ( $ msg ) ; $ baseRef = [ 'order/base/address' , 'order/base/product' ] ; $ manager = \ Aimeos \ MShop :: create ( $ lcontext , 'subscription' ) ; $ baseManager = \ Aimeos \ MShop :: create ( $ lcontext , 'order/base' ) ; $ container = $ this -> getContainer ( ) ; $ content = $ container -> create ( 'subscription-export_' . date ( 'Y-m-d_H-i-s' ) ) ; $ search = $ this -> initCriteria ( $ manager -> createSearch ( ) -> setSlice ( 0 , 0x7fffffff ) , $ msg ) ; $ start = 0 ; do { $ baseIds = [ ] ; $ search -> setSlice ( $ start , $ maxcnt ) ; $ items = $ manager -> searchItems ( $ search ) ; foreach ( $ items as $ item ) { $ baseIds [ ] = $ item -> getOrderBaseId ( ) ; } $ baseSearch = $ baseManager -> createSearch ( ) ; $ baseSearch -> setConditions ( $ baseSearch -> compare ( '==' , 'order.base.id' , $ baseIds ) ) ; $ baseSearch -> setSlice ( 0 , count ( $ baseIds ) ) ; $ baseItems = $ baseManager -> searchItems ( $ baseSearch , $ baseRef ) ; foreach ( $ items as $ id => $ item ) { foreach ( $ processors as $ type => $ processor ) { foreach ( $ processor -> process ( $ item , $ baseItems [ $ item -> getOrderBaseId ( ) ] ) as $ line ) { $ content -> add ( [ 0 => $ type , 1 => $ id ] + $ line ) ; } } } $ count = count ( $ items ) ; $ start += $ count ; } while ( $ count === $ search -> getSliceSize ( ) ) ; $ path = $ content -> getResource ( ) ; $ container -> add ( $ content ) ; $ container -> close ( ) ; $ path = $ this -> moveFile ( $ lcontext , $ path ) ; $ this -> addJob ( $ lcontext , $ path ) ; }
Exports the subscriptions and returns the exported file name

@param Aimeos\Controller\Common\Subscription\Export\Csv\Processor\Iface[] List of processor objects
@param array $msg Message data passed from the frontend
@param integer $maxcnt Maximum number of retrieved subscriptions at once
@return string Path of the file containing the exported data
Exports the subscriptions and returns the exported file name