Example #1
0
 /**
  * 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                 PrincipalQuery 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(PrincipalPeer::ID, $product->getPrincipalId(), $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');
     }
 }