public static function retrieveByUser($user_id, $max = 5)
 {
     $userGroups = HistoryGroupUserPeer::retrieveByUserId($user_id);
     $groups = array();
     foreach ($userGroups as $result) {
         $groups[] = $result->getHistoryGroup();
     }
     $c = new Criteria();
     $crit0 = $c->getNewCriterion(self::HISTORY_GROUP_ID, '');
     $crit_groups = array();
     foreach ($groups as $group) {
         $group = HistoryGroupPeer::retrieveByName($group->getName());
         $crit_groups[] = $c->getNewCriterion(self::HISTORY_GROUP_ID, $group->getId());
     }
     sfContext::getInstance()->getLogger()->info('Groups: [' . count($crit_groups) . ']');
     foreach ($crit_groups as $crit_group) {
         $crit0->addOr($crit_group);
     }
     $c->add($crit0);
     $c->addDescendingOrderByColumn(self::CREATED_AT);
     $c->setLimit($max);
     sfContext::getInstance()->getLogger()->info('Grabbing history now');
     return self::doSelect($c);
 }
Exemple #2
0
 public function getHistoryGroup()
 {
     $group = HistoryGroupPeer::retrieveByName($this->getUuid() . '-project-history');
     if ($group == null) {
         $group = $this->createHistoryGroup();
     }
     return $group;
 }
 public function getHistoryGroup()
 {
     $group = HistoryGroupPeer::retrieveByName('feature-history-' . $this->getUuid());
     if ($group == null) {
         $group = $this->createHistoryGroup();
     }
     return $group;
 }