[TYPO3-mvc] Problems with table mapping

Manfred Rutschmann manfred.rutschmann at revier.de
Wed Apr 13 12:16:05 CEST 2011


Hi,

i have to mapp many t3 external tables (phpbb3 software), and have some
problems with data retriving from it. It`s typo3 4.5.2  with the included
extbase/fluid.

in ts i have setup the table mapping:
config.tx_extbase.persistence.classes {
    Tx_Dspremium_Domain_Model_PhpbbAttachments {
        mapping {
            tableName = phpbb_attachments
            columns {
            	attach_id.mapOnProperty = attach_id
            	post_msg_id.mapOnProperty = post_msg_id
            	topic_id.mapOnProperty = topic_id
            	in_message.mapOnProperty = in_message
            	poster_id.mapOnProperty = poster_id
            	is_orphan.mapOnProperty = is_orphan
            	physical_filename.mapOnProperty = physical_filename
            	real_filename.mapOnProperty = real_filename
            	download_count.mapOnProperty = download_count
            	attach_comment.mapOnProperty = attach_comment
            	extension.mapOnProperty = extension
            	mimetye.mapOnProperty = mimetye
            	filesize.mapOnProperty = filesize
            	filetime.mapOnProperty = filetime
            	thumbnail.mapOnProperty = thumbnail
            	in_ug.mapOnProperty = in_ug
            }
        }
    }
}

Then i have cerated a model with all properties (only getters!). In the
next step i have created a little repository member:

Class Tx_Dspremium_Domain_Repository_PhpbbAttachmentsRepository Extends
Tx_Extbase_Persistence_Repository {

	public function findPart($start,$limit){
		$query = $this->createQuery();
		$query->setLimit((integer)$limit);
		return $query->execute();
	}

}

And here comes my controller action:

Class Tx_Dspremium_Controller_ImageexifController Extends
Tx_Extbase_MVC_Controller_ActionController {

		 /**
		  * A project repository.
		  * @var Tx_Dspremium_Domain_Repository_PhpbbAttachmentsRepository
		  */
	Protected $phpbbAttachmentsRepository;	
	

	public function initializeAction() {
		// Start the attachment repository
		$this->phpbbAttachmentsRepository
=&t3lib_div::makeInstance('Tx_Dspremium_Domain_Repository_PhpbbAttachmentsRepository');
	}
	
	public function indexAction(){
	}
	
	public function generateAction(){
		$attachment =
&t3lib_div::makeInstance("Tx_Dspremium_Domain_Model_PhpbbAttachments");
		$attachments = $this->phpbbAttachmentsRepository->findPart(0,10);
		$this->view->assign("attachments",$attachments);
	}
	
}


In my template i run throug the object and make the output:

<f:count subject="{attachments}" /><br />

<f:for each="{attachments}" as="attachment" key="number">
      {number}: {attachment.attach_id}<br />
</f:for>

And now i get this in the frontend:
0: 43
1: 43
2: 43
3: 43
4: 43
5: 43
6: 43
7: 43
8: 43
9: 43

All id`s are the same. And all properties of the object are the same row
too.

I have tested the built-in findAll, i get 23000 rows (correct count) but
each row is the same. It`s the the first row in the table with the lowest
id.

Is this an bug? 

Thx & Regards Manne




More information about the TYPO3-project-typo3v4mvc mailing list