/** * updates a new TemplateSnippet * * @param WebsiteSettingsSource $source * @param DataWebsiteSettings $websiteSettings * * @return DataWebsiteSettings * @throws \Cms\Exception */ public function update(WebsiteSettingsSource $source, DataWebsiteSettings $websiteSettings) { $orm = $this->getOrmById($source, $websiteSettings->getId()); try { $this->setAttributesToOrm($orm, $websiteSettings); $entityManager = $this->getEntityManager(); $entityManager->persist($orm); $entityManager->flush(); $entityManager->refresh($orm); $this->clearEntityManager(); } catch (\Exception $e) { throw new CmsException(2511, __METHOD__, __LINE__, null, $e); } return $this->convertOrm($orm); }
/** * updates the website settings of the given id and website id * * @param WebsiteSettingsSource $source * @param DataWebsiteSettings $websiteSettings * * @return \Cms\Data\WebsiteSettings */ public function update(WebsiteSettingsSource $source, DataWebsiteSettings $websiteSettings) { $id = $websiteSettings->getId(); $newWebsiteSettings = $this->daoFilesystem->getById($source, $id); if ($this->daoDoctrine->exists($source, $id)) { $doctrineSettings = $this->daoDoctrine->update($source, $websiteSettings); } else { $doctrineSettings = $this->daoDoctrine->create($source, $websiteSettings); } $this->updateFilesystemData($newWebsiteSettings, $doctrineSettings); return $newWebsiteSettings; }
protected function setValuesFromData(WebsiteSettingsData $data) { $this->setId($data->getId()); $this->setWebsiteId($data->getWebsiteId()); $this->setName($data->getName()); $this->setDescription($data->getDescription()); $this->setVersion($data->getVersion()); $this->setFrom($data->getForm()); $this->setFromData($data->getFormValues()); }