Esempio n. 1
0
 /**
  * Remove category of this object
  * through the object_category cross reference table.
  *
  * @param ChildCategory $category
  * @return ChildObject The current object (for fluent API support)
  */
 public function removeCategory(ChildCategory $category)
 {
     if ($this->getCategories()->contains($category)) {
         $objectCategory = new ChildObjectCategory();
         $objectCategory->setCategory($category);
         if ($category->isObjectsLoaded()) {
             //remove the back reference if available
             $category->getObjects()->removeObject($this);
         }
         $objectCategory->setObject($this);
         $this->removeObjectCategory(clone $objectCategory);
         $objectCategory->clear();
         $this->collCategories->remove($this->collCategories->search($category));
         if (null === $this->categoriesScheduledForDeletion) {
             $this->categoriesScheduledForDeletion = clone $this->collCategories;
             $this->categoriesScheduledForDeletion->clear();
         }
         $this->categoriesScheduledForDeletion->push($category);
     }
     return $this;
 }
Esempio n. 2
0
 /**
  * Filter the query by a related \ObjectCategory object
  *
  * @param \ObjectCategory|ObjectCollection $objectCategory the related object to use as filter
  * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return ChildCategoryQuery The current query, for fluid interface
  */
 public function filterByObjectCategory($objectCategory, $comparison = null)
 {
     if ($objectCategory instanceof \ObjectCategory) {
         return $this->addUsingAlias(CategoryTableMap::COL_ID, $objectCategory->getIdCategory(), $comparison);
     } elseif ($objectCategory instanceof ObjectCollection) {
         return $this->useObjectCategoryQuery()->filterByPrimaryKeys($objectCategory->getPrimaryKeys())->endUse();
     } else {
         throw new PropelException('filterByObjectCategory() only accepts arguments of type \\ObjectCategory or Collection');
     }
 }
Esempio n. 3
0
 /**
  * Exclude object from result
  *
  * @param   ChildObjectCategory $objectCategory Object to remove from the list of results
  *
  * @return $this|ChildObjectCategoryQuery The current query, for fluid interface
  */
 public function prune($objectCategory = null)
 {
     if ($objectCategory) {
         $this->addCond('pruneCond0', $this->getAliasedColName(ObjectCategoryTableMap::COL_ID_OBJECT), $objectCategory->getIdObject(), Criteria::NOT_EQUAL);
         $this->addCond('pruneCond1', $this->getAliasedColName(ObjectCategoryTableMap::COL_ID_CATEGORY), $objectCategory->getIdCategory(), Criteria::NOT_EQUAL);
         $this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
     }
     return $this;
 }