/** * @param $model * @param $key * @param CMS $cmsEntity */ private function addDefaultCMSValuesToModel(&$model, $key, $cmsEntity) { $model[$key] = array(); try { if ($cmsEntity != null) { $model[$key] = explode(",", $cmsEntity->getValue()); } } catch (\Exception $exception) { } }
/** * @param $row * @param $lang * @return CMS */ private function toCMS($row, $lang) { $cms = new CMS(); $cms->setId($row["id"]); $cms->setLabel($row["label"]); $cms->setKey($row["key"]); $cms->setValue($row["value"]); $cms->setLang($lang); $cms->setDefaultValue($row["defaultValue"]); return $cms; }
public function testCRUDCMS() { $this->setUPRepositories(); $english = $this->langRepository->findByCode("en"); if (!$english) { return; } $this->removeIfFound($english); $cmsElement = new CMS(); $cmsElement->setKey("test"); $cmsElement->setLabel("test"); $cmsElement->setLang($english); $cmsElement->setValue("test"); $this->cmsRepository->create($cmsElement); $this->assertTrue($this->removeIfFound($english)); }