getId() public method

public getId ( ) : mixed
return mixed id
Example #1
0
 /**
  * A kosárhoz hozzá adja a terméket hozzá tartozó mennyiséggel együtt.
  * A products arrayben a termék id-je az index
  * és ugyan ezzel indexelem a qauntities tömböt, így te megoldásod is maradhat és egyértelmű.
  *
  * @param Product $product
  * @param int $quantity
  */
 public function addProduct($product, $quantity)
 {
     if (!isset($this->products[$product->getId()])) {
         $this->products[$product->getId()] = $product;
         $this->quantities[$product->getId()] = $quantity;
     } else {
         $this->quantities[$product->getId()] += $quantity;
     }
     //echo "elemek száma: " . count($this->items) . " db & " . count($this->quantity) . " db.<br>";
 }
 /**
  * Transforms an object (product) to a int (id).
  *
  * @param  Product|null $entity
  * @return string
  */
 public function transform($entity)
 {
     if (null === $entity) {
         return "";
     }
     return $entity->getId();
 }
 function compute(Product $product)
 {
     $discountProvider = DiscountProvider::getInstance();
     $discountAsPercent = $discountProvider->getDiscountFor($product->getId());
     $price = $product->getPrice();
     $discountAsValue = $price * $discountAsPercent / 100;
     return $price - $discountAsValue;
 }
 public function test_initialization()
 {
     $product = new Product();
     $this->assertEqual($product->getId(), 0);
     $this->assertEqual($product->getName(), '');
     $this->assertEqual($product->getCreated(), '');
     $this->assertEqual($product->getUpdated(), '');
 }
 public function editProduct(Product $product)
 {
     $editStmt = $this->db->prepare("UPDATE\n                            products\n                       SET\n                            name = ?, model = ?, price = ?, quantity = ?, category_id = ?\n                        WHERE id = ?")->execute([$product->getProductname(), $product->getProductmodel(), $product->getProductprice(), $product->getProductquantity(), $product->getCategory(), $product->getId()]);
     if ($editStmt->getAffectedRows() > 0) {
         return true;
     }
     return false;
 }
 public function getId()
 {
     if ($this->__isInitialized__ === false) {
         return (int) $this->_identifier["id"];
     }
     $this->__load();
     return parent::getId();
 }
 /**
  * Checks and repairs the internal consistency of the object.
  *
  * This method is executed after an already-instantiated object is re-hydrated
  * from the database.  It exists to check any foreign keys to make sure that
  * the objects related to the current object are correct based on foreign key.
  *
  * You can override this method in the stub class, but you should always invoke
  * the base method from the overridden method (i.e. parent::ensureConsistency()),
  * in case your model changes.
  *
  * @throws PropelException
  */
 public function ensureConsistency()
 {
     if ($this->aProduct !== null && $this->product_id !== $this->aProduct->getId()) {
         $this->aProduct = null;
     }
     if ($this->aGoogleshoppingAccount !== null && $this->googleshopping_account_id !== $this->aGoogleshoppingAccount->getId()) {
         $this->aGoogleshoppingAccount = null;
     }
 }
Example #8
0
 public static function loadImgbyProduct(Product $product)
 {
     $m = $product->getId();
     $sql = "SELECT * FROM images where product_id = '{$m}'";
     $re = self::$db->query($sql);
     if ($re) {
         return $re['link'];
     }
 }
 /**
  * Checks and repairs the internal consistency of the object.
  *
  * This method is executed after an already-instantiated object is re-hydrated
  * from the database.  It exists to check any foreign keys to make sure that
  * the objects related to the current object are correct based on foreign key.
  *
  * You can override this method in the stub class, but you should always invoke
  * the base method from the overridden method (i.e. parent::ensureConsistency()),
  * in case your model changes.
  *
  * @throws PropelException
  */
 public function ensureConsistency()
 {
     if ($this->aProduct !== null && $this->product_id !== $this->aProduct->getId()) {
         $this->aProduct = null;
     }
     if ($this->aAttributeAv !== null && $this->attribute_av_id !== $this->aAttributeAv->getId()) {
         $this->aAttributeAv = null;
     }
 }
 public static function create(Product $oProduct)
 {
     $oCartProduct = new CartProduct();
     $oCartProduct->setImage($oProduct->getImage());
     $oCartProduct->setId($oProduct->getId());
     $oCartProduct->setDescription($oProduct->getDescription());
     $oCartProduct->setName($oProduct->getName());
     $oCartProduct->setPrice($oProduct->getPrice());
     return $oCartProduct;
 }
 public function getObjectForProductAndParameter(Product $product, $param)
 {
     $q = $this->createQuery('c')->from('ParameterProductValue ppv')->where('ppv.Parameter.id = ? ', $param->getId())->addWhere('ppv.Product.id = ?', $product->getId());
     $ppv = $q->fetchOne();
     if (!$ppv) {
         $ppv = new ParameterProductValue();
         $ppv->setProduct($product);
         $ppv->setParameter($param);
         $ppv->setCommonValue('empty');
         $ppv->save();
     }
     return $ppv;
 }
