# Model Collation

**URL:** <https://forum.shopware.com/t/model-collation/18060>\
**Category:** Shopware 3.5\
**Tags:** programming\
**Created:** [29. Januar 2014 um 11:30 UTC](https://forum.shopware.com/t/model-collation/18060 "2014-01-29T11:30:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jauert](https://avatars.discourse-cdn.com/v4/letter/j/c6cbf5/32.png) [@jauert](https://forum.shopware.com/u/jauert)\
**Post date:** [29. Januar 2014 um 11:30 UTC](https://forum.shopware.com/t/model-collation/18060/1 "2014-01-29T11:30:19Z")

</div>

Moin Forum, bin gerade dabei über Doctrine eine Tabelle anzulegen. Funktioniert soweit auch gut. Da es aber JOINS mit anderen Tabellen gibt, entsteht ein Problem mit der Kollation. Die Shopware eigenen Tabellen sind in utf8\_unicode\_ci angelegt und die, welche ich über das Model anlegen möchte, wird in utf8\_general\_ci erzeugt. Im Model habe ich bereits versucht per “options” die Tabelle richtig zu erzeugen aber leider hat es nicht funktioniert: ` /\*\* \*... \* @ORM\Table(name="muster", options={"collate"="utf8\_unicode\_ci"}) \*/ ` Damit ich erst einmal arbeiten kann, lege ich die Tabelle per SQL an aber elegant ist das natürlich nicht. Wenn jemand etwas Kode benötigt, hier sind die Problemzonen: Bootstrap ` $em = $this-\>Application()-\>Models(); $tool = new \Doctrine\ORM\Tools\SchemaTool($em); $classes = array( $em-\>getClassMetadata('Shopware\CustomModels\Demo\Demo') ); try { $tool-\>createSchema($classes); } catch (\Doctrine\ORM\Tools\ToolsException $e) { // ignore } ` Model ` namespace Shopware\CustomModels\Demo; use Shopware\Components\Model\ModelEntity, Doctrine\ORM\Mapping AS ORM, Symfony\Component\Validator\Constraints as Assert, Doctrine\Common\Collections\ArrayCollection; /\*\* \* Shopware\CustomModels\Demo\Demo \* \* @ORM\Entity(repositoryClass="Repository") \* @ORM\Table(name="demo", options={"collate"="utf8\_unicode\_ci"}) \* @ORM\HasLifecycleCallbacks \*/ class Exclude extends ModelEntity ` Freue mich auf Lösungsvorschläge.

---

<div class="post-metadata">

**Author:** ![Almare](https://avatars.discourse-cdn.com/v4/letter/a/a87d85/32.png) [@Almare](https://forum.shopware.com/u/Almare)\
**Post date:** [14. Februar 2014 um 14:46 UTC](https://forum.shopware.com/t/model-collation/18060/2 "2014-02-14T14:46:39Z")

</div>

Das Modell sollte so installiert werden ` $em-\>getClassMetadata('Shopware\CustomModels\Demo\Exclude')` und nicht `$em-\>getClassMetadata('Shopware\CustomModels\Demo\Demo')` Dann sollte es gehen.

---

<div class="post-metadata">

**Author:** ![jauert](https://avatars.discourse-cdn.com/v4/letter/j/c6cbf5/32.png) [@jauert](https://forum.shopware.com/u/jauert)\
**Post date:** [20. Juni 2014 um 23:16 UTC](https://forum.shopware.com/t/model-collation/18060/3 "2014-06-20T23:16:45Z")

</div>

Danke für den Tipp, werde ich mal versuchen. Aber wenn ich jetzt an andere symfony Projekte denke, kann ich unter …/Demo/ ja auch noch andere entities ablegen neben Demo. Das sollte doch dann auch gehen? Bestes Beispiel sind die ganzen Article entities. Gesendet von meinem iPhone mit Tapatalk

---

<div class="post-metadata">

**Author:** ![jauert](https://avatars.discourse-cdn.com/v4/letter/j/c6cbf5/32.png) [@jauert](https://forum.shopware.com/u/jauert)\
**Post date:** [20. Juni 2014 um 23:19 UTC](https://forum.shopware.com/t/model-collation/18060/4 "2014-06-20T23:19:02Z")

</div>

Ich erzähle Unsinn. Du hast recht. Habe erst geschrieben dann gelesen. Gesendet von meinem iPhone mit Tapatalk
