[TYPO3-mvc] Using ObjectStorage properly
Søren Malling
soren.malling at gmail.com
Thu May 6 14:38:23 CEST 2010
>>
>> /**
>> * Members of club
>> * @var
>> Tx_Extbase_Persistence_ObjectStorage<Tx_Ysmenmembers_Domain_Model_Member>
>> */
>> protected $members;
>
> looks good. does the database have a field "members"? if yes, please post
> TCA-config, if not, please post mapping-TS.
>
No database field (or TCA) and no TS mapping.
>
>> /**
>> * Get members of club
>> * @return
>> Tx_Extbase_Persistence_ObjectStorage<Tx_Ysmenmembers_Domain_Model_Member>
>> */
>> public function getMembers() {
>> return $this->members;
>> }
>
> And you've got a set(), aight?
>
Actually, no. I'm in doubt of what this should consist of. I don't see
it as a normal setter, as it's going to contain a number of objects,
is that a wrong way of thinking?
I thought something like this (tested and with no result)
public function setMembers() {
$this->memberRepository->findByClub($this->getUid());
}
>> This is where I'm stucked. How does this objectstorage know what data
>> to return?
>
> It takes the type-hint (the part in <>), tries to get that model and then
> fetches the objects. if this is not in-depth enough, please let me know,
> I'll explain a little bit deeper if this is of interest*. ;-)
>
Great explanation, another info added to my big book of knowledge! :-)
>
> you forgot to tell us, what exactly is your problem. ;-) don't you get data
> at all? an exception?
Sorry :P I don't get any member data, no output at all.
More information about the TYPO3-project-typo3v4mvc
mailing list