Example #12
0
 public function setOrder(Product $product)
 {
     $id_product = $product->getId();
     $query = "SELECT * FROM basket WHERE id_product =" . $id_product;
     $res = $this->db->query($query);
     if ($res) {
         $basket = $res->fetchAll();
         $id_order = $basket[count($basket) - 1]['id_order'];
         $query = "SELECT * FROM order WHERE id =" . $id_order . " AND status =" . STATUS_PAID;
         $res = $this->db->query($query);
         if ($res && ($order = $res->fetchObject("Order", array($this->db)))) {
             $this->order = $order;
             $this->id_order = $order->getId();
             return true;
         } else {
             throw new Exception("Only buyers can leave a comment");
         }
     } else {
         throw new Exception("Only buyers can leave a comment");
     }
 }
 /**
  * Adds product into the pool
  *
  * @param Product $product
  * @return void
  */
 public static function pushProduct(Product $product)
 {
     self::$products[$product->getId()] = $product;
 }
Example #14
0
 /**
  * Getting all the preferred locations
  * 
  * @param Product $product
  * @param PreferredLocationType $type
  * @param string $activeOnly
  * @param string $pageNo
  * @param unknown $pageSize
  * @param unknown $orderBy
  * @param unknown $stats
  * @return Ambigous <Ambigous, multitype:, multitype:BaseEntityAbstract >
  */
 public static function getPreferredLocations(Product $product, PreferredLocationType $type = null, $activeOnly = true, $pageNo = null, $pageSize = DaoQuery::DEFAUTL_PAGE_SIZE, $orderBy = array(), &$stats = array())
 {
     $where = array('productId = ? ');
     $params = array($product->getId());
     if ($type instanceof PreferredLocationType) {
         $where[] = 'typeId = ?';
         $params[] = $type->getId();
     }
     return self::getAllByCriteria(implode(' AND ', $where), $params, $activeOnly, $pageNo, $pageSize, $orderBy, $stats);
 }
 /**
  * {@inheritdoc}
  */
 protected function assertPreConditions()
 {
     $this->assertInstanceOf('JLM\\ProductBundle\\Model\\ProductCategoryInterface', $this->entity);
     $this->assertNull($this->entity->getId());
 }
