# sw-switch-field int / bool - This value should be of type int

**URL:** <https://forum.shopware.com/t/sw-switch-field-int-bool-this-value-should-be-of-type-int/59939>\
**Category:** Programmierung\
**Created:** [10. Juni 2019 um 10:09 UTC](https://forum.shopware.com/t/sw-switch-field-int-bool-this-value-should-be-of-type-int/59939 "2019-06-10T10:09:02Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shopwareianer](https://avatars.discourse-cdn.com/v4/letter/s/b4bc9f/32.png) [@Shopwareianer](https://forum.shopware.com/u/Shopwareianer)\
**Post date:** [10. Juni 2019 um 10:09 UTC](https://forum.shopware.com/t/sw-switch-field-int-bool-this-value-should-be-of-type-int/59939/1 "2019-06-10T10:09:02Z")

</div>

Ich stehe gerade auf dem Schlauch - Ich nutze für ein active field tinyint( `active` TINYINT DEFAULT 0 ) in der DB sowie&nbsp;auch die Core Platform Plugins.

Das&nbsp;[sw-switch-field](https://component-library.shopware.com/#/components/sw-switch-field) gibt true/false zurück. true/false aber ist ja praktisch nur ein synonym für&nbsp;tinyint(1) / (0) in MySQL.

In meiner Entityclass nutze ich ebenfalls int

```
/**
* @var int
*/
protected $active;

```

Wenn ich nun aber in meinre Vue Component speichern will bekomme ich den Fehler “detail:&nbsp;“This value should be of type int.”” zurück. Kann mir jemand sagen, was ich hier übersehe?

---

<div class="post-metadata">

**Author:** ![shyim](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/shyim/32/7681_2.png) [@shyim](https://forum.shopware.com/u/shyim)\
**Post date:** [10. Juni 2019 um 10:34 UTC](https://forum.shopware.com/t/sw-switch-field-int-bool-this-value-should-be-of-type-int/59939/2 "2019-06-10T10:34:09Z")

</div>

Ist das Feld ein Boolean Feld in der EntityDefinition?

---

<div class="post-metadata">

**Author:** ![Shopwareianer](https://avatars.discourse-cdn.com/v4/letter/s/b4bc9f/32.png) [@Shopwareianer](https://forum.shopware.com/u/Shopwareianer)\
**Post date:** [10. Juni 2019 um 11:02 UTC](https://forum.shopware.com/t/sw-switch-field-int-bool-this-value-should-be-of-type-int/59939/3 "2019-06-10T11:02:48Z")

</div>

> [@Shyim schrieb:](https://forum.shopware.com/profile/20792/Shyim "Shyim")
> 
> Ist das Feld ein Boolean Feld in der EntityDefinition?

Auch ein Int:&nbsp;

```
new IntField('active', 'active'), 

```

&nbsp;

---

<div class="post-metadata">

**Author:** ![shyim](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/shyim/32/7681_2.png) [@shyim](https://forum.shopware.com/u/shyim)\
**Post date:** [10. Juni 2019 um 11:24 UTC](https://forum.shopware.com/t/sw-switch-field-int-bool-this-value-should-be-of-type-int/59939/4 "2019-06-10T11:24:39Z")

</div>

Du brauchst&nbsp;new BoolField(‚active‘, ‚active‘)

---

<div class="post-metadata">

**Author:** ![Shopwareianer](https://avatars.discourse-cdn.com/v4/letter/s/b4bc9f/32.png) [@Shopwareianer](https://forum.shopware.com/u/Shopwareianer)\
**Post date:** [10. Juni 2019 um 11:27 UTC](https://forum.shopware.com/t/sw-switch-field-int-bool-this-value-should-be-of-type-int/59939/5 "2019-06-10T11:27:43Z")

</div>

> [@Shyim schrieb:](https://forum.shopware.com/profile/20792/Shyim "Shyim")
> 
> Du brauchst&nbsp;new BoolField(‚active‘, ‚active‘)

Okay, dass war es. Vielen Dank. Etwas verwirrend ![Angry-Face](https://europe1.discourse-cdn.com/flex013/uploads/shopware/original/1X/4d894c4dd47121f4ab1fba0317660ce0f6dbd4be.png "Angry-Face")&nbsp;
