public function getLastHistoryEvent() { $c = new Criteria(); $c->addDescendingOrderByColumn(HistoryEventPeer::CREATED_AT); $c->add(HistoryEventPeer::HISTORY_GROUP_ID, $this->getId()); $event = HistoryEventPeer::doSelectOne($c); return $event; }
public static function retrieveByUuid($value) { $c = new Criteria(); $c->add(HistoryEventPeer::UUID, $value); return HistoryEventPeer::doSelectOne($c); }
public function getHistoryEventsJoinHistoryGroup($criteria = null, $con = null) { include_once 'lib/model/om/BaseHistoryEventPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } if ($this->collHistoryEvents === null) { if ($this->isNew()) { $this->collHistoryEvents = array(); } else { $criteria->add(HistoryEventPeer::USER_ID, $this->getId()); $this->collHistoryEvents = HistoryEventPeer::doSelectJoinHistoryGroup($criteria, $con); } } else { $criteria->add(HistoryEventPeer::USER_ID, $this->getId()); if (!isset($this->lastHistoryEventCriteria) || !$this->lastHistoryEventCriteria->equals($criteria)) { $this->collHistoryEvents = HistoryEventPeer::doSelectJoinHistoryGroup($criteria, $con); } } $this->lastHistoryEventCriteria = $criteria; return $this->collHistoryEvents; }
public function executeShowItem() { $this->event = HistoryEventPeer::retrieveByUuid($this->getRequestParameter('landing')); $this->forward404Unless($this->event, 'news item not found'); }
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = HistoryEventPeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) { $this->setId($arr[$keys[0]]); } if (array_key_exists($keys[1], $arr)) { $this->setUuid($arr[$keys[1]]); } if (array_key_exists($keys[2], $arr)) { $this->setHistoryGroupId($arr[$keys[2]]); } if (array_key_exists($keys[3], $arr)) { $this->setCategory($arr[$keys[3]]); } if (array_key_exists($keys[4], $arr)) { $this->setTitle($arr[$keys[4]]); } if (array_key_exists($keys[5], $arr)) { $this->setText($arr[$keys[5]]); } if (array_key_exists($keys[6], $arr)) { $this->setUserId($arr[$keys[6]]); } if (array_key_exists($keys[7], $arr)) { $this->setSlug($arr[$keys[7]]); } if (array_key_exists($keys[8], $arr)) { $this->setVersion($arr[$keys[8]]); } if (array_key_exists($keys[9], $arr)) { $this->setDeletedAt($arr[$keys[9]]); } if (array_key_exists($keys[10], $arr)) { $this->setCreatedAt($arr[$keys[10]]); } }
public function getDefaultFeed($max = 25) { $feed = new sfRssFeed(); $feed->initialize(array('title' => 'Cothink Feed for ' . $this->getFullName(), 'link' => 'http://www.cothink.org/', 'authorEmail' => $this->getPrimaryContactInfo()->getEmail(), 'authorName' => $this->getFullName())); $events = HistoryEventPeer::retrieveByUser($this->getUserId(), $max); // TODO: Allow user to configure max $eventItems = sfFeedPeer::convertObjectsToItems($events, array('routeName' => '@permalink')); $feed->addItems($eventItems); return $feed; }
public static function retrieveByPKs($pks, $con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } $objs = null; if (empty($pks)) { $objs = array(); } else { $criteria = new Criteria(); $criteria->add(HistoryEventPeer::ID, $pks, Criteria::IN); $objs = HistoryEventPeer::doSelect($criteria, $con); } return $objs; }