当前位置: 首页>>代码示例>>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;未经允许,请勿转载。