Adds the message queue manager object to the context

@param \Aimeos\MShop\Context\Item\Iface $context Context object
@return \Aimeos\MShop\Context\Item\Iface Modified context object
423787
protected static function addMessageQueueManager( \Aimeos\MShop\Context\Item\Iface $context )
	{
		if( isset( $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_mqueue'] )
			&& is_callable( ( $fcn = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_mqueue'] ) )
		) {
			return $fcn( $context );
		}

		return $context->setMessageQueueManager( new \Aimeos\MW\MQueue\Manager\Standard( $context->getConfig() ) );
	}
1049256
public function set( \Aimeos\MShop\Common\Item\Iface $item )
	{
		$this->prodmap[$item->getCode()] = $item->getId();
	}
1231534
protected function addJob( $context, $path )
	{
		$manager = \Aimeos\MAdmin::create( $context, 'job' );

		$item = $manager->createItem();
		$item->setResult( ['file' => $path] );
		$item->setLabel( $path );

		$manager->saveItem( $item, false );
	}
1317740
public function setObject( \Aimeos\Controller\Frontend\Iface $object )
	{
		$this->object = $object;
		return $this;
	}
1019762
public function deleteAddressItem( \Aimeos\MShop\Common\Item\Address\Iface $item )
	{
		$this->controller->deleteAddressItem( $item );
		return $this;
	}
1003743
public function process( \Aimeos\MShop\Coupon\Item\Code\Iface $item, array $data )
	{
		$manager = \Aimeos\MShop::create( $this->getContext(), 'coupon/code' );
		$map = $this->getMappedChunk( $data, $this->getMapping() );

		foreach( $map as $list )
		{
			if( trim( $list['coupon.code.code'] ) == '' ) {
				continue;
			}

			$item = $manager->saveItem( $item->fromArray( $list ) );
		}

		return $this->getObject()->process( $item, $data );
	}
1137204
public static function getSiteItems( \Aimeos\MShop\Context\Item\Iface $context, $sites )
	{
		if( !is_array( $sites )  ) {
			$sites = explode( ' ', $sites );
		}

		$manager = \Aimeos\MShop::create( $context, 'locale/site' );
		$search = $manager->createSearch();

		if( !empty( $sites ) ) {
			$search->setConditions( $search->compare( '==', 'locale.site.code', $sites ) );
		}

		return $manager->searchItems( $search );
	}
433340
protected function addGroup( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Customer\Item\Iface $user, $group )
	{
		$msg = 'Add "%1$s" group to user "%2$s" for site "%3$s"';
		$this->info( sprintf( $msg, $group, $user->getCode(), $this->argument( 'site' ) ) );

		$groupItem = $this->getGroupItem( $context, $group );
		$this->addListItem( $context, $user->getId(), $groupItem->getId() );
	}
490250
public function setView( \Aimeos\MW\View\Iface $view )
	{
		parent::setView( $view );

		// set first to be able to show errors occuring afterwards
		$view->pageParams = $this->getClientParams();
		$context = $this->getContext();

		$siteManager = \Aimeos\MShop::create( $context, 'locale/site' );
		$langManager = \Aimeos\MShop::create( $context, 'locale/language' );
		$customerManager = \Aimeos\MShop::create( $context, 'customer' );

		$siteItem = $siteManager->findItem( $view->param( 'site', 'default' ) );

		try {
			$siteid = $customerManager->getItem( $context->getUserId() )->getSiteId() ?: $siteItem->getSiteId();
		} catch( \Exception $e ) {
			$siteid = $siteItem->getSiteId();
		}

		if( $view->access( ['admin', 'super'] ) ) {
			$level = \Aimeos\MW\Tree\Manager\Base::LEVEL_TREE;
		} else {
			$level = \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE;
		}

		$sitePath = $siteManager->getPath( $siteid );

		$view->pageI18nList = $this->getAimeos()->getI18nList( 'admin' );
		$view->pageLangItems = $langManager->searchItems( $langManager->createSearch( true ) );
		$view->pageSiteTree = $siteManager->getTree( $siteid, [], $level );
		$view->pageSitePath = $sitePath;
		$view->pageSiteItem = $siteItem;

		if( $view->access( ['super'] ) )
		{
			$search = $siteManager->createSearch()->setSlice( 0, 1000 );
			$search->setSortations( [$search->sort( '+', 'locale.site.label')] );
			$search->setConditions( $search->compare( '==', 'locale.site.level', 0 ) );

			$view->pageSiteList = $siteManager->searchItems( $search );

			if( ( $rootItem = reset( $sitePath ) ) !== false ) {
				$view->pageSiteTree = $siteManager->getTree( $rootItem->getId(), [], $level );
			}
		}
		else
		{
			$view->pageSiteList = [$view->pageSiteTree];
		}

		$this->getClient()->setView( $view );
		return $this;
	}
496747
protected function addGroups( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Customer\Item\Iface $user )
	{
		\Illuminate\Foundation\Auth\User::findOrFail( $user->getId() )
			->forceFill( ['superuser' => ( $this->option( 'super' ) ? 1 : 0 )] )
			->save();

		if( $this->option( 'admin' ) ) {
			$this->addGroup( $context, $user, 'admin' );
		}

		if( $this->option( 'editor' ) ) {
			$this->addGroup( $context, $user, 'editor' );
		}

		if( $this->option( 'api' ) ) {
			$this->addGroup( $context, $user, 'api' );
		}
	}
1066471
protected function addFilesystemManager( \Aimeos\MShop\Context\Item\Iface $context )
	{
		$fs = new \Aimeos\MW\Filesystem\Manager\Standard( $context->getConfig() );

		return $context->setFilesystemManager( $fs );
	}
250854
protected function execute( \Aimeos\MShop\Context\Item\Iface $context, array $customers )
	{
		$prodIds = $custIds = [];
		$listItems = $this->getListItems( $context, array_keys( $customers ) );
		$listManager = \Aimeos\MShop::create( $context, 'customer/lists' );

		foreach( $listItems as $id => $listItem )
		{
			$refId = $listItem->getRefId();
			$custIds[ $listItem->getParentId() ][$id] = $refId;
			$prodIds[$refId] = $refId;
		}

		$date = date( 'Y-m-d H:i:s' );
		$products = $this->getProducts( $context, $prodIds, 'default' );

		foreach( $custIds as $custId => $list )
		{
			$custListItems = $listIds = [];

			foreach( $list as $listId => $prodId )
			{
				$listItem = $listItems[$listId];

				if( $listItem->getDateEnd() < $date ) {
					$listIds[] = $listId;
				}

				$custListItems[$listId] = $listItems[$listId];
			}

			try
			{
				$custProducts = $this->getProductList( $products, $custListItems );

				if( !empty( $custProducts ) )
				{
					$addr = $customers[$custId]->getPaymentAddress();
					$this->sendMail( $context, $addr, $custProducts );

					$str = sprintf( 'Sent product notification e-mail to "%1$s"', $addr->getEmail() );
					$context->getLogger()->log( $str, \Aimeos\MW\Logger\Base::DEBUG );

					$listIds += array_keys( $custProducts );
				}
			}
			catch( \Exception $e )
			{
				$str = 'Error while trying to send product notification e-mail for customer ID "%1$s": %2$s';
				$context->getLogger()->log( sprintf( $str, $custId, $e->getMessage() ) );
			}

			$listManager->deleteItems( $listIds );
		}
	}
269499
protected function addAttachments( \Aimeos\MW\Mail\Message\Iface $msg, array $files )
	{
		foreach( $files as $filename )
		{
			if( ( $content = @file_get_contents( $filename ) ) === false ) {
				throw new \Aimeos\Client\Html\Exception( sprintf( 'File "%1$s" doesn\'t exist', $filename ) );
			}

			if( class_exists( 'finfo' ) )
			{
				try
				{
					$finfo = new \finfo( FILEINFO_MIME_TYPE );
					$mimetype = $finfo->file( $filename );
				}
				catch( \Exception $e )
				{
					throw new \Aimeos\Client\Html\Exception( $e->getMessage() );
				}
			}
			else if( function_exists( 'mime_content_type' ) )
			{
				$mimetype = mime_content_type( $filename );
			}
			else
			{
				$mimetype = 'application/binary';
			}

			$msg->addAttachment( $content, $mimetype, basename( $filename ) );
		}
	}
537154
private function firstRunner(ContextInterface $context)
    {
        foreach ($this->bagHandler as $handler) {
            if ($handler->canInvoke($context)) {
                return $handler;
            };
        }

        return null;
    }
18739
protected function _actionAddapp(AnCommandContext $context)
    {
        $data = $context->data;
        $this->getItem()->components->insert($data->app);
        $this->commit();
    }
68558
protected function fromArray( \Aimeos\MShop\Product\Item\Iface $item, array $data )
	{
		$context = $this->getContext();
		$manager = \Aimeos\MShop::create( $context, 'product' );
		$listManager = \Aimeos\MShop::create( $context, 'product/lists' );

		$prodItem = $manager->createItem()->setType( 'default' );
		$listItem = $listManager->createItem()->setType( 'default' );
		$articles = $item->getRefItems( 'product', null, 'default', false );
		$listItems = $item->getListItems( 'product', 'default', null, false );

		foreach( $data as $idx => $entry )
		{
			if( ( $litem = $item->getListItem( 'product', 'default', $entry['product.id'], false ) ) === null ) {
				$litem = clone $listItem;
			}

			if( isset( $articles[$litem->getRefId()] ) ) {
				$refItem = $articles[$litem->getRefId()];
			} else {
				$refItem = clone $prodItem;
			}

			$litem->fromArray( $entry, true );
			$litem->setPosition( $idx );

			$refItem->fromArray( $entry, true );

			if( isset( $entry['attr'] ) ) {
				$refItem = $this->fromArrayAttributes( $refItem, $entry['attr'] );
			}

			$item->addListItem( 'product', $litem, $refItem );
			unset( $listItems[$litem->getId()] );
		}

		return $item->deleteListItems( $listItems );
	}
452349
protected function addDatabaseManager( \Aimeos\MShop\Context\Item\Iface $context )
	{
		$dbm = new \Aimeos\MW\DB\Manager\DBAL( $context->getConfig() );

		return $context->setDatabaseManager( $dbm );
	}