/** * put given price match result for all companies into PriceMatchRecord table * * @param unknown $companyPrices * @return PriceMatchConnector */ private function recordResult($priceMatchResults) { foreach ($priceMatchResults as $priceMatchResult) { $company = $priceMatchResult['PriceMatchCompany']; $price = doubleval($priceMatchResult['price']); $url = $priceMatchResult['url']; $name = $priceMatchResult['name']; $min = PriceMatchMin::create($this->sku); // to create PriceMatchRecord must have a PriceMatchMin, the record for PriceMatchMin will be null at this time instance if (abs($price) !== doubleval(0) && $price > doubleval(0) && trim($price) !== '') { PriceMatchRecord::create($company, $min, $price, $url); } } return $this; }