public function postUp($manager) { // add the post-migration code here foreach (JournalEntryQuery::create()->find() as $oJournalEntry) { $oJournalEntry->setPublishAt($oJournalEntry->getCreatedAt()); $oJournalEntry->save(); } }
public static function create($sModelAlias = null, $oCriteria = null) { $oQuery = JournalEntryQuery::create($sModelAlias, $oCriteria); if (Manager::getCurrentPrefix() !== 'preview') { return $oQuery->excludeDraft(); } return $oQuery; }
public function postUp($manager) { foreach (JournalEntryQuery::create()->find() as $oEntry) { $oEntry->setSlug(mb_substr($oEntry->getName(), 11)); $oEntry->setUpdatedAt($oEntry->getUpdatedAt()); $oEntry->setUpdatedBy($oEntry->getUpdatedBy()); $oEntry->save(); } // add the post-migration code here }
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 }
/** * If this collection has already been initialized with * an identical criteria, it returns the collection. * Otherwise if this Journal is new, it will return * an empty collection; or if this Journal has previously * been saved, it will retrieve related JournalEntrys from storage. * * This method is protected by default in order to keep the public * api reasonable. You can provide public methods for those you * actually need in Journal. * * @param Criteria $criteria optional Criteria object to narrow the query * @param PropelPDO $con optional connection object * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN) * @return PropelObjectCollection|JournalEntry[] List of JournalEntry objects */ public function getJournalEntrysJoinUserRelatedByUpdatedBy($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) { $query = JournalEntryQuery::create(null, $criteria); $query->joinWith('UserRelatedByUpdatedBy', $join_behavior); return $this->getJournalEntrys($query, $con); }
/** * Get the associated JournalEntry object * * @param PropelPDO $con Optional Connection object. * @param $doQuery Executes a query to get the object if required * @return JournalEntry The associated JournalEntry object. * @throws PropelException */ public function getJournalEntry(PropelPDO $con = null, $doQuery = true) { if ($this->aJournalEntry === null && $this->journal_entry_id !== null && $doQuery) { $this->aJournalEntry = JournalEntryQuery::create()->findPk($this->journal_entry_id, $con); /* The following can be used additionally to guarantee the related object contains a reference to this object. This level of coupling may, however, be undesirable since it could result in an only partially populated collection in the referenced object. $this->aJournalEntry->addJournalComments($this); */ } return $this->aJournalEntry; }
private function createQuery() { return $this->bIsPreview ? JournalEntryQuery::create() : FrontendJournalEntryQuery::create(); }
/** * Removes this object from datastore and sets delete attribute. * * @param PropelPDO $con * @return void * @throws PropelException * @throws Exception * @see BaseObject::setDeleted() * @see BaseObject::isDeleted() */ public function delete(PropelPDO $con = null) { if ($this->isDeleted()) { throw new PropelException("This object has already been deleted."); } if ($con === null) { $con = Propel::getConnection(JournalEntryPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); } $con->beginTransaction(); try { $deleteQuery = JournalEntryQuery::create()->filterByPrimaryKey($this->getPrimaryKey()); $ret = $this->preDelete($con); // denyable behavior if (!(JournalEntryPeer::isIgnoringRights() || $this->mayOperate("delete"))) { throw new PropelException(new NotPermittedException("delete.by_role", array("role_key" => "journal_entries"))); } if ($ret) { $deleteQuery->delete($con); $this->postDelete($con); $con->commit(); $this->setDeleted(true); } else { $con->commit(); } } catch (Exception $e) { $con->rollBack(); throw $e; } }
/** * Returns a new JournalEntryQuery object. * * @param string $modelAlias The alias of a model in the query * @param JournalEntryQuery|Criteria $criteria Optional Criteria to build the query from * * @return JournalEntryQuery */ public static function create($modelAlias = null, $criteria = null) { if ($criteria instanceof JournalEntryQuery) { return $criteria; } $query = new JournalEntryQuery(null, null, $modelAlias); if ($criteria instanceof Criteria) { $query->mergeWith($criteria); } return $query; }
public function getCriteria() { $oQuery = JournalEntryQuery::create()->joinJournal(); if ($this->oTagFilter && $this->oDelegateProxy->getListSettings()->getFilterColumnValue('has_tags') !== CriteriaListWidgetDelegate::SELECT_ALL) { $oQuery->filterByTagId($this->oDelegateProxy->getListSettings()->getFilterColumnValue('has_tags')); } return $oQuery; }
public static function getRecentPosts($iBlogId, $sUserName, $sPassword, $iCount) { if (!self::checkLogin($sUserName, $sPassword)) { return self::loginError(); } $oQuery = JournalEntryQuery::create()->filterByJournalId($iBlogId)->mostRecentFirst()->limit($iCount); $oJournalPage = JournalQuery::create()->findPk($iBlogId)->getJournalPage(); $aResult = array(); foreach ($oQuery->find() as $oJournalEntry) { $aResult[] = $oJournalEntry->getRssAttributes($oJournalPage, true); } return $aResult; }