Пример #1
0
 public function countProvincias(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
 {
     if ($criteria === null) {
         $criteria = new Criteria(PaisPeer::DATABASE_NAME);
     } else {
         $criteria = clone $criteria;
     }
     if ($distinct) {
         $criteria->setDistinct();
     }
     $count = null;
     if ($this->collProvincias === null) {
         if ($this->isNew()) {
             $count = 0;
         } else {
             $criteria->add(ProvinciaPeer::FK_PAIS_ID, $this->id);
             $count = ProvinciaPeer::doCount($criteria, $con);
         }
     } else {
         if (!$this->isNew()) {
             $criteria->add(ProvinciaPeer::FK_PAIS_ID, $this->id);
             if (!isset($this->lastProvinciaCriteria) || !$this->lastProvinciaCriteria->equals($criteria)) {
                 $count = ProvinciaPeer::doCount($criteria, $con);
             } else {
                 $count = count($this->collProvincias);
             }
         } else {
             $count = count($this->collProvincias);
         }
     }
     return $count;
 }