[TYPO3-mvc] Controller ignores Repository's findByUid() [webservice/SOAP]

Bart Veldhuizen bart at v-int.nl
Thu Dec 23 14:04:42 CET 2010


Hello list,

I have recently begun studying Extbase/Fluid development using Jochen 
and Sebastian's excellent book. As part of a first 'real-life' test, I 
want to retrieve and later store some information in an external system 
using a SOAP webservice.

I've read the discussions on this list on this topic, and for my purpose 
it seems logical to place this functionality in the Repository.

At this moment, I've implemented two methods: findAll() and findByUid().

The first one works fine (I left out the inclusion of my external 
classes and error handling for readability):

------------------------
public function findAll() {
   $client = new DataService();
   $oResp = $client->ListProgrammes( new ListProgrammesReq() );

   $result = array();
   foreach( $oResp->Programmes as $Programma ) {
     $result[] = new Tx_Test_Domain_Model_Programma( /* args */);
   }

   return $result;
}
------------------------
	
I can now list and display data in my controller's listAction().

For displaying a single record, I implemented the following findByUid() 
method:

------------------------
public function findByUid($uid) {
   $client = new DataService();
   $Programma = $client->GetProgrammeById( new GetProgrammeById($uid) );
   return new Tx_Test_Domain_Model_Programma( /* args */);
}
------------------------

This causes Extbase to throw an exception. The root cause of this is 
that the controller uses 
Tx_Extbase_MVC_Controller_Argument::findObjectByUid() to retrieve my 
object. This method tries to perform a direct database query (and 
fails), and does not use my the findByUid() method in my model:

------------------------
protected function findObjectByUid($uid) {

   $query = $this->queryFactory->create($this->dataType);
   $query->getQuerySettings()->setRespectSysLanguage(FALSE);		
   $result = $query->matching($query->equals('uid', $uid))->execute();
   $object = NULL;
   if (count($result) > 0) {
     $object = current($result);
   }
   return $object;
}
------------------------

If I understand the framework correctly so far, such a request should be 
passed through my domain's repository, no?
	
There's an issue on forge with a patch for this problem, but it hasn't 
been touched for over 11 months: http://forge.typo3.org/issues/6017

Am I missing the point here? Any insights to help me along would be much 
appreciated.

Thanks!

Bart


More information about the TYPO3-project-typo3v4mvc mailing list