---
title: "doppelte datensätze"
url: "https://www.typo3.net/d/109755-doppelte-datensaetze"
source: "typo3.net"
tags: ["Extensions","Extbase","Frage"]
created: "2012-03-12"
last_reply: "2012-03-12"
replies: 0
solved: false
page: 1
pages: 1
lang: "de"
---

# doppelte datensätze

Extensions › Extbase · 0 Antworten · gestartet 2012-03-12

## Eröffnungsbeitrag

**guinness1** · 2012-03-12 · [Beitrag #1](https://www.typo3.net/d/109755-doppelte-datensaetze/1)

Hallo Leute

Ich habe ein ganz gewöhnliches Fluid-Formular. Nach dem Absenden wird das jeweilige Objekt doppelt in die DB geschrieben... kennt jemand dieses Problem?

Fluid Template:

```html
<f:form method="post" action="create" name="newComment" object="{newComment}">
	<div class="comment-item-new-name">
	<f:form.hidden property="contentid" value="{contentid}" />
    <f:form.textbox size="15" property="username" value="Name" />
  </div>
	<div class="comment-item-new-text">
	 <f:form.textarea property="comment" value="Kommentar schreiben..." cols="49" rows="7" />
  </div>
	<f:form.submit value="Absenden" />
</f:form>
```

showallAction (Listet die Kommentare und zeigt das Formular)

```php
        /**
	 * showall action
	 * shows all comments
	 *
	 * @param integer $id
	 * @return void
	 */
	public function showallAction(Tx_PnContentcomments_Domain_Model_Comment $newComment = NULL) {
		$id = intval($this->request->getArgument('id'));
		$comments = $this->commentRepository->findAllByContent($id);
		$count = count($comments);
		$this->view->assign('comments', $comments);
		$this->view->assign('count', $count);
		$this->view->assign('newComment', $newComment);
		$this->view->assign('contentid', $id);
	}
```

createAction:

```php
        /**
	 * action create
	 * creates a new comment
	 *
	 * @param Tx_PnContentcomments_Domain_Model_Comment $newComment
	 * @return void
	 */
	public function createAction(Tx_PnContentcomments_Domain_Model_Comment $newComment) {
		$newComment->setCreatedate(time());
		$this->commentRepository->add($newComment);
		$this->redirect('showall','Comment',null, array('id' => $newComment->getContentid()));
	}
```

Am Ende der createAction findet ein normaler redirect zur showallAction statt. Dort werden die Kommentare aufgelistet und wieder das Formular gezeigt.

Gruss

Oli

---

Quelle: „doppelte datensätze“, typo3.net, https://www.typo3.net/d/109755-doppelte-datensaetze
Beiträge von Mitgliedern des Forums. Bitte mit Link auf die Diskussion zitieren.
