當前位置: 首頁>>代碼示例>>PHP>>正文


PHP self::getResource方法代碼示例

本文整理匯總了PHP中self::getResource方法的典型用法代碼示例。如果您正苦於以下問題:PHP self::getResource方法的具體用法?PHP self::getResource怎麽用?PHP self::getResource使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在self的用法示例。


在下文中一共展示了self::getResource方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getById

 /**
  * @param integer $id
  * @return Redirect
  */
 public static function getById($id)
 {
     $redirect = new self();
     $redirect->setId(intval($id));
     $redirect->getResource()->getById();
     return $redirect;
 }
開發者ID:Gerhard13,項目名稱:pimcore,代碼行數:11,代碼來源:Redirect.php

示例2: getByKey

 /**
  * @static
  * @param $id - translation key
  * @param bool $create - creates an empty translation entry if the key doesn't exists
  * @param bool $returnIdIfEmpty - returns $id if no translation is available
  * @return Translation_Website
  */
 public static function getByKey($id, $create = false, $returnIdIfEmpty = false)
 {
     $translation = new self();
     try {
         $translation->getResource()->getByKey($id);
     } catch (Exception $e) {
         if (!$create) {
             throw new Exception($e->getMessage());
         } else {
             $translation->setKey($id);
             $translation->setDate(time());
             $translations = array();
             foreach (Pimcore_Tool::getValidLanguages() as $lang) {
                 $translations[$lang] = "";
             }
             $translation->setTranslations($translations);
             $translation->save();
         }
     }
     if ($returnIdIfEmpty) {
         $translations = $translation->getTranslations();
         foreach ($translations as $key => $value) {
             $translations[$key] = $value ?: $id;
         }
         $translation->setTranslations($translations);
     }
     return $translation;
 }
開發者ID:shanky0110,項目名稱:pimcore-custom,代碼行數:35,代碼來源:Website.php

示例3: getById

 /**
  * Static helper to retrieve an instance of Document_DocType by the given ID
  *
  * @param integer $id
  * @return Document_DocType
  */
 public static function getById($id)
 {
     $docType = new self();
     $docType->setId(intval($id));
     $docType->getResource()->getById();
     return $docType;
 }
開發者ID:shanky0110,項目名稱:pimcore-custom,代碼行數:13,代碼來源:DocType.php

示例4: getById

 /**
  * @param integer $id
  * @return Glossary
  */
 public static function getById($id)
 {
     $glossary = new self();
     $glossary->setId(intval($id));
     $glossary->getResource()->getById();
     return $glossary;
 }
開發者ID:yonetici,項目名稱:pimcore-coreshop-demo,代碼行數:11,代碼來源:Glossary.php

示例5: getByKey

 /**
  * @param string $key
  * @return Property_Predefined
  */
 public static function getByKey($key)
 {
     $property = new self();
     $property->setKey($key);
     $property->getResource()->getByKey();
     return $property;
 }
開發者ID:shanky0110,項目名稱:pimcore-custom,代碼行數:11,代碼來源:Predefined.php

示例6: getBySourceId

 /**
  * Static helper to get the dependencies for the given sourceId & type
  *
  * @param integer $id
  * @param string $type
  * @return Dependency
  */
 public static function getBySourceId($id, $type)
 {
     $d = new self();
     $d->setSourceId($id);
     $d->setSourceType($type);
     $d->getResource()->getBySourceId();
     return $d;
 }
開發者ID:ngocanh,項目名稱:pimcore,代碼行數:15,代碼來源:Dependency.php

示例7: getById

 /**
  * @param integer $id
  *
  * @return Migration|false
  */
 public static function getById($id)
 {
     try {
         $migration = new self();
         $migration->getResource()->getById($id);
     } catch (\Exception $e) {
         $migration = false;
     }
     return $migration;
 }
開發者ID:Cube-Solutions,項目名稱:pimcore-migrations,代碼行數:15,代碼來源:Migration.php

示例8: getById

 public static function getById($id)
 {
     try {
         $obj = new self();
         $obj->getResource()->getById($id);
         return $obj;
     } catch (\Exception $ex) {
     }
     return null;
 }
開發者ID:Cube-Solutions,項目名稱:pimcore-coreshop,代碼行數:10,代碼來源:RangeWeight.php

示例9: getByAddress

 /**
  * @param $addr
  * @return null|Blacklist
  */
 public static function getByAddress($addr)
 {
     try {
         $address = new self();
         $address->getResource()->getByAddress($addr);
         return $address;
     } catch (\Exception $e) {
         return null;
     }
 }
開發者ID:rolandstoll,項目名稱:pimcore,代碼行數:14,代碼來源:Blacklist.php

示例10: getByElement

 public static function getByElement($cid, $ctype)
 {
     try {
         $lock = new self();
         $lock->getResource()->getByElement($cid, $ctype);
         return $lock;
     } catch (Exception $e) {
         return null;
     }
 }
開發者ID:shanky0110,項目名稱:pimcore-custom,代碼行數:10,代碼來源:Editlock.php

示例11: getTypes

 public static function getTypes()
 {
     try {
         $importReport = new self();
         return $importReport->getResource()->getTypes();
     } catch (Exception $ex) {
         Logger::debug($ex->getMessage());
         return null;
     }
 }
開發者ID:ascertain,項目名稱:NGshop,代碼行數:10,代碼來源:ImportReport.php

示例12: getById

 /**
  * @static
  * @param $id
  * @return Element\Note
  */
 public static function getById($id)
 {
     try {
         $note = new self();
         $note->getResource()->getById($id);
         return $note;
     } catch (\Exception $e) {
         return null;
     }
 }
開發者ID:rolandstoll,項目名稱:pimcore,代碼行數:15,代碼來源:Note.php

示例13: getByName

 /**
  * @param $name
  * @return GroupConfig
  */
 public static function getByName($name)
 {
     try {
         $config = new self();
         $config->setName($name);
         $config->getResource()->getByName();
         return $config;
     } catch (\Exception $e) {
     }
 }
開發者ID:rolandstoll,項目名稱:pimcore,代碼行數:14,代碼來源:GroupConfig.php

示例14: getByCarrierAndRange

 public static function getByCarrierAndRange($carrier, $range)
 {
     try {
         $obj = new self();
         $obj->getResource()->getByCarrierAndRange($carrier, $range);
         return $obj;
     } catch (\Exception $ex) {
     }
     return null;
 }
開發者ID:Cube-Solutions,項目名稱:pimcore-coreshop,代碼行數:10,代碼來源:DeliveryPrice.php

示例15: getByCode

 /**
  * @param string $code
  * @return bool|OnlineShop_Framework_VoucherService_Token
  */
 public static function getByCode($code)
 {
     try {
         $config = new self();
         $config->getResource()->getByCode($code);
         return $config;
     } catch (Exception $ex) {
         //            Logger::debug($ex->getMessage());
         return false;
     }
 }
開發者ID:ascertain,項目名稱:NGshop,代碼行數:15,代碼來源:Token.php


注:本文中的self::getResource方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。