Example #16
0
 /**
  * The row with default value
  *
  * @param UDate   $lastUpdatedInDB
  * @param Product $product
  * @param string  $preFix
  * @param bool    $debug
  *
  * @return multitype:string number
  */
 private static function _getRowWithDefaultValues(UDate $lastUpdatedInDB, Product $product = null, $preFix = '', $debug = false)
 {
     $attributeSetDefault = 'Default';
     $attributeSetName = $attributeSetDefault;
     $enabled = true;
     $sku = $statusId = $productName = $rrpPrice = $weight = $shortDescription = $fullDecription = $supplierName = $supplierCode = $manufacturerName = $asNewFrom = $asNewTo = $specialPrice = $specialPriceFromDate = $specialPriceToDate = '';
     $categoryIds = array(2);
     //default category
     if ($product instanceof Product) {
         $sku = trim($product->getSku());
         $productName = trim($product->getName());
         $shortDescription = trim($product->getShortDescription());
         $asNewFrom = $product->getAsNewFromDate() instanceof UDate ? $product->getAsNewFromDate()->format('Y-m-d H:i:sP') : '';
         $asNewTo = $product->getAsNewToDate() instanceof UDate ? $product->getAsNewToDate()->format('Y-m-d H:i:sP') : '';
         $weight = trim($product->getWeight());
         if ($product->getAttributeSet() instanceof ProductAttributeSet) {
             $attributeSetName = $product->getAttributeSet()->getName();
             self::_log('-- attributeSetName ', __CLASS__ . '::' . __FUNCTION__ . "  attributeSetName={$attributeSetName}", $preFix);
         }
         //RRP
         if (($rrp = $product->getRRP()) instanceof ProductPrice) {
             $rrpPrice = StringUtilsAbstract::getValueFromCurrency($rrp->getPrice());
         }
         //special price
         if (($specialPriceObj = $product->getNearestSpecialPrice()) instanceof ProductPrice) {
             $specialPrice = StringUtilsAbstract::getValueFromCurrency($specialPriceObj->getPrice());
             $specialPriceFromDate = $specialPriceObj->getStart()->format('Y-m-d H:i:sP');
             $specialPriceToDate = $specialPriceObj->getEnd()->format('Y-m-d H:i:sP');
             if ($specialPrice == 0) {
                 $specialPrice = '';
                 $specialPriceFromDate = '1990-10-10';
                 $specialPriceToDate = '2009-10-10';
             }
         } else {
             // delete the special price
             //$specialPrice = StringUtilsAbstract::getValueFromCurrency('99999999');
             //$specialPrice = '9999999';
             $specialPrice = '';
             $specialPriceFromDate = '1990-10-10';
             $specialPriceToDate = '2009-10-10';
         }
         // if it is the daily promotion time then overwrite the special price with the daily special price
         $isDailyPromotionTime = intval(SystemSettings::getSettings(SystemSettings::TYP_ISDAILYPROMOTIONTIME));
         if ($isDailyPromotionTime === 1) {
             // get daily promotion price
             if (($specialPriceObj = $product->getDailySpecialPrice()) instanceof ProductPrice) {
                 $dailySpecialPrice = StringUtilsAbstract::getValueFromCurrency($specialPriceObj->getPrice());
                 if ($dailySpecialPrice != 0) {
                     $specialPrice = $dailySpecialPrice;
                     $specialPriceFromDate = $specialPriceObj->getStart()->format('Y-m-d H:i:sP');
                     $specialPriceToDate = $specialPriceObj->getEnd()->format('Y-m-d H:i:sP');
                 }
             }
         }
         // if it is the daily promotion time then overwrite the special price with the daily special price
         $isWeekendPromotionTime = intval(SystemSettings::getSettings(SystemSettings::TYP_ISWEEKENDPROMOTIONTIME));
         if ($isWeekendPromotionTime === 1) {
             // get weekend promotion price
             if (($specialPriceObj = $product->getWeekendSpecialPrice()) instanceof ProductPrice) {
                 $weekendSpecialPrice = StringUtilsAbstract::getValueFromCurrency($specialPriceObj->getPrice());
                 if ($weekendSpecialPrice != 0) {
                     $specialPrice = $weekendSpecialPrice;
                     $specialPriceFromDate = $specialPriceObj->getStart()->format('Y-m-d H:i:sP');
                     $specialPriceToDate = $specialPriceObj->getEnd()->format('Y-m-d H:i:sP');
                 }
             }
         }
         //full description
         if (($asset = Asset::getAsset($product->getFullDescAssetId())) instanceof Asset) {
             //$fullDecription = '"' . $asset->read() . '"';
             $fullDecription = $asset->read();
         }
         //supplier
         if (count($supplierCodes = SupplierCode::getAllByCriteria('productId = ?', array($product->getId()), true, 1, 1)) > 0) {
             $supplierName = ($supplier = $supplierCodes[0]->getSupplier()) instanceof Supplier ? $supplier->getName() : '';
             $supplierCode = trim($supplierCodes[0]->getCode());
         }
         //Manufacturer
         if ($product->getManufacturer() instanceof Manufacturer) {
             $manufacturerName = trim($product->getManufacturer()->getName());
         }
         //disable or enabled
         if (intval($product->getActive()) === 0 || intval($product->getSellOnWeb()) === 0) {
             $enabled = false;
         } else {
             if ($product->getStatus() instanceof ProductStatus && intval($product->getStatus()->getId()) === ProductStatus::ID_DISABLED) {
                 $enabled = false;
             }
         }
         //categories
         if (count($categories = Product_Category::getAllByCriteria('productId = ?', array($product->getId()))) > 0) {
             foreach ($categories as $category) {
                 if (!$category->getCategory() instanceof ProductCategory || ($mageCateId = trim($category->getCategory()->getMageId())) === '') {
                     continue;
                 }
                 if (trim($attributeSetName) === $attributeSetDefault && ($productAttributeSet = $category->getCategory()->getProductAttributeSet()) instanceof ProductAttributeSet) {
                     $attributeSetName = trim($productAttributeSet->getName());
                 }
                 $categoryIds[] = $mageCateId;
             }
         }
         //ProductStatus
         if ($product->getStatus() instanceof ProductStatus) {
             $statusId = $product->getStatus()->getName();
         }
     }
     $categoryIds = array_unique($categoryIds);
     return array("store" => 'default', "websites" => 'base', "attribute_set" => $attributeSetName, "type" => 'simple', "category_ids" => implode(',', $categoryIds), "sku" => $sku, "name" => $productName, "price" => $rrpPrice, "special_from_date" => $specialPriceFromDate, "special_to_date" => $specialPriceToDate, "special_price" => $specialPrice, "news_from_date" => $asNewFrom, "news_to_date" => $asNewTo, "status" => intval($enabled) === 1 ? 1 : 2, "visibility" => 4, "tax_class_id" => 2, "description" => $fullDecription, "short_description" => $shortDescription, "supplier" => $supplierName, "man_code" => '', "sup_code" => $supplierCode, "meta_title" => '', "meta_description" => '', "manufacturer" => $manufacturerName, "url_key" => '', "url_path" => '', "custom_design" => '', "page_layout" => '', "country_of_manufacture" => '', "msrp_enabled" => '', "msrp_display_actual_price_type" => '', "meta_keyword" => '', "custom_layout_update" => '', "custom_design_from" => '', "custom_design_to" => '', "weight" => $weight, "msrp" => 'Use config', "gift_wrapping_price" => '', "qty" => 99, "min_qty" => 99, "use_config_min_qty" => 99, "is_qty_decimal" => '', "backorders" => '', "use_config_backorders" => '', "min_sale_qty" => '', "use_config_min_sale_qty" => '', "max_sale_qty" => '', "use_config_max_sale_qty" => '', "all_ln_stock" => $statusId, "is_in_stock" => 1, "low_stock_date" => '', "notify_stock_qty" => '', "use_config_notify_stock_qty" => '', "manage_stock" => '', "use_config_manage_stock" => '', "stock_status_changed_auto" => '', "use_config_qty_increments" => '', "qty_increments" => '', "use_config_enable_qty_inc" => '', "enable_qty_increments" => '', "is_decimal_divided" => '', "stock_status_changed_automatically" => '', "use_config_enable_qty_increments" => '', "image" => '', "small_image" => '', "thumbnail" => '', "media_gallery" => '', "is_recurring" => '', "media_gallery_reset" => 0);
 }
