Transform record before import to database
I wish to store a list of CSV columns as a JSON object in a single column of database. What is the best way to do it?
I want to store the following 3 columns of CSV:
price
, quantity
, and brokerage
as a JSON object in the data
column of the record. I've tried setting the value in beforeFill
as below, but it doesn't work.
Solution:Jump to solution
Managed to solve it by appending the following code at the end of
beforeFill
:
```php
if ($this->record) {
$this->record->data = $this->data['data'];
}...1 Reply
Solution
Managed to solve it by appending the following code at the end of
beforeFill
: