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


PHP Pimcore\Resource类代码示例

本文整理汇总了PHP中Pimcore\Resource的典型用法代码示例。如果您正苦于以下问题:PHP Resource类的具体用法?PHP Resource怎么用?PHP Resource使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: indexAction

 public function indexAction()
 {
     $this->enableLayout();
     // get a list of news objects and order them by date
     $blogList = new Object\BlogArticle\Listing();
     $blogList->setOrderKey("date");
     $blogList->setOrder("DESC");
     $conditions = [];
     if ($this->getParam("category")) {
         $conditions[] = "categories LIKE " . $blogList->quote("%," . (int) $this->getParam("category") . ",%");
     }
     if ($this->getParam("archive")) {
         $conditions[] = "DATE_FORMAT(FROM_UNIXTIME(date), '%Y-%c') = " . $blogList->quote($this->getParam("archive"));
     }
     if (!empty($conditions)) {
         $blogList->setCondition(implode(" AND ", $conditions));
     }
     $paginator = \Zend_Paginator::factory($blogList);
     $paginator->setCurrentPageNumber($this->getParam('page'));
     $paginator->setItemCountPerPage(5);
     $this->view->articles = $paginator;
     // get all categories
     $categories = Object\BlogCategory::getList();
     // this is an alternative way to get an object list
     $this->view->categories = $categories;
     // archive information, we have to do this in pure SQL
     $db = \Pimcore\Resource::get();
     $ranges = $db->fetchCol("SELECT DATE_FORMAT(FROM_UNIXTIME(date), '%Y-%c') as ranges FROM object_5 GROUP BY DATE_FORMAT(FROM_UNIXTIME(date), '%b-%Y') ORDER BY ranges ASC");
     $this->view->archiveRanges = $ranges;
 }
开发者ID:rolandstoll,项目名称:pimcore,代码行数:30,代码来源:BlogController.php

示例2: __construct

 /**
  * @param $classId
  * @param null $idField
  * @param null $storetable
  * @param null $querytable
  * @param null $relationtable
  */
 public function __construct($classId, $idField = null, $storetable = null, $querytable = null, $relationtable = null)
 {
     $this->db = \Pimcore\Resource::get();
     $this->fields = array();
     $this->relations = array();
     $this->fieldIds = array();
     $this->deletionFieldIds = array();
     $this->fieldDefinitions = [];
     if ($storetable == null) {
         $this->storetable = self::STORE_TABLE . $classId;
     } else {
         $this->storetable = $storetable;
     }
     if ($querytable == null) {
         $this->querytable = self::QUERY_TABLE . $classId;
     } else {
         $this->querytable = $querytable;
     }
     if ($relationtable == null) {
         $this->relationtable = self::RELATION_TABLE . $classId;
     } else {
         $this->relationtable = $relationtable;
     }
     if ($idField == null) {
         $this->idField = self::ID_FIELD;
     } else {
         $this->idField = $idField;
     }
 }
开发者ID:yonetici,项目名称:pimcore-coreshop-demo,代码行数:36,代码来源:InheritanceHelper.php

示例3: httpErrorLogCleanup

 /**
  *
  */
 public function httpErrorLogCleanup()
 {
     // keep the history for max. 7 days (=> exactly 144h), according to the privacy policy (EU/German Law)
     // it's allowed to store the IP for 7 days for security reasons (DoS, ...)
     $limit = time() - 6 * 86400;
     $db = \Pimcore\Resource::get();
     $db->delete("http_error_log", "date < " . $limit);
 }
开发者ID:pawansgi92,项目名称:pimcore2,代码行数:11,代码来源:Maintenance.php

示例4: executeSQL

 public function executeSQL($fileName)
 {
     $db = \Pimcore\Resource::get();
     $file = PIMCORE_PLUGINS_PATH . "/CoreShop/install/sql/{$fileName}.sql";
     $sql = file_get_contents($file);
     $mysqli = $db->getConnection();
     return $mysqli->multi_query($sql);
 }
