/** * @param ObjectManager $om */ protected function persistDemoRFM(ObjectManager $om) { $rfmData = ['recency' => [['min' => null, 'max' => 7], ['min' => 7, 'max' => 30], ['min' => 30, 'max' => 90], ['min' => 90, 'max' => 365], ['min' => 365, 'max' => null]], 'frequency' => [['min' => 52, 'max' => null], ['min' => 12, 'max' => 52], ['min' => 4, 'max' => 12], ['min' => 2, 'max' => 4], ['min' => null, 'max' => 2]], 'monetary' => [['min' => 10000, 'max' => null], ['min' => 1000, 'max' => 10000], ['min' => 100, 'max' => 1000], ['min' => 10, 'max' => 100], ['min' => null, 'max' => 10]]]; foreach ($rfmData as $type => $values) { foreach ($values as $idx => $limits) { $category = new RFMMetricCategory(); $category->setCategoryIndex($idx + 1)->setChannel($this->dataChannel)->setCategoryType($type)->setMinValue($limits['min'])->setMaxValue($limits['max'])->setOwner($this->organization); $om->persist($category); } } $data = $this->dataChannel->getData(); $data['rfm_enabled'] = true; $this->dataChannel->setData($data); $om->persist($this->dataChannel); }