/** * Filter the query by a related \Thelia\Model\Sale object * * @param \Thelia\Model\Sale|ObjectCollection $sale The related object(s) to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return ChildSaleProductQuery The current query, for fluid interface */ public function filterBySale($sale, $comparison = null) { if ($sale instanceof \Thelia\Model\Sale) { return $this->addUsingAlias(SaleProductTableMap::SALE_ID, $sale->getId(), $comparison); } elseif ($sale instanceof ObjectCollection) { if (null === $comparison) { $comparison = Criteria::IN; } return $this->addUsingAlias(SaleProductTableMap::SALE_ID, $sale->toKeyValue('PrimaryKey', 'Id'), $comparison); } else { throw new PropelException('filterBySale() only accepts arguments of type \\Thelia\\Model\\Sale or Collection'); } }