12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- <?php
- /**
- * Subclass for performing query and update operations on the 'katao_cart_product' table.
- *
- * @package lib.model
- */
- class KataoCartProductPeer extends BaseKataoCartProductPeer {
- /**
- * KataoCartProductPeer::retrieveByCartAndProduct()
- *
- * @param integer $katao_cart_id
- * @param integer $katao_product_id
- * @return KataoCartProduct
- */
- public static function retrieveByCartAndProduct($katao_cart_id, $katao_product_id) {
- $criteria = new Criteria();
- $criteria->add(self::KATAO_CART_ID, $katao_cart_id);
- $criteria->add(self::KATAO_PRODUCT_ID, $katao_product_id);
- if (null == $return = self::doSelectOne($criteria)) {
- $return = new KataoCartProduct();
- $return->setKataoCartId($katao_cart_id);
- $return->setKataoProductId($katao_product_id);
- $return->save();
- }
- return $return;
- }
- /**
- * KataoCartProductPeer::deleteByCartAndProduct()
- *
- * @param integer $katao_cart_id
- * @param integer $katao_product_id
- * @return boolean
- */
- public static function deleteByCartAndProduct($katao_cart_id, $katao_product_id) {
- $criteria = new Criteria();
- $criteria->add(self::KATAO_CART_ID, $katao_cart_id);
- $criteria->add(self::KATAO_PRODUCT_ID, $katao_product_id);
- return self::doDelete($criteria);
- }
- /**
- * KataoCartProductPeer::n()
- *
- * @param int $id
- * @param float $quantity
- * @return
- */
- public static function adjustQuantity($id, $quantity) {
- $criteria_update = new Criteria();
- $criteria_update->add(self::QUANTITY_ADJUSTED, $quantity);
- // $criteria_update->add(self::HAS_BEEN_ADJUSTED, true);
- $criteria_where = new Criteria();
- $criteria_where->add(self::ID, $id);
- BasePeer::doUpdate($criteria_where, $criteria_update, Propel::getConnection());
- }
- /**
- * KataoCartProductPeer::deliverQuantity()
- *
- * @param int $id
- * @param float $quantity
- * @return
- */
- public static function deliverQuantity($id, $quantity) {
- $criteria_update = new Criteria();
- $criteria_update->add(self::QUANTITY_DELIVERED, $quantity);
- $criteria_where = new Criteria();
- $criteria_where->add(self::ID, $id);
- BasePeer::doUpdate($criteria_where, $criteria_update, Propel::getConnection());
- }
- }
|