2014-11-14 9 views
2

저는 laravel에 상당히 익숙하며 응용 프로그램에서 psr-4 자동 로딩에 문제가 있습니다.ReflectionException 클래스가 존재하지 않습니다 psr-4

내 폴더 구조 :

-app 
-config 
    -controllers 
    -UsersController 
    -Mynamespace 
    -User.php 

내 composer.json 파일 :

"autoload": { 
    "classmap": [ 
     "app/commands", 
     "app/controllers", 
     "app/database/migrations", 
     "app/database/seeds", 
     "app/tests/TestCase.php" 
    ], 
    "psr-4": { 
     "Mynamespace\\": "app/Mynamespace" 
    } 

그럼 내가 달릴 :

composer dump-autoload 

내 사용자 모델 :

<?php namespace Mynamespace; 

use Illuminate\Auth\UserTrait; 
use Illuminate\Auth\UserInterface; 
use Illuminate\Auth\Reminders\RemindableTrait; 
use Illuminate\Auth\Reminders\RemindableInterface; 
use Eloquent; 

class User extends Eloquent implements UserInterface, RemindableInterface { 
... 

내 공급 업체/작곡가/자동로드-psr4.php : 나는 오류가 존재하지 않는 ReflectionException 클래스 사용자를 받고

'model' => 'Mynamespace\User', 

계속 :

... 
return array(
    'Monolog\\' => array($vendorDir . '/monolog/monolog/src/Monolog'), 
    'Mynamespace\\' => array($baseDir . '/app/Mynamespace'), 
); 

는 내 설정/auth.php 변경. 도와주세요!

+1

['app/config/auth.php'] (https://github.com/laravel/laravel/blob/master/app/config/auth.php#L31)에서'model'을' Mynamespace \ User'? – Marwelln

+0

Yes to \t 'model'=> 'Mynamespace/User', – WaffleBoy

+0

사용자 모델은'User.php'라는 파일에 저장되어 있습니다. 맞습니까? 당신이 당신의 UsersController로 언급했기 때문에 나는 묻습니다. – wolfemm

답변

0

당신의 반사 예외

클래스 사용자는

User라는 클래스을 찾을 수 없다는 불평 오류가 존재하지 않습니다. 위 코드에서 정의한 클래스 User이 보이지 않습니다. Mynamespace\User이라는 클래스가 표시되지만 user라는 전역 클래스가 표시되지 않습니다.

당신이 도움이 될이 예외를보고있는 상황을 알고 있지만, 내 생각 엔 뭔가가 글로벌 User 객체 인스턴스화 Laravel 말했다입니다 (직접 객체를 인스턴스화? app()->make을 통해 객체를 인스턴스화? 의존성 주입 형 힌트를?). 그 맥락 없이는 누군가가 당신을 위해 이것을 추적 할 수 없을 것입니다.

관련 문제