3

I need to view, create and edit json keys and values ​​in easyadmin. Unfortunately, I can only add value. Is it possible to display and edit a key and its value?

My easy admin version : 3.5.16

My Crud Controller

class TestCrudController extends AbstractCrudController {

public static function getEntityFqcn(): string
{
    return Test::class;
}

public function configureFields(string $pageName): iterable
{
    return [
        IdField::new('id')->hideOnForm(),
        TextField::new('name'),
        ArrayField::new('json'),
    ];
}

public function createEntity(string $entityFqcn)
{
   $test = new Test();

   $test->setJson([
       "Hight" => "134 mm",
       "Width" => "13 mm"
       ]);

   return $test;
}

Displayed by easy admin:

After adding a new one the element in the array. Key has the value "NaN"

  • maybe use custom fields [https://symfony.com/bundles/EasyAdminBundle/1.x/book/edit-new-configuration.html#customizing-the-form-fields] – nicolas chauvire Dec 14 '21 at 14:09

0 Answers0