Hallo,
ich habe mit dem extension builder eine extension "geschrieben" (eher zusammengeklickt) die mir ein Blog-Beispiel macht. ich kann einen blognamen, einen post, kommentare und tags setzen. zusätzlich habe ich ein mapping auf eine von mir erstellte tabelle gesetzt aus der ich einen oder mehrere autoren wählen kann.
im backend funktionier auch alles super, nur im frontend werden dann nur die ids der autoren angezeigt.
das beispiel anhand dess ich das ganze gemacht habe ist:
http://de.slideshare.net/t3node/t3con11-lazy-development-using-the-extension-builder
nun bekomme ich im frontend wirklich alle möglichen daten, aber keine namen zu den ausgewählten autoren..
habe folgende controller:
BlogController.php
AuthorrelationController.php
und natürlich die zugehörigen models und repositories (wobei die repos leer sind bis auf die extends zeile)
im frontend erhalte ich alle daten durch den blogcontroller den ich mit {blog} debuggen (<f:debug>{_all}</f:debug>) kann. da sehe ich auch nahezu alles was ich brauche, bis auf die autorennamen.
mit
<f:for each="{blog.authorRelation}" as="child" key="count">
<f:render partial="Authorrelation/Properties" arguments="{authorrelation:authorrelation}" />
<AutorenNamen:publisher object="{child.uid}" /><br />
</f:for>
bekomme ich dann 1,3,1 als ausgabe, wie kriege ich jetzt die zugehörigen namen da rein?
hoffe ihr könnt mir helfen
liebe grüße
Alissa
ps: noch ein bild vom debugger:
Bild: s7.directupload.net/…/sy2m7oiz.png

Es wäre wichtig Dein Domainmodel zu kennen. Ich weiß z.B. nicht was Authorrelation ist. Da müsste ja der Author dranhängen...
Hallo kitsunet,
das was der extension builder gebaut hat, leer. also classes\domain\model\authorrelation.php ist bis auf die extends leer.
der authorrelationcontroller beeinhaltet folgendes:
/**
* authorrelationRepository
*
* @var \TYPO3\Publisher\Domain\Repository\AuthorrelationRepository
* @inject
*/
protected $authorrelationRepository;
/**
* action list
*
* @return void
*/
public function listAction() {
$authorrelations = $this->authorrelationRepository->findAll();
$this->view->assign('authorrelations', $authorrelations);
}
/**
* action show
*
* @param \TYPO3\Publisher\Domain\Model\Authorrelation $authorrelation
* @return void
*/
public function showAction(\TYPO3\Publisher\Domain\Model\Authorrelation $authorrelation) {
$this->view->assign('authorrelation', $authorrelation);
}
/**
* action new
*
* @param \TYPO3\Publisher\Domain\Model\Authorrelation $newAuthorrelation
* @dontvalidate $newAuthorrelation
* @return void
*/
public function newAction(\TYPO3\Publisher\Domain\Model\Authorrelation $newAuthorrelation = NULL) {
$this->view->assign('newAuthorrelation', $newAuthorrelation);
}
/**
* action create
*
* @param \TYPO3\Publisher\Domain\Model\Authorrelation $newAuthorrelation
* @return void
*/
public function createAction(\TYPO3\Publisher\Domain\Model\Authorrelation $newAuthorrelation) {
$this->authorrelationRepository->add($newAuthorrelation);
$this->flashMessageContainer->add('Your new Authorrelation was created.');
$this->redirect('list');
}
und der blogcontroller:
/**
* blogRepository
*
* @var \TYPO3\Publisher\Domain\Repository\BlogRepository
* @inject
*/
protected $blogRepository;
/**
* @var \TYPO3\Publisher\Domain\Repository\authorrelationRepository
* @inject
*/
protected $authorrelationRepository;
/**
* action list
*
* @return void
*/
public function listAction() {
$blogs = $this->blogRepository->findAll();
$this->view->assign('blogs', $blogs);
}
/**
* action show
*
* @param \TYPO3\Publisher\Domain\Model\Blog $blog
* @return void
*/
public function showAction(\TYPO3\Publisher\Domain\Model\Blog $blog) {
$this->view->assign('blog', $blog);
}
/**
* action new
*
* @param \TYPO3\Publisher\Domain\Model\Blog $newBlog
* @dontvalidate $newBlog
* @return void
*/
public function newAction(\TYPO3\Publisher\Domain\Model\Blog $newBlog = NULL) {
$this->view->assign('newBlog', $newBlog);
}
/**
* action create
*
* @param \TYPO3\Publisher\Domain\Model\Blog $newBlog
* @return void
*/
public function createAction(\TYPO3\Publisher\Domain\Model\Blog $newBlog) {
$this->blogRepository->add($newBlog);
$this->flashMessageContainer->add('Your new Blog was created.');
$this->redirect('list');
}
/**
* action edit
*
* @param \TYPO3\Publisher\Domain\Model\Blog $blog
* @return void
*/
public function editAction(\TYPO3\Publisher\Domain\Model\Blog $blog) {
$this->view->assign('blog', $blog);
}
/**
* action update
*
* @param \TYPO3\Publisher\Domain\Model\Blog $blog
* @return void
*/
public function updateAction(\TYPO3\Publisher\Domain\Model\Blog $blog) {
$this->blogRepository->update($blog);
$this->flashMessageContainer->add('Your Blog was updated.');
$this->redirect('list');
}
/**
* action delete
*
* @param \TYPO3\Publisher\Domain\Model\Blog $blog
* @return void
*/
public function deleteAction(\TYPO3\Publisher\Domain\Model\Blog $blog) {
$this->blogRepository->remove($blog);
$this->flashMessageContainer->add('Your Blog was removed.');
$this->redirect('list');
}
irgendwie habe ich den zusammenhang zwischen controller, model und repository noch nicht ganz raus oder bin einfach zu blind, denn wie gesagt, im backend funktioniert das genau so wie es soll.
AutorRelationController finde ich macht für eine Relation wenig sind. Zumindest finde ich die Bezeichnung verwirrend, es handelt sich um ein Autoren, die einem Blog zugeordnet sind. Wie hast Du die Relation denn im Extension Builder gemacht? In dem Artikel Model fehlen ObjectStorages, was die Autoren sein sollten. Ich würde sagen Du machst die Relation nochmal ordentlich im Extension Builder und schaust Dir dann nochmal die Models an.
wie das ganze im extension builder aussieht, habe ich mal dazugepackt als bild-anhang.
edit: habe gerade eine neue extension geschrieben, anscheinend waren wirklich nur die relationen falsch gesetzt... jetzt funktioniert alles :S
habt vielen dank für den tipp mit den relationen
