foreach ($offers AS $offer_key => $offers_item) { $offer_key_ex = explode('-',$offer_key); $offer_key_ex_list[$offer_key_ex[0]] = $offer_key_ex[0]; } $aaaa = []; foreach ($dfsdfsd AS $dfsdfsd_item) { if (array_key_exists($dfsdfsd_item,$offer_key_ex_list)) } echo '<pre>'; print_r($offer_key_ex_list); echo '</pre>'; exit; /* $offers_list = []; foreach ($offers AS $offers_item) {
} } } } ], 'promExtOffer' => [ 'class' => PromExtOfferBehavior::className(), 'scopeProm' => function ($model) { /** @var \yii\db\ActiveQuery $model */ $model->with('prise', 'images', 'article', 'addfeilds', 'category', 'prise.tablesize')->orderBy(['id' => SORT_ASC]); }, 'dataPromClosure' => function ($model) { //if ($model->getVendorCode($model->addfeilds) == 'MS 0333') {
* Makes sure that the behaviors declared in [[behaviors()]] are attached to this component. */ public function ensureBehaviors() { if ($this->_behaviors === null) { $this->_behaviors = []; foreach ($this->behaviors() as $name => $behavior) { $this->attachBehaviorInternal($name, $behavior); } } } /**
* all attached handlers for the event including class-level handlers. * @param string $name the event name * @param Event $event the event parameter. If not set, a default [[Event]] object will be created. */ public function trigger($name, Event $event = null) { $this->ensureBehaviors(); if (!empty($this->_events[$name])) { if ($event === null) { $event = new Event(); } if ($event->sender === null) { $event->sender = $this;
* If you override this method, make sure you call the parent implementation at the end * to ensure triggering of the event. */ public function init() { parent::init(); $this->trigger(self::EVENT_INIT); } /** * This method is called when the AR object is created and populated with the query result. * The default implementation will trigger an [[EVENT_AFTER_FIND]] event. * When overriding this method, make sure you call the parent implementation to ensure the
*/ 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.
* you may implement the so-called single-table inheritance mapping. * @param array $row row data to be populated into the record. * @return static the newly created active record */ public static function instantiate($row) { return new static(); } /** * Returns whether there is an element at the specified offset. * This method is required by the interface [[\ArrayAccess]]. * @param mixed $offset the offset to check on
} } else { /* @var $class ActiveRecord */ $class = $this->modelClass; if ($this->indexBy === null) { foreach ($rows as $row) { $model = $class::instantiate($row); $modelClass = get_class($model); $modelClass::populateRecord($model, $row); $models[] = $model; } } else { foreach ($rows as $row) {
public function populate($rows) { if (empty($rows)) { return []; } $models = $this->createModels($rows); if (!empty($this->join) && $this->indexBy === null) { $models = $this->removeDuplicatedModels($models); } if (!empty($this->with)) { $this->findWith($this->with, $models); }
public function all($db = null) { if ($this->emulateExecution) { return []; } $rows = $this->createCommand($db)->queryAll(); return $this->populate($rows); } /** * Converts the raw query results into the format as specified by this query. * This method is internally used to convert the data fetched from database * into the format as required by this query.
* @param Connection $db the DB connection used to create the DB command. * If null, the DB connection returned by [[modelClass]] will be used. * @return array|ActiveRecord[] the query results. If the query results in nothing, an empty array will be returned. */ public function all($db = null) { return parent::all($db); } /** * @inheritdoc */ public function prepare($builder)
public function allid($id,$subcategories,$goodsid) { $idGoods = array(); $idCat = array(); if ($id == 65) { $goods = Gods::find()->andWhere(['export'=>0])->orderBy(['id' => SORT_DESC])->limit(100)->all(); foreach ($goods as $good) { $idGoods[] = $good->id; } } else if ($id == 64) { $categories = Category::find()->where(['>','price_selling',0])->all();
exit; } */ if ($category->parrent_category == 0) { if (empty($id)) $id = array_unique($this->allid($category->id,$subcategories,$goodsid)); } else { $id = $this->getIds($category->id); } $godsQuery = Gods::find();
$args = $this->controller->bindActionParams($this, $params); Yii::trace('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::trace("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-local.php'), require(__DIR__ . '/../config/main.php'), require(__DIR__ . '/../config/main-local.php') ); $application = new yii\web\Application($config); $application->run();
$_GET = [ 'slug' => 'Novinki', ]; $_SESSION = [ '__flash' => [], ];