Esempio n. 1
0
 /**
  * Filter the query by a related \ORM\Unit object
  *
  * @param \ORM\Unit|ObjectCollection $unit The related object(s) to use as filter
  * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return ChildStockQuery The current query, for fluid interface
  */
 public function filterByUnit($unit, $comparison = null)
 {
     if ($unit instanceof \ORM\Unit) {
         return $this->addUsingAlias(StockTableMap::COL_UNIT_ID, $unit->getId(), $comparison);
     } elseif ($unit instanceof ObjectCollection) {
         if (null === $comparison) {
             $comparison = Criteria::IN;
         }
         return $this->addUsingAlias(StockTableMap::COL_UNIT_ID, $unit->toKeyValue('PrimaryKey', 'Id'), $comparison);
     } else {
         throw new PropelException('filterByUnit() only accepts arguments of type \\ORM\\Unit or Collection');
     }
 }