/** * Filter the query by a related State object * * @param State|PropelObjectCollection $state The related object(s) to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return PrincipalQuery The current query, for fluid interface * @throws PropelException - if the provided filter is invalid. */ public function filterByState($state, $comparison = null) { if ($state instanceof State) { return $this->addUsingAlias(PrincipalPeer::STATE_ID, $state->getId(), $comparison); } elseif ($state instanceof PropelObjectCollection) { if (null === $comparison) { $comparison = Criteria::IN; } return $this->addUsingAlias(PrincipalPeer::STATE_ID, $state->toKeyValue('PrimaryKey', 'Id'), $comparison); } else { throw new PropelException('filterByState() only accepts arguments of type State or PropelCollection'); } }