[TYPO3-mvc] Extending fe_users
Manuel Simon
typo3 at it11.info
Tue Jan 12 19:54:35 CET 2010
Good evening,
I'm currently trying to implement a extension with extbase and fluid and
I'm stuck extending the fe_users table.
While I can edit all available fields in the BE and access the normal
fe_users fields from extbase, I'm not able to access the extra fields.
Below you can find my current work.
I thought about doing a select in a __construct section in the Model,
but after reviewing some slides I guess, this would be the wrong place.
I think I'm missing an important point for the magic to work, but
currently I've got no idea, where to start to look.
Thank you for your suggestions in advance,
Manuel
In ext_tables.php:
---
$AdditionalFeUsersColumns = Array (
"tx_..._..Nr" => Array (
"exclude" => 0,
"label" => "Nummer",
"config" => Array (
"type" => "input",
"size" => "30",
"max" => "6",
"eval" => "required,trim",
)
),
);
t3lib_div::loadTCA("fe_users");
t3lib_extMgm::addTCAcolumns("fe_users", $AdditionalFeUsersColumns, 1);
t3lib_extMgm::addToAllTCAtypes("fe_users","tx_..._...Nr");
---
In ext_tables.sql:
---
CREATE TABLE fe_users (
tx_..._...Nr char(6) DEFAULT '' NOT NULL,
);
---
Model
---
class Tx_..._Domain_Model_Participant extends
Tx_Extbase_Domain_Model_FrontendUser {
/**
* tx_..._...Nr
* @var string
*/
protected $tx_..._...Nr;
/**
* Getter for ...Nr
*
* @return string tx_..._...Nr
*/
public function get...Nr() {
return $this->tx_..._...Nr;
}
/**
* Setter for ...Nr
*
* @param string $...Nr tx_..._...Nr
* @return void
*/
public function set...Nr($...Nr) {
$this->tx_..._...Nr = $..Nr;
}
}
---
Repository
---
class Tx_..._Domain_Repository_ParticipantRepository extends
Tx_Extbase_Domain_Repository_FrontendUserRepository {
}
---
Controller
---
public function listAction() {
$this->participantRepository =
t3lib_div::makeInstance('Tx_..._Domain_Repository_ParticipantRepository');
$this->participant =
t3lib_div::makeInstance('Tx_..._Domain_Model_Participant');
{
if($this->participant =
$this->participantRepository->findOneByUid(intval($GLOBALS['TSFE']->fe_user->user['uid'])))
{
$this->view->assign('...nr', $this->participant->get...Nr());
$this->view->assign('zip', $this->participant->getZip());
}
}
}
---
I also tried extending tca.php
---
$TCA['tx_..._domain_model_participant'] = array(
'ctrl' => $TCA['tx_..._domain_model_participant']['ctrl'],
'interface' => array(
'showRecordFieldList' => 'tx_..._...Nr'
),
'types' => array(
'1' => array('showitem' => 'tx_..._...Nr')
),
'palettes' => array(
'1' => array('showitem' => '')
),
'columns' => array(
'tx_..._...Nr' => array(
'exclude' => 0,
'config' => array(
"type" => "input",
"size" => "30",
"max" => "6",
"eval" => "required,trim",
"foreign_table" => "fe_users",
),
),
),
);
---
More information about the TYPO3-project-typo3v4mvc
mailing list