public static function countPartidosReviewed() { $cache = sfcontext::getInstance()->getViewCacheManager() ? sfcontext::getInstance()->getViewCacheManager()->getCache() : false; if ($cache) { $key = md5("partidos_reviewed_counter"); $data = unserialize($cache->get($key)); } else { $data = false; } if (!$data) { $cpar = new Criteria(); $cpar->addJoin(PartidoPeer::ID, SfReviewPeer::ENTITY_ID, Criteria::INNER_JOIN); $cpar->add(SfReviewPeer::SF_REVIEW_TYPE_ID, Partido::NUM_ENTITY); $cpar->add(SfReviewPeer::IS_ACTIVE, TRUE); $cpar->add(PartidoPeer::IS_ACTIVE, TRUE); //$cpar->add(SfReviewPeer::CULTURE, $culture); $cpar->setDistinct(); $data = PartidoPeer::doCount($cpar); if ($cache) { $cache->set($key, serialize($data), 360); } } return $data; }
/** * Returns the number of related Partido objects. * * @param Criteria $criteria * @param boolean $distinct * @param PropelPDO $con * @return int Count of related Partido objects. * @throws PropelException */ public function countPartidosRelatedByPartidoId(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) { if ($criteria === null) { $criteria = new Criteria(PartidoPeer::DATABASE_NAME); } else { $criteria = clone $criteria; } if ($distinct) { $criteria->setDistinct(); } $count = null; if ($this->collPartidosRelatedByPartidoId === null) { if ($this->isNew()) { $count = 0; } else { $criteria->add(PartidoPeer::PARTIDO_ID, $this->id); $count = PartidoPeer::doCount($criteria, false, $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 count of the collection. $criteria->add(PartidoPeer::PARTIDO_ID, $this->id); if (!isset($this->lastPartidoRelatedByPartidoIdCriteria) || !$this->lastPartidoRelatedByPartidoIdCriteria->equals($criteria)) { $count = PartidoPeer::doCount($criteria, false, $con); } else { $count = count($this->collPartidosRelatedByPartidoId); } } else { $count = count($this->collPartidosRelatedByPartidoId); } } return $count; }