Example #17
0
<?php

include_once '/models/product.php';
$productModel = new Product();
$productIdGridArray = $productModel->returnProductGridAsArray();
$productGrid = '';
if ($productIdGridArray) {
    foreach ($productIdGridArray as $productRow) {
        $productGrid .= '<tr>';
        if (count($productRow) > 0) {
            foreach ($productRow as $productId) {
                if ($productId > 0) {
                    $product = new Product($productId);
                    $productGrid .= '<td onclick="addProductToRegister(\'' . $product->getId() . '\')"><a class="product">' . $product->getLabel() . '</a></td>';
                } else {
                    $productGrid .= '<td></td>';
                }
            }
        }
        $productGrid .= '</tr>';
    }
}
include_once '/views/register.php';
Example #18
0
 /**
  * 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 -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param      Product $value A Product object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool(Product $obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         // if key === null
         self::$instances[$key] = $obj;
     }
 }
Example #19
0
 /**
  * Getting the price object via product or type
  *
  * @param Product          $product
  * @param ProductPriceType $type
  * @param string           $startS
  * @param string           $startE
  * @param string           $endS
  * @param string           $endE
  * @param int              $pageNo
  * @param int              $pageSize
  * @param array            $orderBy
  * @throws EntityException
  * @return Ambigous <multitype:, multitype:BaseEntityAbstract >
  */
 public static function getPrices(Product $product = null, ProductPriceType $type = null, $startS = '', $startE = '', $endS = '', $endE = '', $pageNo = null, $pageSize = DaoQuery::DEFAUTL_PAGE_SIZE, $orderBy = array(), &$stats = array())
 {
     $class = __CLASS__;
     if (!$product instanceof Product && !$type instanceof ProductPriceType) {
         throw new EntityException('At least one of them is required for getting the prices: Product or PriceType');
     }
     $where = array('active = 1');
     $params = array();
     if ($product instanceof Product) {
         $where[] = 'productId = ?';
         $params[] = $product->getId();
     }
     if ($type instanceof ProductPriceType) {
         $where[] = 'typeId = ?';
         $params[] = $type->getId();
     }
     if (($startS = trim($startS)) !== '') {
         $where[] = 'start >= ?';
         $params[] = $startS;
     }
     if (($startE = trim($startE)) !== '') {
         $where[] = 'start <= ?';
         $params[] = $startE;
     }
     if (($endS = trim($endS)) !== '') {
         $where[] = 'end >= ?';
         $params[] = $endS;
     }
     if (($endE = trim($endE)) !== '') {
         $where[] = 'end <= ?';
         $params[] = $endE;
     }
     return self::getAllByCriteria(implode(' AND ', $where), $params, true, $pageNo, $pageSize, $orderBy, $stats);
 }
 /**
  * @param ProductCategory $category
  * @param Product $currentItem
  * @param int $max
  */
 public function getRelatedList($category, $currentItem, $max = 6)
 {
     $query = $this->getRepository()->createQueryBuilder('p')->where('p.isActive = :isActive')->andWhere('p.category = :category')->andWhere('p.id != :id')->setParameter('isActive', true)->setParameter('category', $category)->setParameter('id', $currentItem->getId())->orderBy('p.createdAt', 'DESC')->getQuery()->setMaxResults($max);
     return $query->getResult();
 }
 /**
  * Exclude object from result
  *
  * @param   Product $product Object to remove from the list of results
  *
  * @return ProductQuery The current query, for fluid interface
  */
 public function prune($product = null)
 {
     if ($product) {
         $this->addUsingAlias(ProductPeer::ID, $product->getId(), Criteria::NOT_EQUAL);
     }
     return $this;
 }
 private static function _getProductQtyLogs(Product $product, $pageNumber, $pageSize = self::PAGE_SIZE)
 {
     return ProductQtyLog::getAllByCriteria('pql.active = 1 and pql.productId = ? and pql.stockOnHandVar > 0 and pql.type in (?, ?, ?)', array($product->getId(), ProductQtyLog::TYPE_PO, ProductQtyLog::TYPE_STOCK_MOVE_INTERNAL, ProductQtyLog::TYPE_STOCK_ADJ), true, $pageNumber, $pageSize, array('id' => 'desc'));
 }
 /**
  * Declares an association between this object and a Product object.
  *
  * @param      Product $v
  * @return     ProductI18n The current object (for fluent API support)
  * @throws     PropelException
  */
 public function setProduct(Product $v = null)
 {
     if ($v === null) {
         $this->setId(NULL);
     } else {
         $this->setId($v->getId());
     }
     $this->aProduct = $v;
     // Add binding for other direction of this n:n relationship.
     // If this object has already been added to the Product object, it will not be re-added.
     if ($v !== null) {
         $v->addTranslation($this);
     }
     return $this;
 }
