[TYPO3-mvc] Problem calling a repository function

Raymund Tump raymund.tump at gmx.de
Mon Jan 31 09:58:35 CET 2011


Hi,

I have a function in a repository findByService that works well if
called directly by an action.

Now I want to use it in a viewhelper and there it fails. It looks like
$this->createQuery() and $query->execute() just don't do anything in
$this->that case.

I tried to debug with a log entry in Typo3DBBackend and I can see that
a SQL query is created and executed in the direct case but not in the
second one. And it doesn't matter which function of the project
repository I call.

Here is the render function in my view helper (courtesy to Franz).

        public function render(Tx_References_Domain_Model_Service $service, $as) {
            t3lib_div::devLog('render: ' . $service. ' ' . $as, 'utek_referenzen', 0);
                
            $projectRepository =
            t3lib_div::makeInstance('Tx_References_Domain_Repository_ProjectRepository');
            $projects = $projectRepository->findByService($service);

            $this->templateVariableContainer->add($as, $projects);
            $output = $this->renderChildren();
            $this->templateVariableContainer->remove($as);

            return $output;
        }

The findByService method is pretty straight forward too:

        /*
         * @param Tx_References_Domain_Model_Service $service
         */
        public function findByService(Tx_References_Domain_Model_Service $service)
        {
                $query = $this->createQuery();
                $query->matching(
                        $query->equals('service', $service)
                );
                $query->setOrderings(
                        array (
                                'enddate' => Tx_Extbase_Persistence_QueryInterface::ORDER_ASCENDING,
                                'startdate' => Tx_Extbase_Persistence_QueryInterface::ORDER_DESCENDING,
                        )
                );
                return $query->execute();
        }

Any idea how I can find out, why it isn't working?

I have another view helper which basically does the same for a
different set of objects and that works like a charm.

-- 
Regards
Raymund



More information about the TYPO3-project-typo3v4mvc mailing list