/** * Filter the query by a related State object * * @param State|PropelObjectCollection $state the related object to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return CountryQuery 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(CountryPeer::ID, $state->getCountryId(), $comparison); } elseif ($state instanceof PropelObjectCollection) { return $this->useStateQuery()->filterByPrimaryKeys($state->getPrimaryKeys())->endUse(); } else { throw new PropelException('filterByState() only accepts arguments of type State or PropelCollection'); } }