[TYPO3-extbase-kickstarter] Can't access arrays from repository

Graf Zahl graf_zahl348 at hotmail.de
Tue May 8 18:08:36 CEST 2012


Nevermind, I solved it by myself in a different way.

From: graf_zahl348 at hotmail.de
To: typo3-project-extbase-kickstarter at lists.typo3.org
Subject: Can't access arrays from repository
Date: Fri, 4 May 2012 11:04:52 +0200






Hi,

I created a TYPO3-page with the Plugin using the listAction of my Controller "Driver", it looks like this:

    public function listAction() {
        $team = new Tx_WithhMtdriver_Domain_Repository_TeamRepository();
        $teams = $team->findAll();
        $this->view->assign('teams', $teams);
        
        $drivers = $this->driverRepository->findAll();
        $this->view->assign('drivers', $drivers);
    }

The List.html for this Action partially looks like this:

    <div class="driver_list">
        <f:for each="{drivers}" as="driver">
            <div class="driver_list_element">
                <div class="driver_list_element_image">
                    <f:image src="{driver.carimage}" alt="{driver.firstname} {driver.name}" width="227m" />
                </div>
                <div class="driver_list_element_name">
                    <f:link.action pageUid="24" action="show" controller="Driver" arguments="{driver : driver}">{driver.firstname} {driver.name} &gt;</f:link.action>
                </div>
                <div class="driver_list_element_team">
                    <f:link.action pageUid="24" action="show" controller="Team" arguments="{team : driver.team}">{driver.team.name}  &gt;</f:link.action>
                </div>                
            </div>
        </f:for>
    </div>

The first link goes to the showAction of the current Controller, the second one goes to the showAction of the Controller "Team".
The driver-model has a n:1 relation with the team-model.

This way I can display the Teamname of the Driver in the Show.html of Driver:
<f:link.action action="show" arguments="{team : team}">{driver.team.name}  &gt;</f:link.action>

However, I also need to display all Drivers of a Team in the Show.html of Team.
Since the relation is not visible in the Team table in the databse, I probably can't access it that way.
I was hoping that I could access the Drivers-Table with an array created in the showAction of Team..

        $driver = new Tx_WithhMtdriver_Domain_Repository_DriverRepository();
        $drivers = $driver->findAll();
        $this->view->assign('drivers', $drivers);

and later call it in a fluid for-loop:

                    <f:for each="{drivers}" as="driver">
                        <td>{driver.name}</td>
                    </f:for>

But this doesn't return any results. Any idea what I'm doing wrong? fluid-debug didn't help.
 		 	   		   		 	   		  


More information about the TYPO3-project-extbase-kickstarter mailing list