开发者ID:Cube-Solutions,项目名称:pimcore-coreshop,代码行数:8,代码来源:Install.php

示例5: __construct

 public function __construct(OnlineShop_Framework_IndexService_Tenant_IConfig $tenantConfig)
 {
     $this->name = $tenantConfig->getTenantName();
     $this->tenantConfig = $tenantConfig;
     $this->columnConfig = $tenantConfig->getAttributeConfig();
     $this->searchColumnConfig = $tenantConfig->getSearchAttributeConfig();
     $this->db = \Pimcore\Resource::get();
 }
开发者ID:ascertain,项目名称:NGshop,代码行数:8,代码来源:Abstract.php

示例6: register

 /**
  * Use the register method to register items with the container via the
  * protected $this->container property or the `getContainer` method
  * from the ContainerAwareTrait.
  *
  * @return void
  */
 public function register()
 {
     $container = $this->getContainer();
     $container->singleton(self::SERVICE_DB, function () {
         /** @var \Pimcore\Resource\Wrapper $resource */
         $resource = Resource::get();
         return $resource->getResource();
     });
 }
开发者ID:Cube-Solutions,项目名称:pimcore-migrations,代码行数:16,代码来源:PimcoreProvider.php

示例7: getDb

 /**
  * @return \Zend_Db_Adapter_Abstract
  */
 protected function getDb()
 {
     if (!$this->db) {
         // we're using a new mysql connection here to avoid problems with active (nested) transactions
         \Logger::debug("Initialize dedicated MySQL connection for the cache adapter");
         $this->db = Resource::getConnection();
     }
     return $this->db;
 }
开发者ID:Gerhard13,项目名称:pimcore,代码行数:12,代码来源:Memcached.php

示例8: getExistingLengths

 /**
  * @return bool|string
  */
 public function getExistingLengths()
 {
     $db = \Pimcore\Resource::get();
     $query = "\n            SELECT length FROM " . OnlineShop_Framework_VoucherService_Token_Resource::TABLE_NAME . "\n            WHERE voucherSeriesId = ?\n            GROUP BY length";
     try {
         return $db->fetchAssoc($query, $this->getId());
     } catch (Exception $e) {
         return false;
     }
 }
开发者ID:ascertain,项目名称:NGshop,代码行数:13,代码来源:AbstractVoucherSeries.php

