当前位置: 首页>>代码示例>>PHP>>正文


PHP Product::getId方法代码示例

本文整理汇总了PHP中Product::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP Product::getId方法的具体用法?PHP Product::getId怎么用?PHP Product::getId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Product的用法示例。


在下文中一共展示了Product::getId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: addProduct

 /**
  * 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>";
 }
开发者ID:kubu1518,项目名称:rftCandyShop,代码行数:18,代码来源:Cart.class.php

示例2: transform

 /**
  * 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();
 }
开发者ID:jlm-entreprise,项目名称:product-bundle,代码行数:13,代码来源:ProductToIntTransformer.php

示例3: compute

 function compute(Product $product)
 {
     $discountProvider = DiscountProvider::getInstance();
     $discountAsPercent = $discountProvider->getDiscountFor($product->getId());
     $price = $product->getPrice();
     $discountAsValue = $price * $discountAsPercent / 100;
     return $price - $discountAsValue;
 }
开发者ID:anggadarkprince,项目名称:design-pattern,代码行数:8,代码来源:PriceCalculator.php

示例4: test_initialization

 public function test_initialization()
 {
     $product = new Product();
     $this->assertEqual($product->getId(), 0);
     $this->assertEqual($product->getName(), '');
     $this->assertEqual($product->getCreated(), '');
     $this->assertEqual($product->getUpdated(), '');
 }
开发者ID:joefallon,项目名称:DoctrineAndPhinxSpike,代码行数:8,代码来源:ProductTests.php

示例5: editProduct

 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;
 }
开发者ID:RosenKrumov,项目名称:Online-Shop-Personal-Project,代码行数:8,代码来源:DbAppManipulation.php

示例6: getId

 public function getId()
 {
     if ($this->__isInitialized__ === false) {
         return (int) $this->_identifier["id"];
     }
     $this->__load();
     return parent::getId();
 }
开发者ID:hmg-suman,项目名称:zf2-doctrine2-getting-started,代码行数:8,代码来源:__CG__Product.php

示例7: ensureConsistency

 /**
  * 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;
     }
 }
开发者ID:Mertiozys,项目名称:GoogleShopping,代码行数:22,代码来源:GoogleshoppingProductSynchronisation.php

示例8: loadImgbyProduct

 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'];
     }
 }
开发者ID:TomaszKawalkowski,项目名称:shop,代码行数:9,代码来源:image.php

示例9: ensureConsistency

 /**
  * 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;
     }
 }
开发者ID:bcbrr,项目名称:LegacyProductAttributes,代码行数:22,代码来源:LegacyProductAttributeValue.php

示例10: create

 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;
 }
开发者ID:benjamincargnino,项目名称:ecommerce,代码行数:10,代码来源:CartProduct.class.php

示例11: getObjectForProductAndParameter

 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;
 }
开发者ID:vcgato29,项目名称:poff,代码行数:13,代码来源:ParameterProductValueTable.class.php

示例12: setOrder

 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");
     }
 }
开发者ID:berserkr1,项目名称:e-commerce,代码行数:21,代码来源:Message.class.php

示例13: pushProduct

 /**
  * Adds product into the pool
  *
  * @param Product $product
  * @return void
  */
 public static function pushProduct(Product $product)
 {
     self::$products[$product->getId()] = $product;
 }
开发者ID:Bazitron,项目名称:php-design-patterns,代码行数:10,代码来源:example-1.php

示例14: getPreferredLocations

 /**
  * 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);
 }
开发者ID:larryu,项目名称:magento-b2b,代码行数:22,代码来源:PreferredLocation.php

示例15: assertPreConditions

 /**
  * {@inheritdoc}
  */
 protected function assertPreConditions()
 {
     $this->assertInstanceOf('JLM\\ProductBundle\\Model\\ProductCategoryInterface', $this->entity);
     $this->assertNull($this->entity->getId());
 }
开发者ID:jlm-entreprise,项目名称:product-bundle,代码行数:8,代码来源:ProductCategoryTest.php


注:本文中的Product::getId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。