Skip to content

Commit d73fbc6

Browse files
committed
Fixed when no app.yml file error && move debugbar code
1 parent 5e620ba commit d73fbc6

3 files changed

Lines changed: 18 additions & 13 deletions

File tree

src/Framework/Config/ConfigService.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,18 @@ public function parseResource($resource, $isCustom)
4747
}
4848

4949
if (false == $isCustom) {
50-
$config['version'] = APP_VERSION;
51-
$config['debug'] = true;
52-
$config['secret'] = 'tastphp';
53-
$config['env'] = 'tastphp';
54-
$config['timezone'] = 'UTC';
55-
$config['name'] = 'tastphp';
50+
$configInit['version'] = APP_VERSION;
51+
$configInit['debug'] = true;
52+
$configInit['secret'] = 'tastphp';
53+
$configInit['env'] = 'tastphp';
54+
$configInit['timezone'] = 'UTC';
55+
$configInit['name'] = 'tastphp';
5656

5757
$appConfigCacheFile = self::$configCacheDir . "/app.php";
5858
$config = $this->getConfig($appConfigCacheFile, __BASEDIR__ . "/config/{$resource}");
59+
if (empty($config)) {
60+
$config = $configInit;
61+
}
5962
}
6063

6164
if (!$config) {

src/Framework/Doctrine/DoctrineService.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,7 @@
1010
class DoctrineService
1111
{
1212
public function register(Container $app)
13-
{
14-
//debug bar
15-
if ($app['debug']) {
16-
$debugbar = new \TastPHP\Framework\Debug\DebugBar();
17-
$app['debugbar'] = $debugbar;
18-
}
19-
13+
{
2014
$app['db.default_options'] = array(
2115
'driver' => 'pdo_mysql',
2216
'dbname' => 'test',

src/Framework/Handler/WhoopsExceptionsHandler.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace TastPHP\Framework\Handler;
44

5+
use TastPHP\Framework\Debug\DebugBar;
56
use TastPHP\Framework\Kernel;
67
use Whoops\Handler\PlainTextHandler;
78
use Whoops\Handler\PrettyPageHandler;
@@ -15,6 +16,13 @@ class WhoopsExceptionsHandler
1516
public function register()
1617
{
1718
$container = Kernel::getInstance();
19+
20+
//debug bar
21+
if ($container['debug']) {
22+
$debugBar = new DebugBar();
23+
$container['debugbar'] = $debugBar;
24+
}
25+
1826
if (isset($container['display_errors']) && !$container['display_errors']) {
1927
ini_set('display_errors', 'Off');
2028
}

0 commit comments

Comments
 (0)