示例9: showAction

 public function showAction()
 {
     $offset = $this->_getParam("start");
     $limit = $this->_getParam("limit");
     $orderby = "ORDER BY id DESC";
     $sortingSettings = \Pimcore\Admin\Helper\QueryParams::extractSortingSettings($this->getAllParams());
     if ($sortingSettings['orderKey']) {
         $orderby = "ORDER BY " . $sortingSettings['orderKey'] . " " . $sortingSettings['order'];
     }
     $queryString = " WHERE 1=1";
     if ($this->_getParam("priority") != "-1" && ($this->_getParam("priority") == "0" || $this->_getParam("priority"))) {
         $queryString .= " AND priority <= " . $this->_getParam("priority");
     } else {
         $queryString .= " AND (priority = 6 OR priority = 5 OR priority = 4 OR priority = 3 OR priority = 2 OR priority = 1 OR priority = 0)";
     }
     if ($this->_getParam("fromDate")) {
         $datetime = $this->_getParam("fromDate");
         if ($this->_getParam("fromTime")) {
             $datetime = substr($datetime, 0, 11) . $this->_getParam("fromTime") . ":00";
         }
         $queryString .= " AND timestamp >= '" . $datetime . "'";
     }
     if ($this->_getParam("toDate")) {
         $datetime = $this->_getParam("toDate");
         if ($this->_getParam("toTime")) {
             $datetime = substr($datetime, 0, 11) . $this->_getParam("toTime") . ":00";
         }
         $queryString .= " AND timestamp <= '" . $datetime . "'";
     }
     if ($this->_getParam("component")) {
         $queryString .= " AND component =  '" . $this->_getParam("component") . "'";
     }
     if ($this->_getParam("relatedobject")) {
         $queryString .= " AND relatedobject = " . $this->_getParam("relatedobject");
     }
     if ($this->_getParam("message")) {
         $queryString .= " AND message like '%" . $this->_getParam("message") . "%'";
     }
     $db = Resource::get();
     $count = $db->fetchCol("SELECT count(*) FROM " . Log\Helper::ERROR_LOG_TABLE_NAME . $queryString);
     $total = $count[0];
     $result = $db->fetchAll("SELECT * FROM " . Log\Helper::ERROR_LOG_TABLE_NAME . $queryString . " {$orderby} LIMIT {$offset}, {$limit}");
     $errorDataList = array();
     if (!empty($result)) {
         foreach ($result as $r) {
             $parts = explode("/", $r['filelink']);
             $filename = $parts[count($parts) - 1];
             $fileobject = str_replace(PIMCORE_DOCUMENT_ROOT, "", $r['fileobject']);
             $errorData = array("id" => $r['id'], "message" => $r['message'], "timestamp" => $r['timestamp'], "priority" => $this->getPriorityName($r['priority']), "filename" => $filename, "fileobject" => $fileobject, "relatedobject" => $r['relatedobject'], "component" => $r['component'], "source" => $r['source']);
             $errorDataList[] = $errorData;
         }
     }
     $results = array("p_totalCount" => $total, "p_results" => $errorDataList);
     $this->_helper->json($results);
 }
开发者ID:yonetici,项目名称:pimcore-coreshop-demo,代码行数:55,代码来源:LogController.php

示例10: updateSubTenantEntries

 public function updateSubTenantEntries($objectId, $subTenantData, $subObjectId = null)
 {
     $db = \Pimcore\Resource::get();
     $db->delete($this->getTenantRelationTablename(), "o_id = " . $db->quote($subObjectId ? $subObjectId : $objectId));
     if ($subTenantData) {
         //implementation specific tenant get logic
         foreach ($subTenantData as $data) {
             $db->insert($this->getTenantRelationTablename(), $data);
         }
     }
 }
开发者ID:ascertain,项目名称:NGshop,代码行数:11,代码来源:DefaultMysqlSubTenantConfig.php

示例11: getPriorities

 /**
  * @static
  * @return string[]
  */
 public static function getPriorities()
 {
     $priorities = array();
     $priorityNames = array(Zend_Log::DEBUG => "DEBUG", Zend_Log::INFO => "INFO", Zend_Log::NOTICE => "INFO", Zend_Log::WARN => "WARN", Zend_Log::ERR => "ERR", Zend_Log::CRIT => "CRIT", Zend_Log::ALERT => "ALERT", Zend_Log::EMERG => "EMERG");
     $db = Resource::get();
     $priorityNumbers = $db->fetchCol("SELECT priority FROM " . Log\Helper::ERROR_LOG_TABLE_NAME . " WHERE NOT ISNULL(priority) GROUP BY priority;");
     foreach ($priorityNumbers as $priorityNumber) {
         $priorities[$priorityNumber] = $priorityNames[$priorityNumber];
     }
     return $priorities;
 }
开发者ID:yonetici,项目名称:pimcore-coreshop-demo,代码行数:15,代码来源:Db.php

示例12: insertOrUpdateVoucherSeries

 public function insertOrUpdateVoucherSeries()
 {
     $db = \Pimcore\Resource::get();
     try {
         $query = 'INSERT INTO ' . OnlineShop_Framework_VoucherService_Token_Resource::TABLE_NAME . '(token,length,voucherSeriesId) VALUES (?,?,?)
                 ON DUPLICATE KEY UPDATE token = ?, length = ?';
         $db->query($query, [trim($this->configuration->getToken()), $this->getFinalTokenLength(), $this->getSeriesId(), trim($this->configuration->getToken()), $this->getFinalTokenLength()]);
     } catch (Exception $e) {
         return ['error' => 'Something went wrong.'];
         //TODO Error
     }
 }
