简体   繁体   English

Laravel 4-找不到存储库接口

[英]Laravel 4 - Repository Interface not found

Just started working through laracasts and trying to move on from direct eloquent use in the controllers. 刚开始研究拉播节目,并尝试从直接雄辩地使用控制器中继续前进。

I have implemented everything that I need to but hitting this error: 我已经实现了我所需要的一切,但是遇到了这个错误:

Class tva\Repositories\VehicleRepositoryInterface does not exist

My folder structure is: 我的文件夹结构是:

app/
  tva/
    repositories/

VehiclesController: VehiclesController:

use tva\Repositories\VehicleRepositoryInterface;

class VehiclesController extends \BaseController {
  protected $vehicle;

  public function __construct(VehicleRepositoryInterface $vehicle)
  {
    $this->vehicle = $vehicle;
  }

}

In the repositories folder: 在存储库文件夹中:

VehicleRepository: 车辆资料库:

namespace tva\Repositories;

class VehicleRepository implements VehicleRepositoryInterface {
}

VehicleRepositoryInterface: VehicleRepositoryInterface:

namespace tva\Repositories;

interface VehicleRepositoryInterface {
}

And also updated my composer.json: 并且还更新了我的composer.json:

"psr-0": {
  "tva": "app/"
},

To me, this should work? 对我来说,这行得通吗?

问题已解决,而不是使用psr-0,我将目录添加到了classmap中,所有问题均已解决。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM