本文整理汇总了PHP中Wind::registeComponent方法的典型用法代码示例。如果您正苦于以下问题:PHP Wind::registeComponent方法的具体用法?PHP Wind::registeComponent怎么用?PHP Wind::registeComponent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Wind
的用法示例。
在下文中一共展示了Wind::registeComponent方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public function init($front = null)
{
parent::init($front);
foreach ($this->dependenceServiceDefinitions as $alias => $definition) {
if (!$definition) {
continue;
}
Wind::registeComponent($definition, $alias);
}
}
示例2: getDao
/**
* 返回Dao类实例
* $className接受两种形式呃参数如下
* <ul>
* <li>'namespace:path'</li>
* <li>'className'</li>
* </ul>
*
* @param string $className
* Dao名字
* @return WindDao
* @throws WindDaoException 如果获取实例错误抛出异常
*/
public function getDao($className)
{
try {
if (strpos($className, ":") === false) {
$className = $this->getDaoResource() . '.' . $className;
}
Wind::registeComponent(array('path' => $className, 'scope' => 'application'), $className);
$daoInstance = Wind::getComponent($className);
$daoInstance->setDelayAttributes(array('connection' => array('ref' => 'db')));
return $daoInstance;
} catch (Exception $exception) {
throw new WindDaoException('[dao.WindDaoFactory.getDao] create dao ' . $className . ' fail.' . $exception->getMessage());
}
}
示例3: error_reporting
if (!defined('WEKIT_VERSION')) {
error_reporting(E_ERROR | E_PARSE);
require_once WINDID_BOOT . '../wekit.php';
Wekit::init('windidclient');
Wind::application('windidclient', Wekit::S());
$database = (include WINDID_BOOT . 'conf/database.php');
$windidConfig = (include Wind::getRealPath('WINDID:conf.config.php', true));
Wind::register(WINDID_PATH . 'service', 'SRV');
} else {
$windidConfig = Wekit::C('windid');
if ($windidConfig['windid'] == 'local') {
$database = Wind::getComponent('db')->getConfig();
$database['tableprefix'] .= 'windid_';
$windidConfig['connect'] = 'db';
} else {
$database = array('dsn' => 'mysql:host=' . $windidConfig['db.host'] . ';dbname=' . $windidConfig['db.name'] . ';port=' . $windidConfig['db.port'], 'user' => $windidConfig['db.user'], 'pwd' => $windidConfig['db.pwd'], 'charset' => $windidConfig['db.charset'], 'tableprefix' => $windidConfig['db.prefix']);
}
$windidConfig['charset'] = Wekit::V('charset');
}
Wind::register(WINDID_PATH . 'service', 'WSRV');
Wind::import('WSRV:base.WindidBaseDao');
Wind::import('WSRV:base.WindidUtility');
Wind::import('WSRV:base.WindidError');
Wind::registeComponent(array('path' => 'WIND:db.WindConnection', 'config' => $database), 'windiddb', 'singleton');
define('WINDID_CONNECT', $windidConfig['connect']);
define('WINDID_SERVER_URL', $windidConfig['serverUrl']);
define('WINDID_CLIENT_ID', $windidConfig['clientId']);
define('WINDID_CLIENT_KEY', $windidConfig['clientKey']);
define('WINDID_CLIENT_CHARSET', $windidConfig['charset']);
Wekit::createapp('windidclient', 'windid');
示例4: define
<?php
!defined('WINDID') && define('WINDID', dirname(__FILE__));
!defined('WINDID_PATH') && define('WINDID_PATH', WINDID);
!defined('WINDID_VERSION') && define('WINDID_VERSION', '0.0.2');
if (!defined('WEKIT_VERSION')) {
require_once WINDID . '/../../wind/Wind.php';
$database = (include WINDID . '/conf/database.php');
Wind::register(WINDID, 'WINDID');
Wind::application();
Wind::import('WINDID:library.Windid');
$component = array('path' => 'WIND:db.WindConnection', 'config' => $database);
Wind::registeComponent($component, 'windiddb', 'singleton');
}
class WindidApi
{
public static function api($api)
{
static $cls = array();
$array = array('user', 'config', 'message', 'avatar', 'area', 'school');
if (!in_array($api, $array)) {
return WindidError::FAIL;
}
$class = 'Windid' . ucfirst($api) . 'Api';
if (!isset($cls[$class])) {
if (Windid::client()->clientDb == 'mysql') {
$class = Wind::import('WINDID:api.local.' . $class);
$cls[$class] = new $class();
} elseif (Windid::client()->clientDb == 'http') {
$class = Wind::import('WINDID:api.web.' . $class);
$cls[$class] = new $class();