Example #24
0
 public function setProduct(Product $v = null)
 {
     if ($v === null) {
         $this->setId(NULL);
     } else {
         $this->setId($v->getId());
     }
     $this->aProduct = $v;
     if ($v !== null) {
         $v->addProductI18n($this);
     }
     return $this;
 }
Example #25
0
 public function addProduct(Product $product)
 {
     $sql = "INSERT INTO cart (product_id) VALUES (" . $product->getId() . ")";
     return $this->exec($sql);
 }
 public static function getByProduct(Product $product, $activeOnly = true)
 {
     $rules = self::getAllByCriteria('productId = ?', array($product->getId()), $activeOnly, 1, 1, array('id' => 'desc'));
     if (count($rules) > 0) {
         return $rules[0];
     } else {
         return null;
     }
 }
Example #27
0
 /**
  * Update product code
  *
  * @param Product $product
  * @param unknown $myobCode
  * @param ProductCodeType $productCodeType
  * @param string $assetAccNo
  * @param string $revenueAccNo
  * @param string $costAccNo
  *
  * @return Product
  */
 private function updateProductCode(Product $product, $myobCode, ProductCodeType $productCodeType, $assetAccNo = '', $revenueAccNo = '', $costAccNo = '')
 {
     try {
         Dao::beginTransaction();
         // only take the myobCode (myob item#) after the first dash
         $position = strpos($myobCode, '-');
         if ($position) {
             $myobCodeAfter = substr($myobCode, $position + 1);
             // get everything after first dash
             $myobCodeAfter = str_replace(' ', '', $myobCodeAfter);
             // remove all whitespace
         } else {
             $myobCodeAfter = $myobCode;
         }
         $result = array();
         $result['product'] = $product->getJson();
         $result['code'] = $myobCodeAfter;
         $result['MYOBcode'] = $myobCode;
         $result['assetAccNo'] = $assetAccNo;
         $result['revenueAccNo'] = $revenueAccNo;
         $result['costAccNo'] = $costAccNo;
         // if such code type for such product exist, update it to the new one
         if (!empty($myobCode)) {
             if (count($productCodes = ProductCode::getAllByCriteria('pro_code.typeId = ? and pro_code.productId = ?', array($productCodeType->getId(), $product->getId()), true, 1, 1)) > 0) {
                 $productCodes[0]->setCode($myobCodeAfter)->save();
                 $result['codeNew'] = false;
             } else {
                 $newCode = ProductCode::create($product, $productCodeType, trim($myobCodeAfter));
                 $result['codeNew'] = true;
             }
         }
         // do the same for MYOB code (NOTE: have to have MYOB code in code type !!!)
         if (!empty($myobCode)) {
             if (count($productCodes = ProductCode::getAllByCriteria('pro_code.typeId = ? and pro_code.productId = ?', array(ProductCodeType::ID_MYOB, $product->getId()), true, 1, 1)) > 0) {
                 $productCodes[0]->setCode($myobCode)->save();
                 $result['MYOBcodeNew'] = false;
             } else {
                 ProductCode::create($product, ProductCodeType::get(ProductCodeType::ID_MYOB), trim($myobCode));
                 $result['MYOBcodeNew'] = true;
             }
         }
         if (!empty($assetAccNo)) {
             $product->setAssetAccNo($assetAccNo)->save();
         }
         if (!empty($revenueAccNo)) {
             $product->setRevenueAccNo($revenueAccNo)->save();
         }
         if (!empty($costAccNo)) {
             $product->setCostAccNo($costAccNo)->save();
         }
         Dao::commitTransaction();
         return $product;
     } catch (Exception $e) {
         Dao::rollbackTransaction();
         echo $e;
         exit;
     }
 }
