Пример #1
0
 /**
  * Filter the query by a related \Category object
  *
  * @param \Category|ObjectCollection $category 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 ChildObjectCategoryQuery The current query, for fluid interface
  */
 public function filterByCategory($category, $comparison = null)
 {
     if ($category instanceof \Category) {
         return $this->addUsingAlias(ObjectCategoryTableMap::COL_ID_CATEGORY, $category->getId(), $comparison);
     } elseif ($category instanceof ObjectCollection) {
         if (null === $comparison) {
             $comparison = Criteria::IN;
         }
         return $this->addUsingAlias(ObjectCategoryTableMap::COL_ID_CATEGORY, $category->toKeyValue('PrimaryKey', 'Id'), $comparison);
     } else {
         throw new PropelException('filterByCategory() only accepts arguments of type \\Category or Collection');
     }
 }
Пример #2
0
 /**
  * Exclude object from result
  *
  * @param   ChildCategory $category Object to remove from the list of results
  *
  * @return $this|ChildCategoryQuery The current query, for fluid interface
  */
 public function prune($category = null)
 {
     if ($category) {
         $this->addUsingAlias(CategoryTableMap::COL_ID, $category->getId(), Criteria::NOT_EQUAL);
     }
     return $this;
 }
Пример #3
0
 /**
  * Declares an association between this object and a ChildCategory object.
  *
  * @param  ChildCategory $v
  * @return $this|\ObjectCategory The current object (for fluent API support)
  * @throws PropelException
  */
 public function setCategory(ChildCategory $v = null)
 {
     if ($v === null) {
         $this->setIdCategory(NULL);
     } else {
         $this->setIdCategory($v->getId());
     }
     $this->aCategory = $v;
     // Add binding for other direction of this n:n relationship.
     // If this object has already been added to the ChildCategory object, it will not be re-added.
     if ($v !== null) {
         $v->addObjectCategory($this);
     }
     return $this;
 }