本文整理汇总了PHP中Registry::put方法的典型用法代码示例。如果您正苦于以下问题:PHP Registry::put方法的具体用法?PHP Registry::put怎么用?PHP Registry::put使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Registry
的用法示例。
在下文中一共展示了Registry::put方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
/** set up */
public function setUp()
{
$this->createDatabase();
Registry::put($configurator = new MockConfigurator(), '__configurator');
Registry::put(new Logger($configurator), '__logger');
ActiveRecord::close_connection();
}
示例2: dispatch
/**
* Framework entry point
*
* @return void.
*/
public function dispatch()
{
include_once 'action/controller/http/HTTPResponse.php';
include_once 'action/controller/http/HTTPRequest.php';
$request = new HTTPRequest();
$response = new HTTPResponse();
try {
$configurator = $this->manager->getConfigurator();
Registry::put($configurator, '__configurator');
Registry::put($logger = new Logger($configurator), '__logger');
$ap = $configurator->getApplicationPath();
// application path
$an = $configurator->getApplicationName();
// application name
$logger->debug('[Medick] >> version: ' . Medick::getVersion() . ' ready for ' . $an);
$logger->debug('[Medick] >> Application path ' . $ap);
$routes_path = $ap . DIRECTORY_SEPARATOR . 'conf' . DIRECTORY_SEPARATOR . $an . '.routes.php';
include_once $routes_path;
// load routes
$logger->debug('[Medick] >> Config File: ' . str_replace($ap, '${' . $an . '}', $configurator->getConfigFile()));
$logger->debug('[Medick] >> Routes loaded from: ' . str_replace($ap, '${' . $an . '}', $routes_path));
ActionControllerRouting::recognize($request)->process($request, $response)->dump();
} catch (Exception $ex) {
ActionController::process_with_exception($request, $response, $ex)->dump();
$logger->warn($ex->getMessage());
}
}
示例3: setUp
/** set up */
public function setUp()
{
Registry::put($configurator = new MockConfigurator(), '__configurator');
Registry::put(new Logger($configurator), '__logger');
ActiveRecord::close_connection();
$author = new Author();
$author->name = 'Andrei Cristescu';
$author->email = 'andrei@foocompany.com';
$id = $author->save();
$book = new Book();
$book->author_id = $id;
$book->title = 'The End is NEAR!';
$book->save();
}
示例4: setUp
/** set up this test case, we insert 3 fileds in DB table */
public function setUp()
{
Registry::put($configurator = new MockConfigurator(), '__configurator');
Registry::put(new Logger($configurator), '__logger');
ActiveRecord::close_connection();
$author = new Author();
$author->name = "Andrei Cristescu";
$author->email = "andrei.cristescu@foo-factory.info";
$this->authors[] = $author;
$author->insert();
$author = new Author();
$author->name = "Cristescu";
$this->authors[] = $author;
$author->insert();
$author = new Author();
$author->name = "Andrei";
$this->authors[] = $author;
$author->insert();
}
示例5: createControllerInstance
/**
* Creates a Controller Instance
*
* @throws RoutingException
* @return ActionControllerBase
*/
public function createControllerInstance(Request $request)
{
if (!$this->isLoaded) {
$this->load($request);
}
try {
// Registry::get('__logger')->debug('[Medick] >> found ' . $this->toString());
return Registry::put(new Injector(), '__injector')->inject('controller', $request->getParameter('controller'));
} catch (FileNotFoundException $fnfEx) {
throw new RoutingException('Cannot create a controller instance, ' . $fnfEx->getMessage());
}
}