本文整理汇总了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;
}
示例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;
}
示例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;
}
示例4: getById
/**
* @param integer $id
* @return Glossary
*/
public static function getById($id)
{
$glossary = new self();
$glossary->setId(intval($id));
$glossary->getResource()->getById();
return $glossary;
}
示例5: getByKey
/**
* @param string $key
* @return Property_Predefined
*/
public static function getByKey($key)
{
$property = new self();
$property->setKey($key);
$property->getResource()->getByKey();
return $property;
}
示例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;
}
示例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;
}
示例8: getById
public static function getById($id)
{
try {
$obj = new self();
$obj->getResource()->getById($id);
return $obj;
} catch (\Exception $ex) {
}
return null;
}
示例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;
}
}
示例10: getByElement
public static function getByElement($cid, $ctype)
{
try {
$lock = new self();
$lock->getResource()->getByElement($cid, $ctype);
return $lock;
} catch (Exception $e) {
return null;
}
}
示例11: getTypes
public static function getTypes()
{
try {
$importReport = new self();
return $importReport->getResource()->getTypes();
} catch (Exception $ex) {
Logger::debug($ex->getMessage());
return null;
}
}
示例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;
}
}
示例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) {
}
}
示例14: getByCarrierAndRange
public static function getByCarrierAndRange($carrier, $range)
{
try {
$obj = new self();
$obj->getResource()->getByCarrierAndRange($carrier, $range);
return $obj;
} catch (\Exception $ex) {
}
return null;
}
示例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;
}
}