public function executeSitemap() { $sitemap = new sfDefaultSitemap(); $projects = ProjectPeer::doSelect(new Criteria()); $priority = '0.3'; $freq = 'weekly'; foreach ($projects as $project) { $item = new sfSitemapItem(); $item->initialize(array('loc' => '@show_project?project=' . $project->getSlug(), 'lastmod' => $project->getUpdatedAt(), 'changeFreq' => $freq, 'piority' => $priority)); $sitemap->addItem($item); } $members = sfGuardUserProfilePeer::doSelect(new Criteria()); foreach ($members as $member) { $item = new sfSitemapItem(); $item->initialize(array('loc' => '@show_user?user='******'lastmod' => $member->getUpdatedAt(), 'changeFreq' => $freq, 'piority' => $priority)); $sitemap->addItem($item); } $features = SuggestedFeaturePeer::doSelect(new Criteria()); $freq = 'daily'; foreach ($features as $feature) { $item = new sfSitemapItem(); $item->initialize(array('loc' => '@show_feature?feature=' . $feature->getUuid(), 'lastmod' => $feature->getUpdatedAt(), 'changeFreq' => $freq, 'piority' => $priority)); $sitemap->addItem($item); } $this->sitemap = $sitemap; }
public function executeAutoMessageComplete() { $field = $this->getRequestParameter('field'); $value = $this->getRequestParameter('user_' . $field); //if ($value == null) $value = $this->getRequestParameter('recipient'); $this->forward404Unless($field, 'Either field or value missing'); $this->logMessage('value: [' . $value . ']'); $c = new Criteria(); switch ($field) { case 'recipient': case 'name': $crit1 = $c->getNewCriterion(sfGuardUserProfilePeer::FIRST_NAME, "%" . $value . "%", Criteria::LIKE); $crit2 = $c->getNewCriterion(sfGuardUserProfilePeer::LAST_NAME, "%" . $value . "%", Criteria::LIKE); $crit3 = $c->getNewCriterion(sfGuardUserProfilePeer::FIRST_NAME, 'UPPER(CONCAT(' . sfGuardUserProfilePeer::FIRST_NAME . ', " ", ' . sfGuardUserProfilePeer::LAST_NAME . ')) LIKE UPPER(\'%' . $value . '%\')', Criteria::CUSTOM); // Building an OR statement with propel...not that much fun $crit1->addOr($crit2); $crit1->addOr($crit3); $c->add($crit1); } //$c->addLimit(3); $c->setIgnoreCase(true); $this->searchTerm = $value; $this->results = sfGuardUserProfilePeer::doSelect($c); }
public function getsfGuardUserProfiles($criteria = null, $con = null) { include_once 'lib/model/om/BasesfGuardUserProfilePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } if ($this->collsfGuardUserProfiles === null) { if ($this->isNew()) { $this->collsfGuardUserProfiles = array(); } else { $criteria->add(sfGuardUserProfilePeer::USER_ID, $this->getId()); sfGuardUserProfilePeer::addSelectColumns($criteria); $this->collsfGuardUserProfiles = sfGuardUserProfilePeer::doSelect($criteria, $con); } } else { if (!$this->isNew()) { $criteria->add(sfGuardUserProfilePeer::USER_ID, $this->getId()); sfGuardUserProfilePeer::addSelectColumns($criteria); if (!isset($this->lastsfGuardUserProfileCriteria) || !$this->lastsfGuardUserProfileCriteria->equals($criteria)) { $this->collsfGuardUserProfiles = sfGuardUserProfilePeer::doSelect($criteria, $con); } } } $this->lastsfGuardUserProfileCriteria = $criteria; return $this->collsfGuardUserProfiles; }
/** * Retrieve multiple objects by pkey. * * @param array $pks List of primary keys * @param PropelPDO $con the connection to use * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function retrieveByPKs($pks, PropelPDO $con = null) { if ($con === null) { $con = Propel::getConnection(sfGuardUserProfilePeer::DATABASE_NAME, Propel::CONNECTION_READ); } $objs = null; if (empty($pks)) { $objs = array(); } else { $criteria = new Criteria(sfGuardUserProfilePeer::DATABASE_NAME); $criteria->add(sfGuardUserProfilePeer::ID, $pks, Criteria::IN); $objs = sfGuardUserProfilePeer::doSelect($criteria, $con); } return $objs; }
/** * Gets an array of sfGuardUserProfile objects which contain a foreign key that references this object. * * If this collection has already been initialized with an identical Criteria, it returns the collection. * Otherwise if this UserType has previously been saved, it will retrieve * related sfGuardUserProfiles from storage. If this UserType is new, it will return * an empty collection or the current collection, the criteria is ignored on a new object. * * @param PropelPDO $con * @param Criteria $criteria * @return array sfGuardUserProfile[] * @throws PropelException */ public function getsfGuardUserProfiles($criteria = null, PropelPDO $con = null) { if ($criteria === null) { $criteria = new Criteria(UserTypePeer::DATABASE_NAME); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } if ($this->collsfGuardUserProfiles === null) { if ($this->isNew()) { $this->collsfGuardUserProfiles = array(); } else { $criteria->add(sfGuardUserProfilePeer::USER_TYPE_ID, $this->id); sfGuardUserProfilePeer::addSelectColumns($criteria); $this->collsfGuardUserProfiles = sfGuardUserProfilePeer::doSelect($criteria, $con); } } else { // criteria has no effect for a new object if (!$this->isNew()) { // the following code is to determine if a new query is // called for. If the criteria is the same as the last // one, just return the collection. $criteria->add(sfGuardUserProfilePeer::USER_TYPE_ID, $this->id); sfGuardUserProfilePeer::addSelectColumns($criteria); if (!isset($this->lastsfGuardUserProfileCriteria) || !$this->lastsfGuardUserProfileCriteria->equals($criteria)) { $this->collsfGuardUserProfiles = sfGuardUserProfilePeer::doSelect($criteria, $con); } } } $this->lastsfGuardUserProfileCriteria = $criteria; return $this->collsfGuardUserProfiles; }