开发者ID:ascertain,项目名称:NGshop,代码行数:12,代码来源:Single.php

示例13: getData

    /**
     * @param OnlineShop_Framework_Pricing_IRule $rule
     * @param string                             $field
     *
     * @return mixed
     */
    private function getData(OnlineShop_Framework_Pricing_IRule $rule, $field)
    {
        if (!array_key_exists($rule->getId(), self::$cache)) {
            $query = <<<'SQL'
SELECT 1

    , priceRule.ruleId
	, count(priceRule.o_id) as "soldCount"
	, sum(orderItem.totalPrice) as "salesAmount"

	-- DEBUG INFOS
	, orderItem.oo_id as "orderItem"
	, `order`.orderdate

FROM object_query_%2$d as `order`

    -- ordered products
    JOIN object_relations_%2$d as orderItems
        ON( 1
            AND orderItems.fieldname = "items"
            AND orderItems.src_id = `order`.oo_id
        )

	-- order item
	JOIN object_%1$d as orderItem
		ON ( 1
    	    AND orderItem.o_id = orderItems.dest_id
		)

	-- add active price rules
	JOIN object_collection_PricingRule_%1$d as priceRule
		ON( 1
			AND priceRule.o_id = orderItem.oo_id
			AND priceRule.fieldname = "PricingRules"
			AND priceRule.ruleId = %3$d
		)

WHERE 1
    AND `order`.orderState = "committed"

LIMIT 1
SQL;
            try {
                $query = sprintf($query, \Pimcore\Model\Object\OnlineShopOrderItem::classId(), \Pimcore\Model\Object\OnlineShopOrder::classId(), $rule->getId());
                $conn = \Pimcore\Resource::getConnection();
                self::$cache[$rule->getId()] = $conn->fetchRow($query);
            } catch (Exception $e) {
                Logger::error($e);
            }
        }
        return self::$cache[$rule->getId()][$field];
    }
开发者ID:ascertain,项目名称:NGshop,代码行数:58,代码来源:AbstractOrder.php

示例14: routeShutdown

 /**
  * @param \Zend_Controller_Request_Abstract $request
  * @return bool|void
  */
 public function routeShutdown(\Zend_Controller_Request_Abstract $request)
 {
     if (!Tool::useFrontendOutputFilters($request)) {
         return $this->disable();
     }
     $db = \Pimcore\Resource::get();
     $enabled = $db->fetchOne("SELECT id FROM targeting_personas UNION SELECT id FROM targeting_rules LIMIT 1");
     if (!$enabled) {
         return $this->disable();
     }
     if ($request->getParam("document") instanceof Document\Page) {
         $this->document = $request->getParam("document");
     }
 }
开发者ID:Gerhard13,项目名称:pimcore,代码行数:18,代码来源:Targeting.php

示例15: cleanUpStatistics

 /**
  * @param int $duration days
  * @param string|null $seriesId
  * @return bool
  */
 public static function cleanUpStatistics($duration, $seriesId = null)
 {
     $query = "DELETE FROM " . OnlineShop_Framework_VoucherService_Statistic_Resource::TABLE_NAME . " WHERE DAY(DATEDIFF(date, NOW())) >= ?";
     $params[] = $duration;
     if (isset($seriesId)) {
         $query .= " AND voucherSeriesId = ?";
         $params[] = $seriesId;
     }
     $db = \Pimcore\Resource::get();
     try {
         $db->query($query, $params);
         return true;
     } catch (Exception $e) {
         return false;
     }
 }
开发者ID:ascertain,项目名称:NGshop,代码行数:21,代码来源:Statistic.php


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