public function addPageMeta() { $content = array('page_url', 'title', 'meta', 'content', 'related', 'leading', 'footer'); $chain_name = $this->name; $chain_name_clean = \common\component\AppActiveRecord::urlFilter($chain_name); $city_name = $this->cityname; $city_name_clean = \common\component\AppActiveRecord::seftxt(trim($city_name)); $cuisine_name = $this->primarycuisine; $cuisine_name_clean = \common\component\AppActiveRecord::seftxt(trim($cuisine_name)); $leading = $related = array(); array_push($leading, $chain_name . " " . $city_name); array_push($leading, $chain_name . " menu"); array_push($leading, $chain_name . " order online"); array_push($leading, $chain_name . " price list"); array_push($related, array(\yii::$app->params['weburl'] . $city_name_clean . "/restaurant/" . $cuisine_name_clean => $cuisine_name . " restaurants")); array_push($related, array(\yii::$app->params['weburl'] . $city_name_clean . "/restaurants" => "Restaurants in " . $city_name)); array_push($related, array(\yii::$app->params['weburl'] . $city_name_clean . "/restaurant/newly-open/" => "Newly opened")); $page_url = $this->guid; $content_array = array('page_url' => $page_url, 'leading' => $leading, 'related' => $related); $content = json_encode($content_array); $sql = "SELECT id FROM tc_pages WHERE page_url = '{$page_url}' AND type = '1' AND status = '1'"; $pagaData = \yii::$app->oldcmsdb->createCommand($sql)->query(); $record_found = $pagaData->getRowCount(); if ($record_found > 0) { $page_id = $pagaData->read(); \yii::$app->oldcmsdb->createCommand()->update('tc_pages', ['content' => $content], ['id' => $page_id['id']])->execute(); } else { \yii::$app->oldcmsdb->createCommand()->insert('tc_pages', ['page_url' => $page_url, 'filters' => '', 'content' => $content, 'type' => 1, 'status' => 1, 'created_time' => new Expression('NOW()')])->execute(); } }