コントローラーでのリポジトリー/インターフェースの使用に問題があります。私のアプリは Laravel 4 を使用しています。
私の現在のコントローラー継承ツリーは次のとおりです。
+- BaseController
+- FrontendController
+- ProductController
ではFrontendController
、コントローラーでボード全体で使用するものを取得/設定しているため、コンストラクターでインターフェイスを次のように設定しました。
class FrontendController extends BaseController
{
/**
* Constructor
*/
public function __construct(SystemRepositoryInterface $system,
BrandRepositoryInterface $brands,
CategoryRepositoryInterface $categories)
ただし、これは、次のように、すべての子コントローラーでインターフェイスを介して (再度) 送信する必要があることを意味します。
class ProductController extends FrontendController
{
/**
* Constructor
*/
public function __construct(SystemRepositoryInterface $system,
BrandRepositoryInterface $brands,
CategoryRepositoryInterface $categories,
ProductRepositoryInterface $products)
{
parent::__construct($system, $brands, $categories);
私はこのレベル/領域の PHP に慣れていませんが、間違っているように感じます。明らかな何かが欠けていますか?