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:
$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.
$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);
I am getting an annoying error:
{
„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“
}
}
]
}