/**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database. In some cases you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by find*()
  * and findPk*() calls.
  *
  * @param \Thelia\Model\ProductCategory $obj A \Thelia\Model\ProductCategory object.
  * @param string $key             (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool($obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if (null === $key) {
             $key = serialize(array((string) $obj->getProductId(), (string) $obj->getCategoryId()));
         }
         // if key === null
         self::$instances[$key] = $obj;
     }
 }
Exemple #2
0
 /**
  * Filter the query by a related \Thelia\Model\ProductCategory object
  *
  * @param \Thelia\Model\ProductCategory|ObjectCollection $productCategory  the related object to use as filter
  * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return ChildProductQuery The current query, for fluid interface
  */
 public function filterByProductCategory($productCategory, $comparison = null)
 {
     if ($productCategory instanceof \Thelia\Model\ProductCategory) {
         return $this->addUsingAlias(ProductTableMap::ID, $productCategory->getProductId(), $comparison);
     } elseif ($productCategory instanceof ObjectCollection) {
         return $this->useProductCategoryQuery()->filterByPrimaryKeys($productCategory->getPrimaryKeys())->endUse();
     } else {
         throw new PropelException('filterByProductCategory() only accepts arguments of type \\Thelia\\Model\\ProductCategory or Collection');
     }
 }
 /**
  * Exclude object from result
  *
  * @param   ChildProductCategory $productCategory Object to remove from the list of results
  *
  * @return ChildProductCategoryQuery The current query, for fluid interface
  */
 public function prune($productCategory = null)
 {
     if ($productCategory) {
         $this->addCond('pruneCond0', $this->getAliasedColName(ProductCategoryTableMap::PRODUCT_ID), $productCategory->getProductId(), Criteria::NOT_EQUAL);
         $this->addCond('pruneCond1', $this->getAliasedColName(ProductCategoryTableMap::CATEGORY_ID), $productCategory->getCategoryId(), Criteria::NOT_EQUAL);
         $this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
     }
     return $this;
 }