/** * Returns the number of items overdue or due today * * @return integer */ public function getOverdueDueTodayCounter() { $criteria = new Criteria(); $lists = $this->getAllLists(); $listsId = array(); foreach ($lists as $list) { $listsId[] = $list->getId(); } $criteria->add(PcTaskPeer::LIST_ID, $listsId, Criteria::IN); $criteria->add(PcTaskPeer::IS_COMPLETED, 0, Criteria::EQUAL); $criteria->add(PcTaskPeer::DUE_DATE, NULL, Criteria::ISNOTNULL); $today = date('Y-m-d', strtotime('today')); $criteria->add(PcTaskPeer::DUE_DATE, $today, Criteria::LESS_EQUAL); return PcTaskPeer::doCount($criteria); }
/** * Returns the number of related PcTask objects. * * @param Criteria $criteria * @param boolean $distinct * @param PropelPDO $con * @return int Count of related PcTask objects. * @throws PropelException */ public function countPcTasks(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) { if ($criteria === null) { $criteria = new Criteria(PcRepetitionPeer::DATABASE_NAME); } else { $criteria = clone $criteria; } if ($distinct) { $criteria->setDistinct(); } $count = null; if ($this->collPcTasks === null) { if ($this->isNew()) { $count = 0; } else { $criteria->add(PcTaskPeer::REPETITION_ID, $this->id); $count = PcTaskPeer::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(PcTaskPeer::REPETITION_ID, $this->id); if (!isset($this->lastPcTaskCriteria) || !$this->lastPcTaskCriteria->equals($criteria)) { $count = PcTaskPeer::doCount($criteria, false, $con); } else { $count = count($this->collPcTasks); } } else { $count = count($this->collPcTasks); } } return $count; }