/** * @param integer $id * @return Redirect */ public static function getById($id) { $redirect = new self(); $redirect->setId(intval($id)); $redirect->getResource()->getById(); return $redirect; }
/** * @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; }
/** * 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; }
/** * @param integer $id * @return Glossary */ public static function getById($id) { $glossary = new self(); $glossary->setId(intval($id)); $glossary->getResource()->getById(); return $glossary; }
/** * @param string $key * @return Property_Predefined */ public static function getByKey($key) { $property = new self(); $property->setKey($key); $property->getResource()->getByKey(); return $property; }
/** * 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; }
/** * @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; }
public static function getById($id) { try { $obj = new self(); $obj->getResource()->getById($id); return $obj; } catch (\Exception $ex) { } return null; }
/** * @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; } }
public static function getByElement($cid, $ctype) { try { $lock = new self(); $lock->getResource()->getByElement($cid, $ctype); return $lock; } catch (Exception $e) { return null; } }
public static function getTypes() { try { $importReport = new self(); return $importReport->getResource()->getTypes(); } catch (Exception $ex) { Logger::debug($ex->getMessage()); return null; } }
/** * @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; } }
/** * @param $name * @return GroupConfig */ public static function getByName($name) { try { $config = new self(); $config->setName($name); $config->getResource()->getByName(); return $config; } catch (\Exception $e) { } }
public static function getByCarrierAndRange($carrier, $range) { try { $obj = new self(); $obj->getResource()->getByCarrierAndRange($carrier, $range); return $obj; } catch (\Exception $ex) { } return null; }
/** * @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; } }
/** * Static helper to retrieve an instance of Document\DocType by the given ID * * @param integer $id * @return DocType */ public static function getById($id) { $docType = new self(); $docType->setId(intval($id)); try { $docType->getResource()->getById(); } catch (\Exception $e) { return null; } return $docType; }
/** * @param $id * @return null|Persona */ public static function getById($id) { try { $persona = new self(); $persona->setId(intval($id)); $persona->getResource()->getById(); return $persona; } catch (\Exception $e) { return null; } }
public static function getBySeriesId($seriesId) { try { $config = new self(); $config->setCondition('series_id', $seriesId); $config->getResource()->load(); return $config; } catch (Exception $ex) { // Logger::debug($ex->getMessage()); return false; } }
/** * @param string $name * @return WebsiteSetting */ public static function getByName($name, $siteId = null) { // create a tmp object to obtain the id $setting = new self(); try { $setting->getResource()->getByName($name, $siteId); } catch (\Exception $e) { \Logger::error($e); return null; } return $setting; }
/** * @param integer $id * @return Schedule_Task */ public static function getById($id) { $cacheKey = "scheduled_task_" . $id; try { $task = Zend_Registry::get($cacheKey); } catch (Exception $e) { $task = new self(); $task->getResource()->getById(intval($id)); Zend_Registry::set($cacheKey, $task); } return $task; }
/** * @param $category * @param $action * @param $label * @param $day * @param $month * @param $year * @return Event */ public static function getByDate($category, $action, $label, $day, $month, $year) { $event = new self(); try { $event->getResource()->getByDate($category, $action, $label, $day, $month, $year); } catch (\Exception $e) { $event->setTimestamp(mktime(1, 0, 0, $month, $day, $year)); $event->setCategory($category); $event->setAction($action); $event->setLabel($label); } return $event; }
/** * @param integer $id * @return Schedule\Task */ public static function getById($id) { $cacheKey = "scheduled_task_" . $id; try { $task = \Zend_Registry::get($cacheKey); if (!$task) { throw new \Exception("Scheduled Task in Registry is not valid"); } } catch (\Exception $e) { $task = new self(); $task->getResource()->getById(intval($id)); \Zend_Registry::set($cacheKey, $task); } return $task; }
/** * @param string $id * @return QuantityValue_Unit */ public static function getById($id) { $cacheKey = Unit\Resource::TABLE_NAME . "_" . $id; try { $unit = \Zend_Registry::get($cacheKey); } catch (\Exception $e) { try { $unit = new self(); $unit->getResource()->getById($id); \Zend_Registry::set($cacheKey, $unit); } catch (\Exception $ex) { \Logger::debug($ex->getMessage()); return null; } } return $unit; }
/** * @param string $domain * @return Site */ public static function getByDomain($domain) { // cached because this is called in the route (Pimcore_Controller_Router_Route_Frontend) $cacheKey = "site_domain_" . str_replace(array(".", "-"), "_", $domain); if (!($site = Pimcore_Model_Cache::load($cacheKey))) { $site = new self(); try { $site->getResource()->getByDomain($domain); } catch (Exception $e) { $site = "failed"; } Pimcore_Model_Cache::save($site, $cacheKey, array("system", "site")); } if ($site == "failed" || !$site) { throw new Exception("there is no site for the requested domain"); } return $site; }
/** * @param $id * @return mixed|null|CustomLayout * @throws \Exception */ public static function getById($id) { if ($id === null) { throw new \Exception("CustomLayout id is null"); } $cacheKey = "customlayout_" . $id; try { $customLayout = \Zend_Registry::get($cacheKey); if (!$customLayout) { throw new \Exception("Custom Layout in registry is null"); } } catch (\Exception $e) { try { $customLayout = new self(); $customLayout->getResource()->getById($id); Object\Service::synchronizeCustomLayout($customLayout); \Zend_Registry::set($cacheKey, $customLayout); } catch (\Exception $e) { \Logger::error($e); return null; } } return $customLayout; }
public static function getById($id) { $item = new self(); $item->getResource()->getById($id); return $item; }
/** * @param $uuid * @return mixed */ public static function getByUuid($uuid) { $self = new self(); return $self->getResource()->getByUuid($uuid); }
/** * @param string $path * @return self */ public static function getByPath($path) { $path = Model\Element\Service::correctPath($path); try { $object = new self(); if (Tool::isValidPath($path)) { $object->getResource()->getByPath($path); return self::getById($object->getId()); } } catch (\Exception $e) { \Logger::warning($e->getMessage()); } return null; }
/** * @param $element * @return Data */ public static function getForElement($element) { $data = new self(); $data->getResource()->getForElement($element); return $data; }
/** * @param integer $id * @return Document_Permissions */ public static function getById($id) { $permission = new self(); $permission->setId(intval($id)); $permission->getResource()->getById(); $permission->getUser(); $permission->setAdmin(); return $permission; }