93 lines
2.3 KiB
PHP
93 lines
2.3 KiB
PHP
<?php
|
|
|
|
namespace KupShop\FeedGeneratorBundle\ContextProperties;
|
|
|
|
use KupShop\FeedGeneratorBundle\Expressions\ExpressionObjectTrait;
|
|
use KupShop\FeedGeneratorBundle\Expressions\IExpressionObject;
|
|
use KupShop\FeedGeneratorBundle\Utils\IObjectInfo;
|
|
use KupShop\KupShopBundle\Context\CountryContext;
|
|
use KupShop\KupShopBundle\Context\CurrencyContext;
|
|
use KupShop\KupShopBundle\Context\DomainContext;
|
|
use KupShop\KupShopBundle\Context\LanguageContext;
|
|
use KupShop\KupShopBundle\Context\PriceLevelContext;
|
|
use KupShop\KupShopBundle\Context\UserContext;
|
|
|
|
class ContextsContextProperty implements IContextProperty, IExpressionObject, IObjectInfo
|
|
{
|
|
use ExpressionObjectTrait;
|
|
|
|
/** @var CurrencyContext */
|
|
protected $currencyContext;
|
|
|
|
/** @var LanguageContext */
|
|
protected $languageContext;
|
|
|
|
/** @var DomainContext */
|
|
protected $domainContext;
|
|
|
|
/** @var CountryContext */
|
|
protected $countryContext;
|
|
|
|
/** @var UserContext */
|
|
protected $userContext;
|
|
|
|
/** @var PriceLevelContext */
|
|
protected $priceLevelContext;
|
|
|
|
public function __construct(
|
|
CurrencyContext $currencyContext,
|
|
LanguageContext $languageContext,
|
|
DomainContext $domainContext,
|
|
CountryContext $countryContext,
|
|
UserContext $userContext,
|
|
PriceLevelContext $priceLevelContext,
|
|
) {
|
|
$this->currencyContext = $currencyContext;
|
|
$this->languageContext = $languageContext;
|
|
$this->domainContext = $domainContext;
|
|
$this->countryContext = $countryContext;
|
|
$this->userContext = $userContext;
|
|
$this->priceLevelContext = $priceLevelContext;
|
|
}
|
|
|
|
/**
|
|
* @private
|
|
*/
|
|
public static function getName(): string
|
|
{
|
|
return 'contexts';
|
|
}
|
|
|
|
/**
|
|
* Kód aktivní měny.
|
|
*/
|
|
public function field_currency(): string
|
|
{
|
|
return $this->currencyContext->getActiveId();
|
|
}
|
|
|
|
/**
|
|
* ID aktivního jazyka.
|
|
*/
|
|
public function field_language(): string
|
|
{
|
|
return $this->languageContext->getActiveId();
|
|
}
|
|
|
|
/**
|
|
* Aktivní doména.
|
|
*/
|
|
public function field_domain(): string
|
|
{
|
|
return $this->domainContext->getActiveId();
|
|
}
|
|
|
|
/**
|
|
* Kód aktivní země.
|
|
*/
|
|
public function field_country(): string
|
|
{
|
|
return $this->countryContext->getActiveId();
|
|
}
|
|
}
|