# Datenbankproblem mit Models und EntityManager

**URL:** <https://forum.shopware.com/t/datenbankproblem-mit-models-und-entitymanager/47383>\
**Category:** Programmierung\
**Created:** [8. August 2017 um 06:58 UTC](https://forum.shopware.com/t/datenbankproblem-mit-models-und-entitymanager/47383 "2017-08-08T06:58:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![lcknSimon](https://avatars.discourse-cdn.com/v4/letter/l/898d66/32.png) [@lcknSimon](https://forum.shopware.com/u/lcknSimon)\
**Post date:** [8. August 2017 um 06:58 UTC](https://forum.shopware.com/t/datenbankproblem-mit-models-und-entitymanager/47383/1 "2017-08-08T06:58:47Z")

</div>

Hallo,

wir entwickeln im Moment ein Plugin welches eigene Models verwendet. Associations sind definiert und die Models bereits in der DB.  
Das Problem ist, das Speichern, eines Models nicht hinbekomme.

Ich hab das im Moment so gemacht:

&nbsp;

```
$t = Shopware()->Models()->createQueryBuilder();

		// Get the entity manager
		$entityManager = $this->getEntityManager();

		$step = new \Shopware\CustomModels\SwagVinylKonfigurator\Step();
		$step->setOptions("{}");
		$step->setTitle("TestTitle");
		$step->setDescription("Desc");
		$entityManager->presist($step);
		$entityManager->flush();

```

&nbsp;

```
 Fatal error: Uncaught Error: Call to undefined method Shopware\Components\Model\ModelManager::presist() in /home/vagrant/www/shopware/engine/Shopware/Plugins/Local/Frontend/SwagVinylKonfigurator/Controllers/Frontend/Vinylconfigurator.php on line 28

```

Schnipsel aus der Step Class:

```
	/**
	 * @ORM\OneToMany(targetEntity="Option", mappedBy="step")
	 */
	private $options;

```

Bitten höflichst um Hilfe.

&nbsp;

mfg

&nbsp;

&nbsp;

&nbsp;

&nbsp;

&nbsp;

---

<div class="post-metadata">

**Author:** ![waldicom](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/waldicom/32/12881_2.png) [@waldicom](https://forum.shopware.com/u/waldicom)\
**Post date:** [8. August 2017 um 09:39 UTC](https://forum.shopware.com/t/datenbankproblem-mit-models-und-entitymanager/47383/2 "2017-08-08T09:39:37Z")

</div>

presist() != persist()

---

<div class="post-metadata">

**Author:** ![lcknSimon](https://avatars.discourse-cdn.com/v4/letter/l/898d66/32.png) [@lcknSimon](https://forum.shopware.com/u/lcknSimon)\
**Post date:** [22. August 2017 um 06:27 UTC](https://forum.shopware.com/t/datenbankproblem-mit-models-und-entitymanager/47383/3 "2017-08-22T06:27:49Z")

</div>

Danke (:
