Beispiel #1
0
 public function countPeriodos(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
 {
     if ($criteria === null) {
         $criteria = new Criteria(CiclolectivoPeer::DATABASE_NAME);
     } else {
         $criteria = clone $criteria;
     }
     if ($distinct) {
         $criteria->setDistinct();
     }
     $count = null;
     if ($this->collPeriodos === null) {
         if ($this->isNew()) {
             $count = 0;
         } else {
             $criteria->add(PeriodoPeer::FK_CICLOLECTIVO_ID, $this->id);
             $count = PeriodoPeer::doCount($criteria, $con);
         }
     } else {
         if (!$this->isNew()) {
             $criteria->add(PeriodoPeer::FK_CICLOLECTIVO_ID, $this->id);
             if (!isset($this->lastPeriodoCriteria) || !$this->lastPeriodoCriteria->equals($criteria)) {
                 $count = PeriodoPeer::doCount($criteria, $con);
             } else {
                 $count = count($this->collPeriodos);
             }
         } else {
             $count = count($this->collPeriodos);
         }
     }
     return $count;
 }
Beispiel #2
0
 /**
  * Returns the number of related Periodo objects.
  *
  * @param      Criteria $criteria
  * @param      boolean $distinct
  * @param      PropelPDO $con
  * @return     int Count of related Periodo objects.
  * @throws     PropelException
  */
 public function countPeriodos(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
 {
     if ($criteria === null) {
         $criteria = new Criteria(GradePeer::DATABASE_NAME);
     } else {
         $criteria = clone $criteria;
     }
     if ($distinct) {
         $criteria->setDistinct();
     }
     $count = null;
     if ($this->collPeriodos === null) {
         if ($this->isNew()) {
             $count = 0;
         } else {
             $criteria->add(PeriodoPeer::GRADE_ID, $this->id);
             $count = PeriodoPeer::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(PeriodoPeer::GRADE_ID, $this->id);
             if (!isset($this->lastPeriodoCriteria) || !$this->lastPeriodoCriteria->equals($criteria)) {
                 $count = PeriodoPeer::doCount($criteria, false, $con);
             } else {
                 $count = count($this->collPeriodos);
             }
         } else {
             $count = count($this->collPeriodos);
         }
     }
     return $count;
 }