/** * 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 StateQuery 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(StatePeer::ID, $principal->getStateId(), $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'); } }