示例#1
0
 public function countTaggings($criteria = null, $distinct = false, $con = null)
 {
     include_once 'plugins/sfPropelActAsTaggableBehaviorPlugin/lib/model/om/BaseTaggingPeer.php';
     if ($criteria === null) {
         $criteria = new Criteria();
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     $criteria->add(TaggingPeer::TAG_ID, $this->getID());
     return TaggingPeer::doCount($criteria, $distinct, $con);
 }
示例#2
0
 /**
  * Returns the number of related Tagging objects.
  *
  * @param      Criteria $criteria
  * @param      boolean $distinct
  * @param      PropelPDO $con
  * @return     int Count of related Tagging objects.
  * @throws     PropelException
  */
 public function countTaggings(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
 {
     if ($criteria === null) {
         $criteria = new Criteria(TagPeer::DATABASE_NAME);
     } else {
         $criteria = clone $criteria;
     }
     if ($distinct) {
         $criteria->setDistinct();
     }
     $count = null;
     if ($this->collTaggings === null) {
         if ($this->isNew()) {
             $count = 0;
         } else {
             $criteria->add(TaggingPeer::TAG_ID, $this->id);
             $count = TaggingPeer::doCount($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 count of the collection.
             $criteria->add(TaggingPeer::TAG_ID, $this->id);
             if (!isset($this->lastTaggingCriteria) || !$this->lastTaggingCriteria->equals($criteria)) {
                 $count = TaggingPeer::doCount($criteria, $con);
             } else {
                 $count = count($this->collTaggings);
             }
         } else {
             $count = count($this->collTaggings);
         }
     }
     return $count;
 }