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


PHP ObjectModel::hydrateCollection方法代码示例

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


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

示例1: getByOrderReference

    /**
     * Get the detailed payment of an order
     * @param int $order_reference
     * @return array
     * @since 1.5.0.13
     */
    public static function getByOrderReference($order_reference)
    {
        return ObjectModel::hydrateCollection('OrderPayment', Db::getInstance()->executeS('
			SELECT *
			FROM `' . _DB_PREFIX_ . 'order_payment`
			WHERE `order_reference` = \'' . pSQL($order_reference) . '\''));
    }
开发者ID:ortegon000,项目名称:tienda,代码行数:13,代码来源:OrderPayment.php

示例2: findAll

 public static function findAll()
 {
     $sql = 'select * from ' . _DB_PREFIX_ . 'prestaebooks where ebook_active = 1 order by id_prestaebooks ASC';
     if ($rows = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql)) {
         return ObjectModel::hydrateCollection(__CLASS__, $rows);
     }
     return array();
 }
开发者ID:simon6023,项目名称:ebookseller,代码行数:8,代码来源:PrestaEbooksCore.php

示例3: getByOrder

    public static function getByOrder($id_order)
    {
        $order_invoice_list = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
			SELECT oi.*
			FROM `' . _DB_PREFIX_ . 'order_invoice` oi
			LEFT JOIN `' . _DB_PREFIX_ . 'orders` o ON (o.`id_order` = oi.`id_order`)
			WHERE o.id_order = ' . intval($id_order) . '
		');
        return ObjectModel::hydrateCollection('OrderInvoice', $order_invoice_list);
    }
开发者ID:prestamodule,项目名称:erpillicopresta,代码行数:10,代码来源:ErpOrderInvoice.php

示例4: comments

 /**
  * Retrieve my comments
  * @param array $params filters (column)
  * @return array
  * @throws Exception
  */
 public function comments($params = array())
 {
     $query = new DbQuery();
     $query->select('*')->from('comment')->where('id_user = ' . (int) $this->id)->orderBy('date_add DESC');
     if (isset($params['username'])) {
         $query->where('username = "' . pSQL($params['username']) . '"');
     }
     $results = Db::getInstance()->ExecuteS($query);
     if (!Validate::isNonEmptyArray($results)) {
         return array();
     }
     return ObjectModel::hydrateCollection('Comment', $results);
 }
开发者ID:jessylenne,项目名称:sf2-technical-test,代码行数:19,代码来源:User.php

示例5: getResponseByQuestion

 public static function getResponseByQuestion($id_question)
 {
     $query = new DbQuery();
     $query->from('lgconsultas_respuestas');
     $query->where('id_consulta = ' . (int) $id_question);
     $row = DB::getInstance()->executeS($query);
     if ($row) {
         $rows = ObjectModel::hydrateCollection('LGRespuesta', $row);
         $object = array_pop($rows);
     } else {
         $object = new LGRespuesta();
         $object->id_consulta = (int) $id_question;
         $object->id_employee = (int) 0;
         $object->respuesta = '';
         $object->date_add = '';
     }
     return $object;
 }
开发者ID:acreno,项目名称:pm-ps,代码行数:18,代码来源:LGRespuesta.php

示例6: getByDeliveryDateInterval

    /**
     * @since 1.5.0.3
     * @param $date_from
     * @param $date_to
     * @return array collection of invoice
     */
    public static function getByDeliveryDateInterval($date_from, $date_to)
    {
        $order_invoice_list = Db::getInstance()->executeS('
			SELECT oi.*
			FROM `' . _DB_PREFIX_ . 'order_invoice` oi
			LEFT JOIN `' . _DB_PREFIX_ . 'orders` o ON (o.`id_order` = oi.`id_order`)
			WHERE DATE_ADD(oi.delivery_date, INTERVAL -1 DAY) <= \'' . pSQL($date_to) . '\'
			AND oi.delivery_date >= \'' . pSQL($date_from) . '\'
			' . Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o') . '
			ORDER BY oi.delivery_date ASC
		');
        return ObjectModel::hydrateCollection('OrderInvoice', $order_invoice_list);
    }
开发者ID:jpodracky,项目名称:dogs,代码行数:19,代码来源:OrderInvoice.php

