[TYPO3-mvc] IRRE foreign_selector ("associative entity")

Jochen Rau jochen.rau at typoplanet.de
Mon Dec 28 13:38:07 CET 2009


Hi Martin.

schrieb Martin Kutschker:
> Jochen Rau schrieb:
>> schrieb Martin Kutschker:
>>> But what to to now with ExtBase? The associative entity has to be
>>> persisted, but doesn't need to be
>>> shown or manipulated on its own. I won't need a controller/view for
>>> it. But how to add this entities
>>> to the models of recoding and CD without a further MM table?
>> IMO it's ok to have an "intermediate" domain object. You don't need a
>> controller or a view for it. Maybe it makes sense to have a domain
>> object "Track" holding the track number and the recording:
>>
>>
>>     1     n       n     1
>> CD---------Track---------Recording
>> title      number        title
>> tacks      recording     length
>> producer
>
> This is what I had in mind.
>
> If I set this up with a "foreign_selector" nothing will happen. So I only need to add custom
> functions to my repositories if I want to store and retrieve the tracks, right? ExtBase will not
> help me, but it will not stand in my way.

Extbase can build the whole object graph for you as long as you hold the 
naming conventions or provide a mapping rule. But to be honest, I have 
no working example for this case. The following code might point you in 
the right direction.

class Tx_CD { //shortened version ;-)

  /*
   * @var Tx_Extbase_Persistence_ObjectStorage<Tx_Track>
   */
  protected $tracks;

  [setter getter]
}

class Tx_Track { // works with foreign_key

  /*
   * @var Tx_Record
   */
  protected $record;

  [setter getter]
}

class Tx_Record {

}


> PS: I know, I sounded negative in my last posts. ExtBase has of course come a long way. I fear I
> have expected it to be more feature complete.

Let's see what we can do for the next version of Extbase. ;-)

Jochen

-- 
Every nit picked is a bug fixed



More information about the TYPO3-project-typo3v4mvc mailing list