doutan2228 2016-03-26 10:18
浏览 57
已采纳

使用baum / baum与Lumen

I am trying to get baum/baum / etrepat/baum working with laravel/lumen-framework.

I have added "baum/baum": "~1.1" into my composer.json and got baum to properly install, however when I try to create a DB migration using php artisan baum:install nace_categories -vvv I get following error message:

Mareks-MacBook-Air:myDWH marekstopka$ php artisan baum:install nace_categories -vvv


  [ReflectionException]               
  Class path.database does not exist  


Exception trace:
 () at /Users/marekstopka/prace/myBusinessSuite/myDWH/vendor/illuminate/container/Container.php:738
 ReflectionClass->__construct() at /Users/marekstopka/prace/myBusinessSuite/myDWH/vendor/illuminate/container/Container.php:738
 Illuminate\Container\Container->build() at /Users/marekstopka/prace/myBusinessSuite/myDWH/vendor/illuminate/container/Container.php:633
 Illuminate\Container\Container->make() at /Users/marekstopka/prace/myBusinessSuite/myDWH/vendor/laravel/lumen-framework/src/Application.php:205
 Laravel\Lumen\Application->make() at /Users/marekstopka/prace/myBusinessSuite/myDWH/vendor/illuminate/container/Container.php:1178
 Illuminate\Container\Container->offsetGet() at /Users/marekstopka/prace/myBusinessSuite/myDWH/vendor/baum/baum/src/Baum/Console/InstallCommand.php:111
 Baum\Console\InstallCommand->getMigrationsPath() at /Users/marekstopka/prace/myBusinessSuite/myDWH/vendor/baum/baum/src/Baum/Console/InstallCommand.php:88
 Baum\Console\InstallCommand->writeMigration() at /Users/marekstopka/prace/myBusinessSuite/myDWH/vendor/baum/baum/src/Baum/Console/InstallCommand.php:64
 Baum\Console\InstallCommand->fire() at n/a:n/a
 call_user_func_array() at /Users/marekstopka/prace/myBusinessSuite/myDWH/vendor/illuminate/container/Container.php:507
 Illuminate\Container\Container->call() at /Users/marekstopka/prace/myBusinessSuite/myDWH/vendor/illuminate/console/Command.php:169
 Illuminate\Console\Command->execute() at /Users/marekstopka/prace/myBusinessSuite/myDWH/vendor/symfony/console/Command/Command.php:256
 Symfony\Component\Console\Command\Command->run() at /Users/marekstopka/prace/myBusinessSuite/myDWH/vendor/illuminate/console/Command.php:155
 Illuminate\Console\Command->run() at /Users/marekstopka/prace/myBusinessSuite/myDWH/vendor/symfony/console/Application.php:791
 Symfony\Component\Console\Application->doRunCommand() at /Users/marekstopka/prace/myBusinessSuite/myDWH/vendor/symfony/console/Application.php:186
 Symfony\Component\Console\Application->doRun() at /Users/marekstopka/prace/myBusinessSuite/myDWH/vendor/symfony/console/Application.php:117
 Symfony\Component\Console\Application->run() at /Users/marekstopka/prace/myBusinessSuite/myDWH/vendor/laravel/lumen-framework/src/Console/Kernel.php:69
 Laravel\Lumen\Console\Kernel->handle() at /Users/marekstopka/prace/myBusinessSuite/myDWH/artisan:35

Mareks-MacBook-Air:myDWH marekstopka$ 

I have added

$app->withFacades();
$app->withEloquent();
$app->register(Baum\Providers\BaumServiceProvider::class);

into my bootstrap/app.php to enable Facades and Eloquent and to register Baum Service Provider.

I also did composer update and composer dump-autoload.

Does anybody have any experience using Baum nested set trees with Lumen framework?

  • 写回答

1条回答 默认 最新

  • dor65412 2016-03-26 11:26
    关注

    Put following lines into your bootstrap/app.php:

    $app->instance('path.base', $app->path());
    $app->instance('path.database', $app->databasePath());
    

    See https://github.com/etrepat/baum/pull/217

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 删除虚拟显示器驱动 删除所有 Xorg 配置文件 删除显示器缓存文件 重启系统 可是依旧无法退出虚拟显示器
  • ¥15 vscode程序一直报同样的错,如何解决?
  • ¥15 关于使用unity中遇到的问题
  • ¥15 开放世界如何写线性关卡的用例(类似原神)
  • ¥15 关于并联谐振电磁感应加热
  • ¥15 this signal is connected to multiple drivers怎么解决
  • ¥60 请查询全国几个煤炭大省近十年的煤炭铁路及公路的货物周转量
  • ¥15 请帮我看看我这道c语言题到底漏了哪种情况吧!
  • ¥66 如何制作支付宝扫码跳转到发红包界面
  • ¥15 pnpm 下载element-plus