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


PHP Resource::get方法代码示例

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


在下文中一共展示了Resource::get方法的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: __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

示例4: 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

示例5: 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

示例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: 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

示例8: 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

示例9: 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

示例10: 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

示例11: 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

示例12: 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

示例13: 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

示例14: getByKeyAndLanguage

 /**
  * @param $key
  * @param $language
  * @return \Pimcore\Model\Metadata\Predefined
  */
 public static function getByKeyAndLanguage($key, $language)
 {
     $db = \Pimcore\Resource::get();
     $list = new self();
     $condition = "name = " . $db->quote($key);
     if ($language) {
         $condition .= " AND language = " . $db->quote($language);
     } else {
         $condition .= " AND (language = '' OR LANGUAGE IS NULL)";
     }
     $list->setCondition($condition);
     $list = $list->load();
     if ($list) {
         return $list[0];
     }
     return null;
 }
开发者ID:pawansgi92,项目名称:pimcore2,代码行数:22,代码来源:Listing.php

示例15: isUsedToken

 /**
  * @param string $token
  * @param int $usages
  * @return bool
  */
 public static function isUsedToken($token, $usages = 1)
 {
     $db = \Pimcore\Resource::get();
     $query = "SELECT usages, seriesId FROM " . self::TABLE_NAME . " WHERE token = ? ";
     $params[] = $token;
     try {
         $usages['usages'] = $db->fetchOne($query, $params);
         if ($usages > $usages) {
             return $usages['seriesId'];
         } else {
             return false;
         }
         // If an Error occurs the token is defined as used.
     } catch (Exception $e) {
         return true;
     }
 }
开发者ID:ascertain,项目名称:NGshop,代码行数:22,代码来源:Resource.php


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