コード例 #1
0
ファイル: AccessoryQuery.php プロジェクト: margery/thelia
 /**
  * Exclude object from result
  *
  * @param   ChildAccessory $accessory Object to remove from the list of results
  *
  * @return ChildAccessoryQuery The current query, for fluid interface
  */
 public function prune($accessory = null)
 {
     if ($accessory) {
         $this->addUsingAlias(AccessoryTableMap::ID, $accessory->getId(), Criteria::NOT_EQUAL);
     }
     return $this;
 }
コード例 #2
0
ファイル: Product.php プロジェクト: shirone/thelia
 /**
  * @param    ProductRelatedByProductId $productRelatedByProductId The productRelatedByProductId object to add.
  */
 protected function doAddProductRelatedByProductId($productRelatedByProductId)
 {
     $accessory = new ChildAccessory();
     $accessory->setProductRelatedByProductId($productRelatedByProductId);
     $this->addAccessoryRelatedByAccessory($accessory);
     // set the back reference to this object directly as using provided method either results
     // in endless loop or in multiple relations
     if (!$productRelatedByProductId->getProductsRelatedByAccessory()->contains($this)) {
         $foreignCollection = $productRelatedByProductId->getProductsRelatedByAccessory();
         $foreignCollection[] = $this;
     }
 }
コード例 #3
0
ファイル: Product.php プロジェクト: savvagee/thelia
 public function addAccessory(ProductAddAccessoryEvent $event)
 {
     if (AccessoryQuery::create()->filterByAccessory($event->getAccessoryId())->filterByProductId($event->getProduct()->getId())->count() <= 0) {
         $accessory = new Accessory();
         $accessory->setDispatcher($event->getDispatcher())->setProductId($event->getProduct()->getId())->setAccessory($event->getAccessoryId())->save();
     }
 }
コード例 #4
0
ファイル: ProductQuery.php プロジェクト: alex63530/thelia
 /**
  * Filter the query by a related \Thelia\Model\Accessory object
  *
  * @param \Thelia\Model\Accessory|ObjectCollection $accessory  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 filterByAccessoryRelatedByAccessory($accessory, $comparison = null)
 {
     if ($accessory instanceof \Thelia\Model\Accessory) {
         return $this->addUsingAlias(ProductTableMap::ID, $accessory->getAccessory(), $comparison);
     } elseif ($accessory instanceof ObjectCollection) {
         return $this->useAccessoryRelatedByAccessoryQuery()->filterByPrimaryKeys($accessory->getPrimaryKeys())->endUse();
     } else {
         throw new PropelException('filterByAccessoryRelatedByAccessory() only accepts arguments of type \\Thelia\\Model\\Accessory or Collection');
     }
 }