== Controller ==
'''typo3conf/ext/ncfluid/Classes/Controller/TableController.php'''
<source lang="php">
<?php
class Tx_Ncfluid_Controller_TableController
extends Tx_Extbase_MVC_Controller_ActionController {
/**
* @var Tx_Ncfluid_Domain_Repository_TableRepository
*/
protected $tableRepository;
 
/**
* ! Action's
*
* Per Konvention wird jede Aktion als öffentliche Methode implementiert, die
* dem Namensschema [Aktionsname]Action folgt.
*
* folgende exsitieren schon
* * Class Tx_Extbase_MVC_Controller_ActionController
* ** protected void initializeAction()
* ** protected string errorAction()
*/
 
/**
* List action for this controller. Displays all tablerows.
*/
public function indexAction() {
$rows = $this->tableRepository->findAll();
$this->view->assign('table', $rows);
}
 
/**
*
* The show action. Displays details for a specific tablerow.
*
* @param Tx_Ncfluid_Domain_Model_Table $tablerow The tablerow that is to be displayed.
* @return void
*
*/
 
public function showAction (Tx_Ncfluid_Domain_Model_Table $tablerow ) {
$this->view->assign('tablerow', $tablerow);
}
 
/**
*
* @param Tx_Ncfluid_Domain_Model_Table $tablerow
* @dontvalidate $tablerow
*/
public function newAction(Tx_Ncfluid_Domain_Model_Table $tablerow=NULL) {
$this->view->assign('tablerow', $tablerow);
}
/**
*
* @param Tx_Ncfluid_Domain_Model_Table $tablerow
* @dontvalidate $tablerow
*/
public function createAction(Tx_Ncfluid_Domain_Model_Table $tablerow) {
$this->tableRepository->add($tablerow);
 
$this->flashMessageContainer->add('Your new row was created.');
$this->redirect('index');
}
/**
*
* The delete action. Deletes an existing row from the database.
*
* @param Tx_Ncfluid_Domain_Model_Table $tablerow The tablerow that is to be deleted
* @return void
*
*/
public function deleteAction(Tx_Ncfluid_Domain_Model_Table $tablerow) {
$this->tableRepository->remove($tablerow);
$this->flashMessageContainer->add('Your tablerow was removed.');
$this->redirect('index');
}
 
/**
* Displays a form to edit an existing tablerow
*
* @param Tx_Ncfluid_Domain_Model_Table $tablerow The tablerow to display
* @dontvalidate $tablerow
*/
public function editAction(Tx_Ncfluid_Domain_Model_Table $tablerow) {
$this->view->assign('tablerow', $tablerow);
}
/**
* Updates an existing tablerow and forwards to the index action.
*
* @param Tx_Ncfluid_Domain_Model_Table $tablerow The tablerow to display
*/
public function updateAction(Tx_Ncfluid_Domain_Model_Table $tablerow) {
$objectManager = t3lib_div::makeInstance('Tx_Extbase_Object_ObjectManager');
$tableRepository = $objectManager->get('Tx_Ncfluid_Domain_Repository_TableRepository');
$tableRepository->update($tablerow);
// $this->tableRepository->update($tablerow);
$this->flashMessageContainer->add('Your tablerow was updated.');
$this->redirect('index');
}
/**
*
* The initialization action. This methods creates instances of all required
* repositories.
*
* @return void
*
*/
protected Function initializeAction() {
$this->tableRepository =& t3lib_div::makeInstance('Tx_Ncfluid_Domain_Repository_TableRepository');
}
}
 
?>
</source>
=Notizen=
Änderungen – Vosp.info

Änderungen

Navigationsmenü