示例7: autoAddToCart

    /**
     * @static
     * @param Context|null $context
     * @return mixed
     */
    public static function autoAddToCart(Context $context = null)
    {
        if ($context === null) {
            $context = Context::getContext();
        }
        if (!CartRule::isFeatureActive() || !Validate::isLoadedObject($context->cart)) {
            return;
        }
        $sql = '
		SELECT cr.*
		FROM ' . _DB_PREFIX_ . 'cart_rule cr
		LEFT JOIN ' . _DB_PREFIX_ . 'cart_rule_shop crs ON cr.id_cart_rule = crs.id_cart_rule
		LEFT JOIN ' . _DB_PREFIX_ . 'cart_rule_carrier crca ON cr.id_cart_rule = crca.id_cart_rule
		' . ($context->cart->id_carrier ? 'LEFT JOIN ' . _DB_PREFIX_ . 'carrier c ON (c.id_reference = crca.id_carrier AND c.deleted = 0)' : '') . '		
		LEFT JOIN ' . _DB_PREFIX_ . 'cart_rule_country crco ON cr.id_cart_rule = crco.id_cart_rule
		WHERE cr.active = 1
		AND cr.code = ""
		AND cr.quantity > 0
		AND cr.date_from < "' . date('Y-m-d H:i:s') . '"
		AND cr.date_to > "' . date('Y-m-d H:i:s') . '"
		AND (
			cr.id_customer = 0
			' . ($context->customer->id ? 'OR cr.id_customer = ' . (int) $context->cart->id_customer : '') . '
		)
		AND (
			cr.`carrier_restriction` = 0
			' . ($context->cart->id_carrier ? 'OR c.id_carrier = ' . (int) $context->cart->id_carrier : '') . '
		)
		AND (
			cr.`shop_restriction` = 0
			' . (Shop::isFeatureActive() && $context->shop->id ? 'OR crs.id_shop = ' . (int) $context->shop->id : '') . '
		)
		AND (
			cr.`group_restriction` = 0
			' . ($context->customer->id ? 'OR 0 < (
				SELECT cg.`id_group`
				FROM `' . _DB_PREFIX_ . 'customer_group` cg
				INNER JOIN `' . _DB_PREFIX_ . 'cart_rule_group` crg ON cg.id_group = crg.id_group
				WHERE cr.`id_cart_rule` = crg.`id_cart_rule`
				AND cg.`id_customer` = ' . (int) $context->customer->id . '
				LIMIT 1
			)' : '') . '
		)
		AND (
			cr.`reduction_product` <= 0
			OR cr.`reduction_product` IN (
				SELECT `id_product`
				FROM `' . _DB_PREFIX_ . 'cart_product`
				WHERE `id_cart` = ' . (int) $context->cart->id . '
			)
		)
		AND cr.id_cart_rule NOT IN (SELECT id_cart_rule FROM ' . _DB_PREFIX_ . 'cart_cart_rule WHERE id_cart = ' . (int) $context->cart->id . ')
		ORDER BY priority';
        $result = Db::getInstance()->executeS($sql);
        if ($result) {
            $cart_rules = ObjectModel::hydrateCollection('CartRule', $result);
            if ($cart_rules) {
                foreach ($cart_rules as $cart_rule) {
                    if ($cart_rule->checkValidity($context, false, false)) {
                        $context->cart->addCartRule($cart_rule->id);
                    }
                }
            }
        }
    }
开发者ID:dev-lav,项目名称:htdocs,代码行数:70,代码来源:CartRule.php

示例8: getAll

 /**
  * Launch sql query to create collection of objects
  *
  * @param bool $display_query If true, query will be displayed (for debug purpose)
  * @return Collection
  */
 public function getAll($display_query = false)
 {
     if ($this->is_hydrated) {
         return $this;
     }
     $this->is_hydrated = true;
     $alias = $this->generateAlias();
     //$this->query->select($alias.'.*');
     $this->query->from($this->definition['table'], $alias);
     // If multilang, create association to lang table
     if (!empty($this->definition['multilang'])) {
         $this->join(self::LANG_ALIAS);
         if ($this->id_lang) {
             $this->where(self::LANG_ALIAS . '.id_lang', '=', $this->id_lang);
         }
     }
     // Add join clause
     foreach ($this->join_list as $data) {
         $on = '(' . implode(') AND (', $data['on']) . ')';
         switch ($data['type']) {
             case self::LEFT_JOIN:
                 $this->query->leftJoin($data['table'], $data['alias'], $on);
                 break;
             case self::INNER_JOIN:
                 $this->query->innerJoin($data['table'], $data['alias'], $on);
                 break;
             case self::LEFT_OUTER_JOIN:
                 $this->query->leftOuterJoin($data['table'], $data['alias'], $on);
                 break;
         }
     }
     // Shall we display query for debug ?
     if ($display_query) {
         echo $this->query . '<br />';
     }
     $this->results = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($this->query);
     $this->results = ObjectModel::hydrateCollection($this->classname, $this->results, $this->id_lang);
     return $this;
 }
开发者ID:jicheng17,项目名称:pengwine,代码行数:45,代码来源:Collection.php

