/** * Prepare datas before save * * @see \ContentinumComponents\Mapper\Process::save() */ public function save($datas, $entity = null, $stage = '', $id = null) { $entity = $this->handleEntity($entity); if (null === $entity->getPrimaryValue()) { $datas['scope'] = static::GROUP_SCOPE; $datas['webContent'] = 1; $datas['contentGroupName'] = static::GROUP_NAME; $datas['groupStyle'] = static::GROUP_NAME; $datas['webContentgroup'] = $this->sequence() + 1; $datas['itemRang'] = 1; foreach ($this->serializeParams as $fields) { $groupParams[$fields] = $datas[$fields]; unset($datas[$fields]); } $datas['groupParams'] = $this->serializeGroupParams($groupParams); parent::save($datas, $entity); } else { foreach ($this->serializeParams as $fields) { $groupParams[$fields] = $datas[$fields]; unset($datas[$fields]); } $datas['groupParams'] = $this->serializeGroupParams($groupParams); parent::save($datas, $entity, $stage, $id); } return true; }
/** * * @param unknown $datas */ public function insertContribution($datas) { $this->addTargetEntities('webContentgroup', 'Contentinum\\Entity\\WebContentGroups'); $this->addTargetEntities('webPages', 'Contentinum\\Entity\\WebPagesParameter'); $datas['contentRang'] = $this->getContentRang($datas['adjustments']); $datas['htmlwidgets'] = 'none'; $datas['publish'] = 'yes'; $datas['itemRang'] = $this->sequence('webPages', $datas['webPages'], 'itemRang') + 1; parent::save($datas, $this->getSl()->get('Entity\\PageContent')); }