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