/** * Filter the query by a related Product object * * @param Product|PropelObjectCollection $product the related object to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return CategoryQuery The current query, for fluid interface * @throws PropelException - if the provided filter is invalid. */ public function filterByProduct($product, $comparison = null) { if ($product instanceof Product) { return $this->addUsingAlias(CategoryPeer::ENTITY_ID, $product->getCategoryId(), $comparison); } elseif ($product instanceof PropelObjectCollection) { return $this->useProductQuery()->filterByPrimaryKeys($product->getPrimaryKeys())->endUse(); } else { throw new PropelException('filterByProduct() only accepts arguments of type Product or PropelCollection'); } }