This is possible. Let's assume your model Event has a property customId
. So you generate your link like this:
<f:link.action action="show" arguments="{event : event.customId}">
The link generated will have a queryString like this:
?tx_myext[event]=9999
The showAction generated by the Extension Builder expects that the UID of the event is passed. The PropertyMapper then fetches the object automatically and assigns it to the view:
/**
* action show
*
* @param \Your\Extension\Domain\Model\Event $event
* @return void
*/
public function showAction(\Your\Extension\Domain\Model\Event $event) {
$this->view->assign('event', $event);
}
But in your case you cannot fetch the object by UID because you passed the customId. So you need to fetch the object yourself:
/**
* action show
*
* @param integer $event
* @return void
*/
public function showAction($event) {
$event = $this->eventRepository->findOneByCustomId($event);
$this->view->assign('event', $event);
}
The annotation @param integer $event
tells TYPO3 that the parameter is "just" an integer. You then call the magic method findOneByCustomId
from your eventRepository. findOne
indicates that you want exactly one Event
object back (and not a QueryResult
), while the ByCustomId
that queries an existing property of your Event
model.