Exemple #1
0
 /**
  * Filter the query by a related Principal object
  *
  * @param   Principal|PropelObjectCollection $principal  the related object to use as filter
  * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return                 UserQuery The current query, for fluid interface
  * @throws PropelException - if the provided filter is invalid.
  */
 public function filterByPrincipal($principal, $comparison = null)
 {
     if ($principal instanceof Principal) {
         return $this->addUsingAlias(UserPeer::ID, $principal->getUserId(), $comparison);
     } elseif ($principal instanceof PropelObjectCollection) {
         return $this->usePrincipalQuery()->filterByPrimaryKeys($principal->getPrimaryKeys())->endUse();
     } else {
         throw new PropelException('filterByPrincipal() only accepts arguments of type Principal or PropelCollection');
     }
 }