[TYPO3-mvc] Problem with 2 connected Tables

Frank Krueger fkrueger-ml at mp-group.net
Sat Sep 11 13:40:24 CEST 2010


Hi List,

I'm trying to realize a message module where I got two connected tables, one
for the messages, and one for the recipients of a message (as a message may
have more than one recipient).

This worked well as mm-structured tables, but unfortunately I need some
attributes in the messagesRecipients table (date of read, etc.) so I
switched over to two connected domain models (Jochen Rau advised in issue
#6233 that there is no possibility of getting attributes out of mm-relation
tables in extbase).

The recipients model is constructed as an object storage in the messages
model (similar to the post<->comments relation in the blog example):

Tx_..._Domain_Model_Messages
------------------------------------------
/*
 * recipients
 * @var
Tx_Extbase_Persistence_ObjectStorage<Tx_..._Domain_Model_MessagesRecipients>
 * @lazy
 */
protected $recipients;
.
.
/**
 * Setter for recipients
 *
 * @param
Tx_Extbase_Persistence_ObjectStorage<Tx_..._Domain_Model_MessagesRecipients>
$recipients recipients
 * @return void
 */
public function setRecipients(Tx_Extbase_Persistence_ObjectStorage
$recipients) {
  $this->recipients = $recipients;
}



Tx_..._Domain_Model_MessagesRecipients
------------------------------------------
/**
 * @var Tx_..._Domain_Model_Member
 */
protected $recipient = '';


But now I get stuck filling this construct.
Via fluid I pass the recipients as array with a  multi-select:

<f:form.select property="recipients.recipient" options="{sender.friends}"
optionLabelField="username" size="3" multiple="multiple" />

Extbase tells me after form submit, that Argument 1 passed to
Tx_Connects_Domain_Model_Messages::setRecipients() must be an instance of
Tx_Extbase_Persistence_ObjectStorage, array given.

I tried different structures and approaches, but had no success till now,
any ideas are welcome.

Cheers,
Frank





More information about the TYPO3-project-typo3v4mvc mailing list