示例9: autoAddToCart

 /**
  * @static
  * @param JeproshopContext|null $context
  * @return mixed
  */
 public static function autoAddToCart(JeproshopContext $context = null)
 {
     if ($context === null) {
         $context = JeproshopContext::getContext();
     }
     if (!JeproshopCartRuleModelCartRule::isFeaturePublished() || !JeproshopValidator::isLoadedObject($context->cart, 'cart_id')) {
         return;
     }
     $db = JFactory::getDBO();
     $query = "SELECT cart_rule.* FROM " . $db->quoteName('#__jeproshop_cart_rule') . " AS cart_rule LEFT JOIN " . $db->quoteName('#__jeproshop_cart_rule_shop');
     $query .= " AS cart_rule_shop ON cart_rule.cart_rule_id = cart_rule_shop.cart_rule_id ";
     $group_query = " LEFT JOIN " . $db->quoteName('#__jeproshop_cart_rule_group') . " AS cart_rule_group ON cart_rule.cart_rule_id = cart_rule_group.cart_rule_id ";
     $query .= (!$context->customer->customer_id && JeproshopGroupModelGroup::isFeaturePublished() ? $group_query : "") . " LEFT JOIN ";
     $query .= $db->quoteName('#__jeproshop_cart_rule_carrier') . " AS cart_rule_carrier ON cart_rule.cart_rule_id = cart_rule_carrier.cart_rule_id ";
     $query .= $context->cart->carrier_id ? " LEFT JOIN " . $db->quoteName('#__jeproshop_carrier') . " AS carrier ON (carrier.reference_id = cart_rule_carrier.carrier_id AND carrier.deleted = 0)" : "";
     $query .= " LEFT JOIN " . $db->quoteName('#__jeproshop_cart_rule_country') . " AS cart_rule_country ON cart_rule.cart_rule_id = cart_rule_country.";
     $query .= "cart_rule_id WHERE cart_rule.published = 1 AND cart_rule.code = '' AND cart_rule.quantity > 0 AND cart_rule.date_from < '" . date('Y-m-d H:i:s') . "'\tAND cart_rule.date_to > '";
     $query .= date('Y-m-d H:i:s') . "' AND ( cart_rule.customer_id = 0 " . ($context->customer->customer_id ? " OR cart_rule.customer_id = " . (int) $context->cart->customer_id : "");
     $query .= ") AND ( cart_rule." . $db->quoteName('carrier_restriction') . " = 0 " . ($context->cart->carrier_id ? " OR carrier.carrier_id = " . (int) $context->cart->carrier_id : "");
     $query .= " ) AND ( cart_rule." . $db->quoteName('shop_restriction') . " = 0 " . (JeproshopShopModelShop::isFeaturePublished() && $context->shop->shop_id ? " OR cart_rule_shop.shop_id = " . (int) $context->shop->shop_id : "");
     $query .= " ) AND ( cart_rule." . $db->quoteName('group_restriction') . " = 0 ";
     if ($context->customer->customer_id) {
         $query = " OR 0 < ( SELECT customer_group." . $db->quoteName('group_id') . " FROM " . $db->quoteName('#__jeproshop_customer_group') . " AS customer_group INNER JOIN " . $db->quoteName('#__jeproshop_cart_rule_group');
         $query .= " AS cart_rule_group ON customer_group.group_id = cart_rule_group.group_id WHERE cart_rule." . $db->quoteName('cart_rule_id') . " = cart_rule_group." . $db->quoteName('cart_rule_id') . " AND customer_group.";
         $query .= $db->quoteName('customer_id') . " = " . (int) $context->customer->customer_id . " LIMIT 1\t)";
     } else {
         if (JeproshopGroupModelGroup::isFeaturePublished()) {
             $query .= " OR cart_rule_group." . $db->quoteName('group_id') . " = " . (int) JeproshopSettingModelSetting::getValue('unidentified_group');
         }
     }
     $query .= " ) AND ( cart_rule." . $db->quoteName('`reduction_product') . " <= 0 OR cart_rule." . $db->quoteName('reduction_product') . " IN ( SELECT " . $db->quoteName('product_id') . " FROM ";
     $query .= $db->quoteName('#__jeproshop_cart_product') . " WHERE " . $db->quoteName('cart_id') . " = " . (int) $context->cart->cart_id . " ) ) AND cart_rule.cart_rule_id NOT IN (SELECT cart_rule_id FROM ";
     $query .= $db->quoteName('#__jeproshop_cart_cart_rule') . " WHERE car_id = " . (int) $context->cart->cart_id . ") ORDER BY priority";
     $db->setQuery($query);
     $result = $db->loadObjectList();
     if ($result) {
         $cart_rules = ObjectModel::hydrateCollection('CartRule', $result);
         if ($cart_rules) {
             foreach ($cart_rules as $cart_rule) {
                 if ($cart_rule->checkValidity($context, false, false)) {
                     $context->cart->addCartRule($cart_rule->cart_rule_id);
                 }
             }
         }
     }
 }
