[TYPO3-mvc] How to use FrontendUserGroup ?

Chatelain Jean-Christophe Chatelain.Jean-Christophe at agridea.ch
Fri Mar 18 15:06:37 CET 2011


Hi,

 

I'm currently trying to extend FrontendUser  to use my model (called
member) with more attributes. 

Creating and modifying my members does work fine but now I want to be
able to choose the usergroup for this member.

 

In my member controller I added this to get the usergroups :

/**

                 * usergroupRepository

                 * 

                 * @var
Tx_Extbase_Domain_Repository_FrontendUserGroupRepository

                 */

                protected $usergroupRepository;

 

/**

                 * Initializes the current action

                 *

                 * @return void

                 */

                protected function initializeAction() {

                               ...

                               $this->usergroupRepository =
t3lib_div::makeInstance('Tx_Extbase_Domain_Repository_FrontendUserGroupR
epository');

                }

                ...

                /**

                 * Creates a new Member and forwards to the list action.

                 *

                 * @param Tx_Pagextmvc_Domain_Model_Member $newMember a
fresh Member object which has not yet been added to the repository

                 * @return string An HTML form for creating a new Member

                 * @dontvalidate $newMember

                 */

                public function
newAction(Tx_Pagextmvc_Domain_Model_Member $newMember = NULL) {

                               $usergroups =
$this->usergroupRepository->findAll();

                               $this->view->assign('usergroups',
$usergroups);          

                               $this->view->assign('newMember',
$newMember);

                

                }

 

In the view I use a select viewHelper to choose the groups :

 

< f:form.select multiple="true" property="usergroup"
options="{usergroups}" optionLabelField="title" size="4" id="usergroup"
optionValueField="uid" value="{newMember.usergroup}" >

 

But i got nothing in the select.

 

I tried to add the mapping in the setup with that :

 

plugin.tx_pagextmvc {

                persistence {

                               storagePid =
{$plugin.tx_pagextmvc.persistence.storagePid}

                classes {

 
Tx_Pagextmvc_Domain_Model_Member {

                                                               mapping {

 
tableName = fe_users

                                        columns {

 
... (attributes mapOnProperty )

                                                usergroup.foreignClass =
Tx_Extbase_Domain_Model_FrontendUserGroup

 
}

                                                               }

                                               }

 
Tx_Extbase_Domain_Model_FrontendUserGroup {

                                mapping.tableName = fe_groups

                                               }

                               }

                }

}

 

But I got no results. 

 

Can anyone help me ?

 

 

Thanks in advance.



More information about the TYPO3-project-typo3v4mvc mailing list