本文整理汇总了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;
}
示例2: getModel
/**
* Global implementation of Interfaces\Persistent
* @return persistr\Interfaces\Model
*/
function getModel()
{
return Registry::getModel($this);
}
示例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');