# TypeError in EntityReader with custom entity

**URL:** <https://forum.shopware.com/t/typeerror-in-entityreader-with-custom-entity/99668>\
**Category:** Shopware 6 (German)\
**Created:** [11. Mai 2023 um 18:05 UTC](https://forum.shopware.com/t/typeerror-in-entityreader-with-custom-entity/99668 "2023-05-11T18:05:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![FlorianG](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/floriang/32/13769_2.png) [@FlorianG](https://forum.shopware.com/u/FlorianG)\
**Post date:** [11. Mai 2023 um 18:05 UTC](https://forum.shopware.com/t/typeerror-in-entityreader-with-custom-entity/99668/1 "2023-05-11T18:05:05Z")

</div>

Hallo,

ich hab mir analog zu diesen Tutorials eine custom entity erstellt:

> **[How to create Entity, EntityDefinition, EntityHydrator and EntityCollection...](https://www.matheusgontijo.com/2022/01/27/how-to-create-entity-entitydefinition-entityhydrator-and-entitycollection-in-shopware-6)**
>
> How to create Entity, EntityDefinition, EntityHydrator and EntityCollection in Shopware 6?

> **[How to create repositories in Shopware 6?](https://www.matheusgontijo.com/2022/01/27/how-to-create-a-repository-in-shopware-6)**
>
> How to create repositories in Shopware 6?

Das Schreiben der Daten funktioniert einwandfrei, auch direkten Lesen der Daten via DBAL connection funktioniert.

Wenn ich jedoch mit $this-\>myRepo-\>search(new Criteria()…); Daten lesen möchte oder vom Backend aus auf die Entity zugreife, bekomme ich folgende Fehlermeldung:

```auto
[TypeError]                                                                                                                                                                                               
  Shopware\Core\Framework\DataAbstractionLayer\Dbal\EntityReader::_read(): Argument #4 ($collection) must be of type Shopware\Core\Framework\DataAbstractionLayer\EntityCollection, XXXConnector  
  \Core\Content\AuthNeu\AuthNeuDefinition given, called in /var/www/html/vendor/shopware/core/Framework/DataAbstractionLayer/Dbal/EntityReader.php on line 93       

```

Shopware-Version ist 6.4.20.0

Hab das mehrmals neu erstellt und lande immer wieder bei diesem Fehler.

Danke für eure Hilfe und Grüße  
Florian
