[TYPO3-mvc] Repository doesn't work if called from different controller

Raymund Tump raymund.tump at gmx.de
Thu Jan 20 18:48:08 CET 2011


Hi,

I'm writing an extension to show customer references on a web site I
just migrated to Typo3. There are two different lists one with
projects and one with customers.

At one point an action is called that should show all projects that
were done for a given customer. But the call to the project repository
returns no projects.

Here's part of the code:

        /**
         * Renders a single customer
         *
         * @param Tx_UtekReferenzen_Domain_Model_Customer $customer The customer to be displayed
         * @return string The rendered HTML string
         */
        public function showAction(Tx_UtekReferenzen_Domain_Model_Customer $customer) {
                $projectRespository = t3lib_div::makeInstance('Tx_UtekReferenzen_Domain_Repository_ProjectRepository');
                $this->view->assign('customer', $customer);
                $this->view->assign('projects', $projectRespository->findAll());
        }

        public function findAll()
        {
                t3lib_div::devLog('Projects: findAll', 'utek_referenzen', 0);
                $query = $this->createQuery();
                $result = $query->execute();
                t3lib_div::devLog('result:' . $result->count(), 'utek_referenzen',0);
                return $result;
        }

If called from ProjectController.listAction() the debug log says some
projects found. If called by CustomerController.showAction() it says 0
projects found.

I have no idea why that happens. I have a background repository for
services provide in the projects and that is used in
ProjectController.listAction() and works just fine.

Is there a way to output the SQL query to the debugLog? The used
version is Typo3 v4.5beta4.

-- 
Regards,
Raymund Tump



More information about the TYPO3-project-typo3v4mvc mailing list