2014-01-22 2 views
0

모든 프론트 엔드 사용자를 확보해야하는 확장 프로그램이 있습니다. 작동 (1)Typo3 6.1 Extbase - 모든 fe 사용자 선택

/** 
    * @var \TYPO3\CMS\Extbase\Domain\Repository\FrontendUserRepository $feUserRepository 
    */ 
    $feUserRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Domain\\Repository\\FrontendUserRepository'); 
    $allUsers = $feUserRepository->findAll(); 
    $user = $feUserRepository->findByUid(1); 

findByUid하지만 findall은() 하늘의 객체를 반환 : 나는이 시도. 여기서 내가 뭘 잘못하고 있니?

UPDATE :

그것은 뉴스 확장에 관하여이다. tx_xxnews_domain_model_news와 fe_users 사이에는 mm 관계가 있으므로 어떤 사용자가 어떤 뉴스에 액세스했는지 추적 할 수 있습니다. 뉴스

TCA :

'columns' => array(
     ... 

     'fe_users' => array(
      'exclude' => 0, 
      'label' => 'LLL:EXT:xx_news/Resources/Private/Language/locallang_db.xlf:tx_xxnews_domain_model_news.fe_users', 
      'config' => array(
       'type' => 'select', 
       'foreign_table' => 'fe_users', 
       'MM' => 'tx_xxnews_news_feuser_mm', 
       'size' => 10, 
       'autoSizeMax' => 30, 
       'maxitems' => 9999, 
       'multiple' => 0, 
      ), 
     ), 
     ... 
), 

내가하지 않았다 사람과는 별도로 뉴스를 액세스 할 수있는 사용자를 보여, 그래서 사용자 정의 함수의 내용을 보여 2 이상의 열이있다 :

'reading_users' => array (
    'exclude' => 0, 
    'label' => 'LLL:EXT:xx_news/Resources/Private/Language/locallang_db.xlf:tx_xxnews_domain_model_news.user_info', 
    'config' => array (
     'type' => 'user', 
     'size' => '30', 
     'userFunc' => 'EXT:xx_news/Classes/TCA/class.tx_xxnews_tca.php:tx_examples_tca->readersInfo', 
     'parameters' => array(
      'read' => TRUE 
     ) 
    ) 
), 
'not_reading_users' => array (
    'exclude' => 0, 
    'label' => 'LLL:EXT:xx_news/Resources/Private/Language/locallang_db.xlf:tx_xxnews_domain_model_news.user_info', 
    'config' => array (
     'type' => 'user', 
     'size' => '30', 
     'userFunc' => 'EXT:xx_news/Classes/TCA/class.tx_xxnews_tca.php:tx_examples_tca->readersInfo', 
     'parameters' => array(
      'read' => FALSE 
     ) 
    ) 
), 

class.tx_xxnews_tca.php :

class tx_examples_tca { 

    /** 
    * @var \Vendor\XxNews\Domain\Repository\NewsRepository $newsRepository 
    */ 
    protected $newsRepository; 

    /** 
    * Class constructor 
    */ 
    public function __construct() { 
     $this->newsRepository = new \Vendor\XxNews\Domain\Repository\NewsRepository; 
    } 

    public function readersInfo($params) { 

     /** 
     * @var \TYPO3\CMS\Extbase\Domain\Repository\FrontendUserRepository $feUserRepository 
     */ 
     $feUserRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Domain\\Repository\\FrontendUserRepository'); 
     $allUsers = $feUserRepository->findAll(); 
     $user = $feUserRepository->findByUid(1); 

     var_dump($allUsers); //EMPTY 
     var_dump($user);  //OK 
    } 
} 

감사합니다.

답변

4

문제는 Extbase가 TYPO3에 의해 소개되었을 때 Frontend 사용자를위한 "레코드 유형"이 통합되었다는 것입니다. (이것은 단지 예로서 행해졌 고 6.2 BTW에서 삭제 될 것입니다).

당신은 당신의 확장 (이 확장의 ext_tables.php에 정의) 또는 (지우기)를 제거 할 수있는 레코드 유형의 필요성의 레코드 유형에 대한 각 프런트 엔드 사용자의 레코드 유형을 설정해야 하나

config.tx_extbase.persistence.classes.Vendor/MyExtension/Domain/Model/User.mapping.recordType = 

편집 : 그런데 , 당신은 대신 makeInstance를 사용하는 저장소를 삽입해야합니다

/** 
* @var \TYPO3\CMS\Extbase\Domain\Repository\FrontendUserRepository 
* @inject 
*/ 
protected $feUserRepository; 
+0

안녕 로렌츠을. FrontendUser 모델을 확장하지 않으므로 레코드 유형이 정의되어 있지 않습니다. 필자는 tx_extbase_type 필드를 'Tx_Extbase_Domain_Model_FrontendUser'로 업데이트했지만 findAll()은 아무것도 반환하지 않았습니다. 나는 모델을 확장하지 않고 단지 코어 모델을 사용하는 fe 사용자 목록을 얻고 싶다. 고맙습니다. – cili

+1

프론트 엔드 또는 백엔드 확장 기능입니까? 스토리지 PID가 설정되어 있습니까? – lorenz

+0

fe_users와 mm 관련 뉴스 확장 프로그램입니다. 업데이트를 확인하십시오. – cili