Пример #1
0
 /**
  * This method is meant to be overridden, for you to configure your application
  *
  * @return \SystemContainer|\Nette\DI\Container
  */
 protected function createContainer()
 {
     $configurator = new Nette\Config\Configurator();
     $configurator->setTempDirectory(TEMP_DIR);
     return $configurator->createContainer();
 }
Пример #2
0
<?php

/**
 * Soubor pro načtení všech souborů PHPUnit testů. Používá se jen pro spouštění
 * testů v IDE PHPStorm.
 *
 * @author Martin Štekl <*****@*****.**>
 * @since 2012-07-23
 */
use Nette\Config\Configurator;
define('TEST_DIR', __DIR__);
define('LIBS_DIR', TEST_DIR . '/../vendor');
// Composer autoloading
require LIBS_DIR . '/autoload.php';
// Configure application
$configurator = new Nette\Config\Configurator();
// Enable Nette Debugger for error visualisation & logging
$configurator->setDebugMode(Configurator::AUTO);
$configurator->enableDebugger(TEST_DIR . '/../log', '*****@*****.**');
// Enable RobotLoader - this will load all classes automatically
$configurator->setTempDirectory(TEST_DIR . '/../temp');
$configurator->createRobotLoader()->addDirectory(TEST_DIR)->register();
Пример #3
0
<?php

use Nette\Config\Configurator;
use Nette\Application\Routers\Route;
use Nette\Application\Routers\SimpleRouter;
require __DIR__ . '/../vendor/nette/nette/Nette/loader.php';
if (is_file($cache = __DIR__ . '/../temp/classes.cache.php')) {
    require $cache;
} else {
    require __DIR__ . '/ClassCacheBuilder.php';
    ClassCacheBuilder::customBuild($cache);
}
$configurator = new Configurator();
$configurator->setDebugMode(FALSE);
$configurator->enableDebugger(__DIR__ . '/../log');
$configurator->setTempDirectory(__DIR__ . '/../temp');
$container = $configurator->createContainer();
$container->router[] = new SimpleRouter('Default:default');
$container->application->run();
Пример #4
0
<?php
/**
 * Addons and code snippets for Nette Framework. (unofficial)
 *
 * @author   Jan Tvrdík
 * @license  MIT
 */

use Nette\Application\Routers\Route;
use Nette\Config\Configurator;
use Nette\Forms;

require_once LIBS_DIR . '/Nette/loader.php';

$configurator = new Configurator();
$configurator->enableDebugger();
$configurator->setTempDirectory(TEMP_DIR);
$configurator->createRobotLoader()
	->addDirectory([APP_DIR, LIBS_DIR, APP_DIR . '/../../NetteExtras/Components', APP_DIR . '/../../NetteExtras/Templates'])
	->register();

$dic = $configurator->createContainer();
$dic->router[] = new Route('index.php', 'Demo:default', Route::ONE_WAY);
$dic->router[] = new Route('<action>', 'Demo:default');

Forms\Container::extensionMethod('addDatePicker', function (Forms\Container $container, $name, $label = NULL) {
	return $container[$name] = new JanTvrdik\Components\DatePicker($label);
});

$dic->application->run();