Exemplo n.º 1
0
 protected function storeSelection($selection, $market_id)
 {
     // Load or store selection
     if (!($BetssonMarketSelection = BetssonMarketSelection::findOne(['SelectionID' => intval($selection->SelectionID), 'LanguageCode' => $selection->LanguageCode]))) {
         $BetssonMarketSelection = new BetssonMarketSelection();
         $BetssonMarketSelection->SelectionID = intval($selection->SelectionID);
         $BetssonMarketSelection->LanguageCode = $selection->LanguageCode;
     }
     $BetssonMarketSelection->MarketID = $market_id;
     $BetssonMarketSelection->Odds = doubleval($selection->Odds);
     $BetssonMarketSelection->SelectionLimitValue = doubleval($selection->SelectionLimitValue);
     $BetssonMarketSelection->SelectionName = $selection->SelectionName;
     $BetssonMarketSelection->SelectionStatus = intval($selection->SelectionStatus);
     $BetssonMarketSelection->SelectionStatusName = $selection->SelectionStatusName;
     $BetssonMarketSelection->SelectionSortOrder = intval($selection->SortOrder);
     $BetssonMarketSelection->CacheDate = gmdate("Y-m-d H:i:s", strtotime($selection->CacheDate));
     $BetssonMarketSelection->CacheExpireDate = gmdate("Y-m-d H:i:s", strtotime($selection->CacheExpireDate));
     //$BetssonMarketSelection->ErrorMessage = $selection->ErrorMessage;
     if (!$this->storeDataRecord($BetssonMarketSelection)) {
         return false;
     }
     return true;
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getSelections()
 {
     return $this->hasMany(BetssonMarketSelection::className(), ['MarketID' => 'MarketID'])->orderby('SelectionSortOrder')->inverseOf('market');
 }