// дубль-карточки под каждый модификатор foreach ($mergedProductIds as $productId) { // processModifier для каждого модификатора внутри // независимо от количества $i = 1; foreach ($baseCardId2RealModifierIdsMapping[$productId] as $realModifierId) { $this->processRealModifier( $realModifierId, $productId, $catalogDataRecords[$productId], ( $this->isEachRealModifierAsProduct ? true : ($i === 1) ), $salePricesIndexedByRealModifierId[$realModifierId] ?? null, array_values(array_filter( $this->ids, function ($id) use ($realModifierId) {
// независимо от количества $i = 1; foreach ($baseCardId2RealModifierIdsMapping[$productId] as $realModifierId) { $this->processRealModifier( $realModifierId, $productId, $catalogDataRecords[$productId], ( $this->isEachRealModifierAsProduct ? true : ($i === 1) ), $salePricesIndexedByRealModifierId[$realModifierId] ?? null,
* {@inheritDoc} */ public function init(): void { parent::init(); if ($this->isLazyTransform === false) { $this->transform(); } } }
*/ public function __construct($config = []) { if (!empty($config)) { Yii::configure($this, $config); } $this->init(); } /** * Initializes the object. * This method is invoked at the end of the constructor after the object is initialized with the * given configuration.
$config = $this->resolveDependencies($config); if (!empty($dependencies) && $reflection->implementsInterface('yii\base\Configurable')) { // set $config as the last parameter (existing one will be overwritten) $dependencies[count($dependencies) - 1] = $config; return $reflection->newInstanceArgs($dependencies); } $object = $reflection->newInstanceArgs($dependencies); foreach ($config as $name => $value) { $object->$name = $value; }
$class = $class->id; } if (isset($this->_singletons[$class])) { // singleton return $this->_singletons[$class]; } elseif (!isset($this->_definitions[$class])) { return $this->build($class, $params, $config); } $definition = $this->_definitions[$class]; if (is_callable($definition, true)) { $params = $this->resolveDependencies($this->mergeParams($class, $params));
$config = array_merge($definition, $config); $params = $this->mergeParams($class, $params); if ($concrete === $class) { $object = $this->build($class, $params, $config); } else { $object = $this->get($concrete, $params, $config); } } elseif (is_object($definition)) { return $this->_singletons[$class] = $definition; } else { throw new InvalidConfigException('Unexpected object definition type: ' . gettype($definition)); }
* Заполняем CardSkeleton на основе продуктовой линейки * @return void */ public function fillCardSkeletonByProductLine() { $this->cardSkeletonSet = ( $this->di->get( class: 'ids2CardSkeletonSetTransformerV2', config: [ 'ids' => array_map( fn($p) => [ 'product_id' => $p['positionId'], 'product_type_id' => $p['positionTypeId'],
public function getRawData() { // запуск соотвествующего алгоритма switch ($this->attributeType) { case AdditionalProductAttributeTypeEnum::productLine: $this->fillCardSkeletonByProductLine(); break; } } /** * Заполняем CardSkeleton на основе продуктовой линейки
// \dynamic public function init() { parent::init(); if ($this->isLazyLoad === false) { $this->getRawData(); } } public function getRawData() { // запуск соотвествующего алгоритма
*/ public function __construct($config = []) { if (!empty($config)) { Yii::configure($this, $config); } $this->init(); } /** * Initializes the object. * This method is invoked at the end of the constructor after the object is initialized with the * given configuration.
$config = $this->resolveDependencies($config); if (!empty($dependencies) && $reflection->implementsInterface('yii\base\Configurable')) { // set $config as the last parameter (existing one will be overwritten) $dependencies[count($dependencies) - 1] = $config; return $reflection->newInstanceArgs($dependencies); } $object = $reflection->newInstanceArgs($dependencies); foreach ($config as $name => $value) { $object->$name = $value; }
$class = $class->id; } if (isset($this->_singletons[$class])) { // singleton return $this->_singletons[$class]; } elseif (!isset($this->_definitions[$class])) { return $this->build($class, $params, $config); } $definition = $this->_definitions[$class]; if (is_callable($definition, true)) { $params = $this->resolveDependencies($this->mergeParams($class, $params));
$config = array_merge($definition, $config); $params = $this->mergeParams($class, $params); if ($concrete === $class) { $object = $this->build($class, $params, $config); } else { $object = $this->get($concrete, $params, $config); } } elseif (is_object($definition)) { return $this->_singletons[$class] = $definition; } else { throw new InvalidConfigException('Unexpected object definition type: ' . gettype($definition)); }
$this->rawProductDataDao->productSkeletonDao->currentCard; // достаем дополнительные товары // только для текущего модификатора в базовой карточке // т.к. остальные из React-приложения берутся Ajax-ом при смене // модификатора $additionalProductDao = $this->di->get( class: 'additionalProductDao', config: [ 'positions' => [ [ 'positionTypeId' => ProductTypeEnum::realModifier->value, 'positionId' => $cardSkeleton->currentRealModifier->id,
public function init(): void { parent::init(); if ($this->isLazyRun === false) { $this->run(); } } /** * @return void */
*/ public function __construct($config = []) { if (!empty($config)) { Yii::configure($this, $config); } $this->init(); } /** * Initializes the object. * This method is invoked at the end of the constructor after the object is initialized with the * given configuration.
$config = $this->resolveDependencies($config); if (!empty($dependencies) && $reflection->implementsInterface('yii\base\Configurable')) { // set $config as the last parameter (existing one will be overwritten) $dependencies[count($dependencies) - 1] = $config; return $reflection->newInstanceArgs($dependencies); } $object = $reflection->newInstanceArgs($dependencies); foreach ($config as $name => $value) { $object->$name = $value; }
$class = $class->id; } if (isset($this->_singletons[$class])) { // singleton return $this->_singletons[$class]; } elseif (!isset($this->_definitions[$class])) { return $this->build($class, $params, $config); } $definition = $this->_definitions[$class]; if (is_callable($definition, true)) { $params = $this->resolveDependencies($this->mergeParams($class, $params));
$config = array_merge($definition, $config); $params = $this->mergeParams($class, $params); if ($concrete === $class) { $object = $this->build($class, $params, $config); } else { $object = $this->get($concrete, $params, $config); } } elseif (is_object($definition)) { return $this->_singletons[$class] = $definition; } else { throw new InvalidConfigException('Unexpected object definition type: ' . gettype($definition)); }
] ); // дополнительные товары // (матрас + наматрасник) // как в прошлом проекте son.ru $this->di->get( class: 'refillRawProductDataDaoV2WithAdditionalProductsTask', config: [ 'rawProductDataDao' => $this->rawProductDataDao, ] ); }
$this->rawProductDataDao = $this->di->get( class: 'rawProductDataDaoV2', config: $rawProductDataDaoDepends ); // заполнение новыми данными $this->fillSpecialInfo(); $this->createAggregate(); parent::afterGenerate(); }
* {@inheritDoc} */ public function init(): void { parent::init(); if ($this->isLazyGenerate === false) { $this->generate(); } } }
*/ public function __construct($config = []) { if (!empty($config)) { Yii::configure($this, $config); } $this->init(); } /** * Initializes the object. * This method is invoked at the end of the constructor after the object is initialized with the * given configuration.
$config = $this->resolveDependencies($config); if (!empty($dependencies) && $reflection->implementsInterface('yii\base\Configurable')) { // set $config as the last parameter (existing one will be overwritten) $dependencies[count($dependencies) - 1] = $config; return $reflection->newInstanceArgs($dependencies); } $object = $reflection->newInstanceArgs($dependencies); foreach ($config as $name => $value) { $object->$name = $value; }
$class = $class->id; } if (isset($this->_singletons[$class])) { // singleton return $this->_singletons[$class]; } elseif (!isset($this->_definitions[$class])) { return $this->build($class, $params, $config); } $definition = $this->_definitions[$class]; if (is_callable($definition, true)) { $params = $this->resolveDependencies($this->mergeParams($class, $params));
$config = array_merge($definition, $config); $params = $this->mergeParams($class, $params); if ($concrete === $class) { $object = $this->build($class, $params, $config); } else { $object = $this->get($concrete, $params, $config); } } elseif (is_object($definition)) { return $this->_singletons[$class] = $definition; } else { throw new InvalidConfigException('Unexpected object definition type: ' . gettype($definition)); }
$activeDataCollector->trigger( ActiveDataCollector::EVENT_DATA_EMITTED, $dataEmittedEvent, ); /** @var ProductSkeletonDao2ProductCardAggregateV1GeneratorV2 $aggregateGenerator */ $this->aggregateGenerator = $this->di->get( class: 'productSkeletonDao2ProductCardAggregateV1GeneratorV2', config: [ 'productSkeletonDao' => $this->productSkeletonDao, 'categoryConfigSetDao' => $this->categoryConfigSetDao, 'titleType' => TitleTypeEnum::productPrefixBrandNameProductNameRealModifierName, ]
*/ public function __construct($config = []) { if (!empty($config)) { Yii::configure($this, $config); } $this->init(); } /** * Initializes the object. * This method is invoked at the end of the constructor after the object is initialized with the * given configuration.
$config = $this->resolveDependencies($config); if (!empty($dependencies) && $reflection->implementsInterface('yii\base\Configurable')) { // set $config as the last parameter (existing one will be overwritten) $dependencies[count($dependencies) - 1] = $config; return $reflection->newInstanceArgs($dependencies); } $object = $reflection->newInstanceArgs($dependencies); foreach ($config as $name => $value) { $object->$name = $value; }
$class = $class->id; } if (isset($this->_singletons[$class])) { // singleton return $this->_singletons[$class]; } elseif (!isset($this->_definitions[$class])) { return $this->build($class, $params, $config); } $definition = $this->_definitions[$class]; if (is_callable($definition, true)) { $params = $this->resolveDependencies($this->mergeParams($class, $params));
$config = array_merge($definition, $config); $params = $this->mergeParams($class, $params); if ($concrete === $class) { $object = $this->build($class, $params, $config); } else { $object = $this->get($concrete, $params, $config); } } elseif (is_object($definition)) { return $this->_singletons[$class] = $definition; } else { throw new InvalidConfigException('Unexpected object definition type: ' . gettype($definition)); }
$product, $modifierSlug ); } /** @var ProductViewActivePage $activePage */ $activePage = Yii::$container->get( class: 'productViewActivePage', config: $activePageDepends, ); // } catch (ProductForbiddenHttpException $e) { } catch (\Throwable $e) {
$args = $this->controller->bindActionParams($this, $params); Yii::debug('Running action: ' . get_class($this->controller) . '::' . $this->actionMethod . '()', __METHOD__); if (Yii::$app->requestedParams === null) { Yii::$app->requestedParams = $args; } return call_user_func_array([$this->controller, $this->actionMethod], $args); } }
} $result = null; if ($runAction && $this->beforeAction($action)) { // run the action $result = $action->runWithParams($params); $result = $this->afterAction($action, $result); // call afterAction on modules foreach ($modules as $module) { /* @var $module Module */
$parts = $this->createController($route); if (is_array($parts)) { /* @var $controller Controller */ list($controller, $actionID) = $parts; $oldController = Yii::$app->controller; Yii::$app->controller = $controller; $result = $controller->runAction($actionID, $params); if ($oldController !== null) { Yii::$app->controller = $oldController; } return $result; }
$params = $this->catchAll; unset($params[0]); } try { Yii::debug("Route requested: '$route'", __METHOD__); $this->requestedRoute = $route; $result = $this->runAction($route, $params); if ($result instanceof Response) { return $result; } $response = $this->getResponse(); if ($result !== null) {
{ try { $this->state = self::STATE_BEFORE_REQUEST; $this->trigger(self::EVENT_BEFORE_REQUEST); $this->state = self::STATE_HANDLING_REQUEST; $response = $this->handleRequest($this->getRequest()); $this->state = self::STATE_AFTER_REQUEST; $this->trigger(self::EVENT_AFTER_REQUEST); $this->state = self::STATE_SENDING_RESPONSE; $response->send();
require __DIR__ . '/../../common/config/main.php', require __DIR__ . '/../../common/config/main-local.php', require __DIR__ . '/../config/main.php', require __DIR__ . '/../config/main-local.php' ); (new yii\web\Application($config))->run();
$_GET = [ 'productSlug' => 'namatrasnik-corretto-standart-hb', 'modifierSlug' => '140x195', ];