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


PHP Registry::getModel方法代碼示例

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


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

示例1: executeEvent

 /**
  * Статичный метод обработки сгенерированного события:
  * - событие может просто записаться в базу для дальнейшего выполнения 
  * - а может сразу выполниться
  * @param string $event - событие
  * @param array $params - массив с параметрами события
  * @param bool $needRealExecute - нужно ли сразу выполнять событие
  */
 public function executeEvent($event, $params, $needRealExecute = false)
 {
     // проверяем, есть ли для данного проекта обработчик этого события
     if (file_exists($this->rootPath . 'workflow/projects/' . $this->project['projectID'] . '/Event/' . $event . '.php')) {
         if (file_exists($this->rootPath . 'workflow/projects/' . $this->project['projectID'] . '/settings.php')) {
             include_once $this->rootPath . 'workflow/projects/' . $this->project['projectID'] . '/settings.php';
         }
         $eventData = array('dt' => date('d-m-Y H:i:s'), 'projectID' => $this->project['projectID'], 'event_type' => $event, 'params' => json_encode($params), 'done' => 0, 'locked' => 0);
         $eventID = $this->registry->getDbHelper('WorkflowHelper')->addEvent($eventData);
         $eventData['eventID'] = $eventID;
         if ($needRealExecute) {
             $this->registry->getModel('Tasks')->executeEvent($eventData);
         }
     }
     return true;
 }
開發者ID:hippout,項目名稱:eco-test,代碼行數:24,代碼來源:EventListener.php

示例2: getModel

 /**
  * Global implementation of Interfaces\Persistent
  * @return persistr\Interfaces\Model
  */
 function getModel()
 {
     return Registry::getModel($this);
 }
開發者ID:jgswift,項目名稱:persistr,代碼行數:8,代碼來源:Persistent.php

示例3:

$registry->createAndStoreModel('Rating', 'rating');
$registry->createAndStoreModel('Review', 'review');
$registry->createAndStoreModel('Checkout', 'checkout');
$registry->createAndStoreModel('UploadFiles', 'upload');
$registry->getObject('url')->getURLData();
$registry->storeSetting('default', 'view');
$registry->storeSetting('template', 'template');
$registry->storeSetting('authentication', 'authenticate');
$registry->storeSetting('Book Store', 'sitename');
$registry->storeSetting('https://', 'protocol');
$registry->storeSetting($registry->getSetting('protocol') . 'localhost/bookstore/', 'siteurl');
include 'protected/config/config.php';
// create database connection
$registry->getObject('db')->newConnection(DB_SERVER, DB_NAME, DB_USER, DB_PASS);
// process authentication
$registry->getModel('authenticate')->checkForAuthentication();
if ($registry->getModel('authenticate')->isLoggedIn() === true) {
    $registry->getObject('template')->username = $registry->getObject('session')->get('firstName');
    $registry->getObject('template')->loggedIn = $registry->getModel('authenticate')->isLoggedIn();
}
// loads list of categories for sidebar menu
// limits display on 12 categories randomly ordered
$registry->getObject('template')->sidebarCategories = $registry->getModel('categories')->categoriesForSidebar();
// loads list of authors for sidebar menu
// limit display on 12 authors randomly ordered
$registry->getObject('template')->sidebarAuthors = $registry->getModel('authors')->authorsForSidebar();
// loads 4 new released products for main header slider
$registry->getObject('template')->newProducts = $registry->getModel('products')->selectNewReleases();
// loads list of categories for making SEO URL with hyphens
$categories = $registry->getModel('categories')->selectCategoriesForUrl();
$registry->getObject('template')->urlCategories = $registry->getObject('url')->makeUrlFromData($categories, 'category');
開發者ID:BorisMatonickin,項目名稱:bookstore,代碼行數:31,代碼來源:index.php


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