Example #28
0
 public function findByProduct(Product $product)
 {
     $q = $this->createQuery('s')->leftJoin('s.Iteration i')->leftJoin('i.Project p')->where('p.product_id = ?', $product->getId());
     return $q->execute();
 }
 /**
  * Filter the query by a related Product object
  *
  * @param   Product|PropelObjectCollection $product The related object(s) to use as filter
  * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return                 OrganizationProductQuery The current query, for fluid interface
  * @throws PropelException - if the provided filter is invalid.
  */
 public function filterByProduct($product, $comparison = null)
 {
     if ($product instanceof Product) {
         return $this->addUsingAlias(OrganizationProductPeer::PRODUCT_ID, $product->getId(), $comparison);
     } elseif ($product instanceof PropelObjectCollection) {
         if (null === $comparison) {
             $comparison = Criteria::IN;
         }
         return $this->addUsingAlias(OrganizationProductPeer::PRODUCT_ID, $product->toKeyValue('PrimaryKey', 'Id'), $comparison);
     } else {
         throw new PropelException('filterByProduct() only accepts arguments of type Product or PropelCollection');
     }
 }
Example #30
0
 /**
  * removing the relationship
  * 
  * @param Product         $product
  * @param ProductCategory $category
  */
 public static function remove(Product $product, ProductCategory $category)
 {
     self::deleteByCriteria('productId = ? and categoryId = ?', array($product->getId(), $category->getId()));
 }