[TYPO3-mvc] MM relation to pages Table
Franz Koch
typo3.RemoveForMessage at elements-net.de
Tue Mar 8 10:30:09 CET 2011
Hey Frank,
> I want to display page related information.
> I have three Tables
>
> TableA 1...n TableB 1...n pages
>
...
> What functions have to be implemented in the Domain_Model_Pages Object?
well, you need at least property definitions and getters for the
informations you like to display from the pages.
> Is it necessary to define a mapping?
>
> config.tx_extbase.persistence.classes {
> Tx_Pluginname_Domain_Model_Pages{
> mapping{
> tableName = pages
> recordType = Tx_Pluginname_Domain_Model_Pages
> }
> }
> }
Yes, you need a mapping rule, but you don't need "recordType = Tx_..."
unless you really need single table inheritance.
> Is it correct to define the following methods in the Model_TableA
>
> /**
> * Properties
> *
> * @var
> Tx_Extbase_Persistence_ObjectStorage<Tx_Pluginname_Domain_Model_TableB>
> $entryprops
> */
> protected $entryprops;
>
> and then the: add, remove, set, get Method
yes, looks good. You could use a better naming for $entryprops though,
like $properties - but keep in mind that you have to add some column
mapping rules in TS then.
> Do I have to write the same in Model_TableB for the pages object?
yes - how would you otherwise be able to access the pages if your models
don't have a property for them ;) Everything you like to get from your
models at least needs a property definition and a getter method. So if
TableB has a relation to pages and you need to get the related pages you
need to add the necessary parts to the model.
--
kind regards,
Franz Koch
More information about the TYPO3-project-typo3v4mvc
mailing list