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