[TYPO3-english] showAction & uid for model object
Jigal van Hemert
jigal.van.hemert at typo3.org
Sat Nov 22 23:25:59 CET 2014
Hi,
On 22/11/2014 20:07, Tomasz Krawczyk wrote:
> I'm writing an extension which extbase. My controller will have
> showAction without listAction. So, I will not pass ID for my model
> record. I'll get it from the database but I don't know How to send this
> ID to model class.
You have to re-think the concepts a bit with extbase. You don't pass IDs
anymore, but an object (the actual URLs will contain an ID, but this
will be converted into the object with that uid by extbase).
You also don't retrieve records from the database, but you get objects
from the repository.
For your purpose you inject the repository object for the model you want
to use in your controller class. Then you query the repository, get the
object(s) and finally pass them to the view layer.
If you can read German there is an excellent book by Patrick Lobacher
[1] or a series of articles by Anja Leichsenring [2] about writing
extensions with Extbase.
[1]
http://www.opensourcepress.de/de/produkte/TYPO3-Extbase/18824/978-3-95539-070-9
[2] http://www.typoblog.de/tag/anja-leichsenring/
--
Jigal van Hemert
TYPO3 CMS Active Contributor
TYPO3 .... inspiring people to share!
Get involved: typo3.org
More information about the TYPO3-english
mailing list