[TYPO3-mvc] get records from own model pages
Georg Schönweger
georg.schoenweger at gmail.com
Tue May 3 17:35:52 CEST 2011
Hi,
i'm currently developing my first extbase based extension. I read the
book "Typo3-Extension mit Extbase & Fluid" but now i have to ask for help.
I need to fetch pages with a certain pid. In these pages i have stored
records which are defined in my extension. Now i need to iterate in my
fluid template through the found pages and in that loop iterate all
records related to the certain pages. (i need something like
{pages.records.fields})
So i created a model and repository for pages and a model/repository for
records. For now i can select pages and records in my controller, but i
don't know how they can interact with each others. (i need pages.records).
I have 2 ideas now but i don't know if they will work and if this is the
right way;
a) i could create in the page model a function getRecords where i create
an instance of the records repository and return all records with
pid=$this->pid
b) Iterate in the controller trough all pages. In the loop i call find
Method of the records-repository and do something like
pages->setRecords(foundRecords) (not sure if i have access to the model
via the repository)
.. i could also create a new field in pages table with relation to the
records but i don't want this because i have the relation already via
the pid field of records ..
Any hints?
- Georg
More information about the TYPO3-project-typo3v4mvc
mailing list