src/Alchemy/Component/Cerberus/Model/Base/Role.php
public function countUsers(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
    {
        $partial = $this->collUsersPartial && !$this->isNew();
        if (null === $this->collUsers || null !== $criteria || $partial) {
            if ($this->isNew() && null === $this->collUsers) {
                return 0;
            } else {

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

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

                return $query
                    ->filterByRole($this)
                    ->count($con);
            }
        } else {
            return count($this->collUsers);
        }
    }
public function countUsers(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
    {
        $partial = $this->collUsersPartial && !$this->isNew();
        if (null === $this->collUsers || null !== $criteria || $partial) {
            if ($this->isNew() && null === $this->collUsers) {
                return 0;
            } else {

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

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

                return $query
                    ->filterByRole($this)
                    ->count($con);
            }
        } else {
            return count($this->collUsers);
        }
    }
public function countUsers ( Criteria $ criteria = null , $ distinct = false , ConnectionInterface $ con = null ) { $ partial = $ this -> collUsersPartial && ! $ this -> isNew ( ) ; if ( null === $ this -> collUsers || null !== $ criteria || $ partial ) { if ( $ this -> isNew ( ) && null === $ this -> collUsers ) { return 0 ; } else { if ( $ partial && ! $ criteria ) { return count ( $ this -> getUsers ( ) ) ; } $ query = ChildUserQuery :: create ( null , $ criteria ) ; if ( $ distinct ) { $ query -> distinct ( ) ; } return $ query -> filterByRole ( $ this ) -> count ( $ con ) ; } } else { return count ( $ this -> collUsers ) ; } }
Gets the number of User objects related by a many-to-many relationship
to the current object by way of the user_role cross-reference table.

@param      Criteria $criteria Optional query object to filter the query
@param      boolean $distinct Set to true to force count distinct
@param      ConnectionInterface $con Optional connection object

@return int the number of related User objects
Gets the number of User objects related by a many - to - many relationship to the current object by way of the user_role cross - reference table .