public function postUp($manager) { foreach (JournalEntryQuery::create()->find() as $oEntry) { $sOldText = $oEntry->getText(); $sText = RichtextUtil::parseStorageForBackendOutput($sOldText); $oUtil = new RichtextUtil(); $oEntry->setText($oUtil->getTagParser($sText)); assert($sOldText === $oEntry->getText()); $oEntry->save(); } // add the post-migration code here }
public function saveData($aData) { $oJournalEntry = JournalEntryPeer::retrieveByPK($this->iJournalEntryId); if ($oJournalEntry === null) { $oJournalEntry = new JournalEntry(); $oJournalEntry->setJournalId($this->iJournalId); } $this->validate($aData); if (!Flash::noErrors()) { throw new ValidationException(); } $oJournalEntry->setJournalId($aData['journal_id']); $oJournalEntry->setTitle($aData['title']); $oJournalEntry->setIsPublished($aData['is_published']); $oJournalEntry->setPublishAt($aData['publish_at'] == null ? date('c') : $aData['publish_at']); $oRichtextUtil = new RichtextUtil(); $oRichtextUtil->setTrackReferences($oJournalEntry); $oJournalEntry->setText($oRichtextUtil->getTagParser($aData['text'])); $oJournalEntry->save(); $oResult = new StdClass(); if ($this->iJournalEntryId === null) { $oResult->inserted = true; } else { $oResult->updated = true; } $oResult->id = $this->iCategoryId = $oJournalEntry->getId(); return $oResult; }