2013-05-24 2 views

답변

1

은 새 속성과 접근을 포함하도록 ZfcUser 사용자 개체를 확장합니다. 자신의 모듈에서이 작업을 수행해야하거나, 스켈레톤 앱을 사용하는 경우 Application 모듈이 작동합니다.

<?php 
namespace Application\Entity; 

use ZfcUser\Entity\User; 

class MyUser extends User 
{ 
    protected $org; 

    public function setOrg($org) 
    { 
     $this->org = $org; 
     return $this; 
    } 

    public function getOrg() 
    { 
     return $this->org; 
    } 
} 

복사 vendor/ZfcUser/config/zfcuser.global.php.dist 열기

/config/autoload/zfcuser.global.php에 당신은 당신의 편집기에서 복사 된 파일, 그리고

/** 
* User Model Entity Class 
* 
* Name of Entity class to use. Useful for using your own entity class 
* instead of the default one provided. Default is ZfcUser\Entity\User. 
* The entity class should implement ZfcUser\Entity\UserInterface 
*/ 
//'user_entity_class' => 'ZfcUser\Entity\User', 

주석 행 아래 부분을 발견하고 정규화 된 클래스 값을 대체 만든 MyUser 엔티티의 이름

'user_entity_class' => 'Application\Entity\MyUser', 

그런 다음 방법에 액세스하십시오.

<?php echo $this->zfcUserIdentity()->getOrg(); ?> 
+0

빠른 답장을 보내 주셔서 감사합니다! 나는 setOrg 함수를 생략하고 있었다. –