public function xxxxxassignGroup($datas, $lastInsertId) { $row = $this->fetchRow("SELECT * FROM web_content_groups WHERE web_contentgroup_id = '{$datas['webContentgroup']}' AND web_content_id = '1'"); $insert['name'] = $row['name']; $insert['scope'] = $row['scope']; $insert['contentGroupName'] = $row['content_group_name']; $insert['contentGroupPage'] = $row['content_group_page']; $insert['groupStyle'] = $row['group_style']; $insert['itemRang'] = 1; $insert['webContent'] = $lastInsertId; $insert['webContentgroup'] = $datas['webContentgroup']; $insert['publishDate'] = $datas['publishDate']; $this->unsetTargetEntities(); $this->setTargetEntities(array('webContent' => $this->getEntityName())); parent::save($insert, $this->getSl()->get('entity_content_groups')); }
/** * * @param unknown $datas * @param unknown $lastInsertId */ protected function assignGroup($datas, $lastInsertId) { $insert['webContent'] = $this->find($lastInsertId, true); $this->unsetTargetEntities(); $this->setTargetEntities(array('webContent' => $this->getEntityName())); $this->unsetEntity(); $this->setEntity($this->getSl()->get('entity_content_groups')); if (false == $datas['webContentgroup']) { $insert['itemRang'] = 1; $insert['webContentgroup'] = $this->sequence() + 1; $assignInPage = true; } else { $group = $this->fetchContentGroupByGroup($datas['webContentgroup'], 1); $updateGroup = false; $groupStyle = 'nonestyle'; if (is_array($group) && !empty($group)) { $groupStyle = $this->findGroupStyles($group['group_style']); if ($groupStyle !== $group['group_style']) { $updateGroup = true; } } $insert['groupStyle'] = $groupStyle; $insert['webContentgroup'] = $datas['webContentgroup']; $insert['itemRang'] = $this->sequence('webContentgroup', $insert['webContentgroup'], 'itemRang') + 1; if (true === $updateGroup) { $this->updateGroupStyle($groupStyle, $datas['webContentgroup']); } $assignInPage = false; } parent::save($insert, $this->getSl()->get('entity_content_groups')); if (true === $assignInPage) { $lastInsertId = $this->getLastInsertId(); $datas['webContentgroup'] = $this->getLastInsertId(); $inPage = new SaveContributionGroup($this->getStorage()); $inPage->setSl($this->getSl()); $inPage->setEntity($this->getSl()->get('entity_page_content')); $inPage->insertContribution($datas); } }