Returns the number of related DealerVersion objects.

@param      Criteria $criteria
@param      boolean $distinct
@param      ConnectionInterface $con
@return int             Count of related DealerVersion objects.
@throws PropelException
177224
public function countDealerVersions(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
    {
        $partial = $this->collDealerVersionsPartial && !$this->isNew();
        if (null === $this->collDealerVersions || null !== $criteria || $partial) {
            if ($this->isNew() && null === $this->collDealerVersions) {
                return 0;
            }

            if ($partial && !$criteria) {
                return count($this->getDealerVersions());
            }

            $query = ChildDealerVersionQuery::create(null, $criteria);
            if ($distinct) {
                $query->distinct();
            }

            return $query
                ->filterByDealer($this)
                ->count($con);
        }

        return count($this->collDealerVersions);
    }
900099
public function getDescendants(Criteria $criteria = null, ConnectionInterface $con = null)
    {
        if ($this->isLeaf()) {
            return array();
        } else {
            return ChildCategoryQuery::create(null, $criteria)
                ->descendantsOf($this)
                ->orderByBranch()
                ->find($con);
        }
    }
1250814
public function countRolePermissions(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
    {
        $partial = $this->collRolePermissionsPartial && !$this->isNew();
        if (null === $this->collRolePermissions || null !== $criteria || $partial) {
            if ($this->isNew() && null === $this->collRolePermissions) {
                return 0;
            }

            if ($partial && !$criteria) {
                return count($this->getRolePermissions());
            }

            $query = ChildRolePermissionQuery::create(null, $criteria);
            if ($distinct) {
                $query->distinct();
            }

            return $query
                ->filterByPermission($this)
                ->count($con);
        }

        return count($this->collRolePermissions);
    }
939127
public function countDealerProducts(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
    {
        $partial = $this->collDealerProductsPartial && !$this->isNew();
        if (null === $this->collDealerProducts || null !== $criteria || $partial) {
            if ($this->isNew() && null === $this->collDealerProducts) {
                return 0;
            }

            if ($partial && !$criteria) {
                return count($this->getDealerProducts());
            }

            $query = ChildDealerProductQuery::create(null, $criteria);
            if ($distinct) {
                $query->distinct();
            }

            return $query
                ->filterByDealer($this)
                ->count($con);
        }

        return count($this->collDealerProducts);
    }
535375
public function countUserRoles(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
    {
        $partial = $this->collUserRolesPartial && !$this->isNew();
        if (null === $this->collUserRoles || null !== $criteria || $partial) {
            if ($this->isNew() && null === $this->collUserRoles) {
                return 0;
            }

            if ($partial && !$criteria) {
                return count($this->getUserRoles());
            }
            $query = UserRoleQuery::create(null, $criteria);
            if ($distinct) {
                $query->distinct();
            }

            return $query
                ->filterByRole($this)
                ->count($con);
        }

        return count($this->collUserRoles);
    }
34634
public function countSkillGroups(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
    {
        $partial = $this->collSkillGroupsPartial && !$this->isNew();
        if (null === $this->collSkillGroups || null !== $criteria || $partial) {
            if ($this->isNew() && null === $this->collSkillGroups) {
                return 0;
            }

            if ($partial && !$criteria) {
                return count($this->getSkillGroups());
            }

            $query = ChildSkillGroupQuery::create(null, $criteria);
            if ($distinct) {
                $query->distinct();
            }

            return $query
                ->filterByGroup($this)
                ->count($con);
        }

        return count($this->collSkillGroups);
    }
135670
public function getLastVersions($number = 10, $criteria = null, $con = null)
    {
        $criteria = ChildDealerBrandVersionQuery::create(null, $criteria);
        $criteria->addDescendingOrderByColumn(DealerBrandVersionTableMap::VERSION);
        $criteria->limit($number);

        return $this->getDealerBrandVersions($criteria, $con);
    }
1011454
public function countPages(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
    {
        $partial = $this->collPagesPartial && !$this->isNew();
        if (null === $this->collPages || null !== $criteria || $partial) {
            if ($this->isNew() && null === $this->collPages) {
                return 0;
            }

            if ($partial && !$criteria) {
                return count($this->getPages());
            }

            $query = ChildPageQuery::create(null, $criteria);
            if ($distinct) {
                $query->distinct();
            }

            return $query
                ->filterBySource($this)
                ->count($con);
        }

        return count($this->collPages);
    }
502444
public function countM2Ps(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
    {
        $partial = $this->collM2PsPartial && !$this->isNew();
        if (null === $this->collM2Ps || null !== $criteria || $partial) {
            if ($this->isNew() && null === $this->collM2Ps) {
                return 0;
            }

            if ($partial && !$criteria) {
                return count($this->getM2Ps());
            }

            $query = ChildM2PQuery::create(null, $criteria);
            if ($distinct) {
                $query->distinct();
            }

            return $query
                ->filterByMedia($this)
                ->count($con);
        }

        return count($this->collM2Ps);
    }
968471
public function getLastVersions($number = 10, $criteria = null, $con = null)
    {
        $criteria = ChildDealerShedulesVersionQuery::create(null, $criteria);
        $criteria->addDescendingOrderByColumn(DealerShedulesVersionTableMap::VERSION);
        $criteria->limit($number);

        return $this->getDealerShedulesVersions($criteria, $con);
    }
1151855
public function countDealerAdmins(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
    {
        $partial = $this->collDealerAdminsPartial && !$this->isNew();
        if (null === $this->collDealerAdmins || null !== $criteria || $partial) {
            if ($this->isNew() && null === $this->collDealerAdmins) {
                return 0;
            }

            if ($partial && !$criteria) {
                return count($this->getDealerAdmins());
            }

            $query = ChildDealerAdminQuery::create(null, $criteria);
            if ($distinct) {
                $query->distinct();
            }

            return $query
                ->filterByDealer($this)
                ->count($con);
        }

        return count($this->collDealerAdmins);
    }
1192337
public function countPersonFunctionLinks(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
    {
        $partial = $this->collPersonFunctionLinksPartial && !$this->isNew();
        if (null === $this->collPersonFunctionLinks || null !== $criteria || $partial) {
            if ($this->isNew() && null === $this->collPersonFunctionLinks) {
                return 0;
            }

            if ($partial && !$criteria) {
                return count($this->getPersonFunctionLinks());
            }

            $query = ChildPersonFunctionLinkQuery::create(null, $criteria);
            if ($distinct) {
                $query->distinct();
            }

            return $query
                ->filterByPersonFunction($this)
                ->count($con);
        }

        return count($this->collPersonFunctionLinks);
    }
232731
public function countPersonFunctionI18ns(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
    {
        $partial = $this->collPersonFunctionI18nsPartial && !$this->isNew();
        if (null === $this->collPersonFunctionI18ns || null !== $criteria || $partial) {
            if ($this->isNew() && null === $this->collPersonFunctionI18ns) {
                return 0;
            }

            if ($partial && !$criteria) {
                return count($this->getPersonFunctionI18ns());
            }

            $query = ChildPersonFunctionI18nQuery::create(null, $criteria);
            if ($distinct) {
                $query->distinct();
            }

            return $query
                ->filterByPersonFunction($this)
                ->count($con);
        }

        return count($this->collPersonFunctionI18ns);
    }
435836
public function countByCriteria(Criteria $criteria)
    {
        $qb = $this->createCriteriaQueryBuilder($criteria, 'm');

        $qb->select('COUNT(m.id)');

        return $qb->getQuery()->getSingleScalarResult();
    }
287822
public function countStructureNodes(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
    {
        $partial = $this->collStructureNodesPartial && !$this->isNew();
        if (null === $this->collStructureNodes || null !== $criteria || $partial) {
            if ($this->isNew() && null === $this->collStructureNodes) {
                return 0;
            }

            if ($partial && !$criteria) {
                return count($this->getStructureNodes());
            }

            $query = ChildStructureNodeQuery::create(null, $criteria);
            if ($distinct) {
                $query->distinct();
            }

            return $query
                ->filterBySkill($this)
                ->count($con);
        }

        return count($this->collStructureNodes);
    }
1007869
public function countPersonImages(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
    {
        $partial = $this->collPersonImagesPartial && !$this->isNew();
        if (null === $this->collPersonImages || null !== $criteria || $partial) {
            if ($this->isNew() && null === $this->collPersonImages) {
                return 0;
            }

            if ($partial && !$criteria) {
                return count($this->getPersonImages());
            }

            $query = ChildPersonImageQuery::create(null, $criteria);
            if ($distinct) {
                $query->distinct();
            }

            return $query
                ->filterByPerson($this)
                ->count($con);
        }

        return count($this->collPersonImages);
    }
958328
public function count($criteria=null)
	{
		$query=new CJoinQuery($this,$criteria);
		// ensure only one big join statement is used
		$this->_finder->baseLimited=false;
		$this->_finder->joinAll=true;
		$this->buildQuery($query);

		$query->limit=$query->offset=-1;

		if(!empty($criteria->group) || !empty($criteria->having))
		{
			$query->orders = array();
			$command=$query->createCommand($this->_builder);
			$sql=$command->getText();
			$sql="SELECT COUNT(*) FROM ({$sql}) sq";
			$command->setText($sql);
			$command->params=$query->params;
			return $command->queryScalar();
		}
		else
		{
			$select=is_array($criteria->select) ? implode(',',$criteria->select) : $criteria->select;
			if($select!=='*' && preg_match('/^count\s*\(/i',trim($select)))
				$query->selects=array($select);
			elseif(is_string($this->_table->primaryKey))
			{
				$prefix=$this->getColumnPrefix();
				$schema=$this->_builder->getSchema();
				$column=$prefix.$schema->quoteColumnName($this->_table->primaryKey);
				$query->selects=array("COUNT(DISTINCT $column)");
			}
			else
				$query->selects=array("COUNT(*)");

			$query->orders=$query->groups=$query->havings=array();
			$command=$query->createCommand($this->_builder);
			return $command->queryScalar();
		}
	}