/** * Filter the query by a related \Categories object * * @param \Categories|ObjectCollection $categories The related object(s) to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @throws \Propel\Runtime\Exception\PropelException * * @return ChildItemsQuery The current query, for fluid interface */ public function filterByCategories($categories, $comparison = null) { if ($categories instanceof \Categories) { return $this->addUsingAlias(ItemsTableMap::COL_CATEGORY_ID, $categories->getCategoryId(), $comparison); } elseif ($categories instanceof ObjectCollection) { if (null === $comparison) { $comparison = Criteria::IN; } return $this->addUsingAlias(ItemsTableMap::COL_CATEGORY_ID, $categories->toKeyValue('PrimaryKey', 'CategoryId'), $comparison); } else { throw new PropelException('filterByCategories() only accepts arguments of type \\Categories or Collection'); } }