开发者ID:jeprodev,项目名称:jeproshop,代码行数:51,代码来源:cart.php

示例10: getByNumberInterval

 private function getByNumberInterval($number_from, $number_to)
 {
     //this function is not there in OrderInvoice class, so I implemented by my own
     $order_invoice_list = Db::getInstance()->executeS('
         SELECT oi.*
         FROM `' . _DB_PREFIX_ . 'order_invoice` oi
         LEFT JOIN `' . _DB_PREFIX_ . 'orders` o ON (o.`id_order` = oi.`id_order`)
         WHERE oi.id_order <= \'' . pSQL($number_to) . '\'
         AND oi.id_order >= \'' . pSQL($number_from) . '\'
         ' . Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o') . '
         ORDER BY oi.date_add ASC
     ');
     return ObjectModel::hydrateCollection('OrderInvoice', $order_invoice_list);
 }
开发者ID:rrd108,项目名称:prestashop-module-dpdhuexport,代码行数:14,代码来源:AdminDpdHuExportController.php

示例11: getSupplyOrderCollection

    /**
     * @static
     * @param $id_supply_order array
     * @return array collection of OrderInvoice
     */
    public static function getSupplyOrderCollection($id_supply_order)
    {
        if (!empty($id_supply_order)) {
            $supply_order_list = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
			SELECT so.*
			FROM `' . _DB_PREFIX_ . 'supply_order` so
			WHERE so.id_supply_order = ' . (int) $id_supply_order . '
			ORDER BY so.`id_supply_order` DESC');
            return ObjectModel::hydrateCollection('SupplyOrder', $supply_order_list);
        }
    }
开发者ID:prestamodule,项目名称:erpillicopresta,代码行数:16,代码来源:ErpSupplyOrderClasses.php

示例12: autoAddToCart

    /**
     * @static
     * @param Context|null $context
     * @return mixed
     */
    public static function autoAddToCart(Context $context = null)
    {
        if ($context === null) {
            $context = Context::getContext();
        }
        if (!CartRule::isFeatureActive() || !Validate::isLoadedObject($context->cart)) {
            return;
        }
        $result = Db::getInstance()->executeS('
		SELECT cr.*
		FROM ' . _DB_PREFIX_ . 'cart_rule cr
		LEFT JOIN ' . _DB_PREFIX_ . 'cart_rule_shop crs ON cr.id_cart_rule = crs.id_cart_rule
		LEFT JOIN ' . _DB_PREFIX_ . 'cart_rule_carrier crca ON cr.id_cart_rule = crca.id_cart_rule
		LEFT JOIN ' . _DB_PREFIX_ . 'cart_rule_country crco ON cr.id_cart_rule = crco.id_cart_rule
		WHERE cr.active = 1
		AND cr.code = ""
		AND cr.quantity > 0
		AND cr.date_from < "' . date('Y-m-d H:i:s') . '"
		AND cr.date_to > "' . date('Y-m-d H:i:s') . '"
		AND (
			cr.id_customer = 0
			' . ($context->customer->id ? 'OR cr.id_customer = ' . (int) $context->cart->id_customer : '') . '
		)
		AND (
			cr.carrier_restriction = 0
			' . ($context->cart->id_carrier ? 'OR crca.id_carrier = ' . (int) $context->cart->id_carrier : '') . '
		)
		AND (
			cr.shop_restriction = 0
			' . (Shop::isFeatureActive() && $context->shop->id ? 'OR crs.id_shop = ' . (int) $context->shop->id : '') . '
		)
		AND (
			cr.group_restriction = 0
			' . ($context->customer->id ? 'OR 0 < (
				SELECT cg.id_group
				FROM ' . _DB_PREFIX_ . 'customer_group cg
				LEFT JOIN ' . _DB_PREFIX_ . 'cart_rule_group crg ON cg.id_group = crg.id_group
				WHERE cr.id_cart_rule = crg.id_cart_rule
				AND cg.id_customer = ' . (int) $context->customer->id . '
			)' : '') . '
		)
		AND (
			cr.reduction_product <= 0
			OR cr.reduction_product IN (
				SELECT id_product
				FROM ' . _DB_PREFIX_ . 'cart_product
				WHERE id_cart = ' . (int) $context->cart->id . '
			)
		)
		AND cr.id_cart_rule NOT IN (SELECT id_cart_rule	FROM ' . _DB_PREFIX_ . 'cart_cart_rule WHERE id_cart = ' . (int) $context->cart->id . ')
		ORDER BY priority');
        $cartRules = ObjectModel::hydrateCollection('CartRule', $result);
        foreach ($cartRules as $cartRule) {
            if ($cartRule->checkValidity($context, false, false)) {
                $context->cart->addCartRule($cartRule->id);
            }
        }
    }
开发者ID:jicheng17,项目名称:vipinsg,代码行数:63,代码来源:CartRule.php


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