Imagine I have an Article entity.
And in this entity have a report attribute which is an json_array type.
Json_array's data may like
{"key1":"value1","key2":{"k1":"v1","k2","v2"...},"key3":["v1","v2","v3"...]...}.
I mean the json_array may contains simple key:value
or the value may also contains key:vaule
or the value may an array.
Now I don't know how to use symfony form to render and save these json_array like other normal attribute(e.g.,title).
At the same time,I want to manage the key label name with an meaning name just like change the title field's label.
How to achieve this,I feel very difficult.
class Article
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="title", type="string", length=255)
*/
private $title;
/**
* @var array
*
* @ORM\Column(name="report", type="json_array")
*/
private $report;
}
key1,key2, etc. when editing the form? As in: when the user adds report fields, when editing the article the report fields will have the label the customer filled in him/herself?