/** * Rule Engine Data Generator * @param $format none | json */ public function toRuleEngineData($format = 'none') { $data = array(); $data['id'] = $this->id; //$data['products'] = array(); //foreach ($this->products as $idx=>$product) { //$data['products'][] = $product->toRuleEngineData(); //} // Condense the products pid into a single product pid array $data['products'] = $this->_condenseProductsPid(); $data['payoutType'] = $this->payoutType->getValue(); $data['lapRate'] = $this->lapRate; $data['packs'] = $this->packs; if (strcasecmp($format, 'json') === 0) { return json_encode($data); } else { return $data; } }
/** * Rule Engine Data Generator * @param $format none | json */ public function toRuleEngineData($format = 'none') { $data = array(); $data['id'] = $this->id; $data['numProducts'] = $this->numProducts; $data['payoutValue'] = $this->payoutValue; $data['payoutType'] = $this->payoutType->getValue(); if (isset($this->qcList) && !empty($this->qcList)) { foreach ($this->qcList as $idx => $qc) { $data['qcList'][] = $qc->toRuleEngineData(); } } if (strcasecmp($format, 'json') === 0) { return json_encode($data); } else { return $data; } }