# Could not insert data.

**URL:** <https://forum.shopware.com/t/could-not-insert-data/71623>\
**Category:** Shopware 3.5\
**Tags:** programming\
**Created:** [18. Dezember 2020 um 09:26 UTC](https://forum.shopware.com/t/could-not-insert-data/71623 "2020-12-18T09:26:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![zan](https://avatars.discourse-cdn.com/v4/letter/z/48db29/32.png) [@zan](https://forum.shopware.com/u/zan)\
**Post date:** [18. Dezember 2020 um 09:26 UTC](https://forum.shopware.com/t/could-not-insert-data/71623/1 "2020-12-18T09:26:21Z")

</div>

I am working on inserting the data to the table. I have provided every data but still it gives me value should not be blank message.

So this is my generated sql table:

&nbsp;

> $connection-\>executeUpdate(’ CREATE TABLE IF NOT EXISTS `swag_bundle` ( `id` BINARY(16) NOT NULL, `discount_type` VARCHAR(255) NOT NULL, `discount` DOUBLE NOT NULL, `created_at` DATETIME(3) NOT NULL, `updated_at` DATETIME(3) NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4\_unicode\_ci; ');

Now from the controller I am trying to insert data.

&nbsp;

> $data = ; for ($i = 0; $i \< 1; $i++) { $data = [‚id‘ =\> Uuid::randomHex(), ‚discount\_type‘ =\> $faker-\>name, ‚discount‘ =\> $faker-\>randomFloat(2, 2, 50), ‚created\_at‘ =\> ‚2020-12-24 14:20:12‘, ‚updated\_at‘ =\> ‚2020-12-24 14:20:12‘,]; }
> 
> $this-\>bundleRepository-\>create($data, $context); return new Response(‚‘, Response::HTTP\_NO\_CONTENT);

&nbsp;

I am getting an annoying error:

&nbsp;

> {
> 
> „errors“: [
> 
> {
> 
> „code“: „c1051bb4-d103-4f74-8988-acbcafc7fdc3“,
> 
> „status“: „400“,
> 
> „detail“: „This value should not be blank.“,
> 
> „template“: „This value should not be blank.“,
> 
> „meta“: {
> 
> „parameters“: {
> 
> „{{ value }}“: „null“
> 
> }
> 
> },
> 
> „source“: {
> 
> „pointer“: „/0/discountType“
> 
> }
> 
> }
> 
> ]
> 
> }

---

<div class="post-metadata">

**Author:** ![Krispin](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/krispin/32/12849_2.png) [@Krispin](https://forum.shopware.com/u/Krispin)\
**Post date:** [18. Dezember 2020 um 09:53 UTC](https://forum.shopware.com/t/could-not-insert-data/71623/2 "2020-12-18T09:53:14Z")

</div>

Hi zan,

have a look into the definition file. You have to use the `propertyName` and not the `storageName` of the fields, if you want to add data via the repositories.  
E.g. `discountType` and not like you `discount_type`.

Best Regards

Krispin
