public function testNestedObjects() { $attribute = new Attribute(); $attribute->key = 'nested'; $attribute->value = 'bar'; $attributeParent = new Attribute(); $attributeParent->key = 'parent'; $attributeParent->value = [[$attribute]]; $misc = [$attributeParent]; $foo = new Foo(); $foo->setName('foo'); $foo->setMisc($misc); $manager = self::$kernel->getContainer()->get('doctrine')->getManagerForClass(Foo::class); $manager->persist($foo); $manager->flush(); $manager->clear(); $foo = $manager->find(Foo::class, $foo->getId()); $this->assertEquals($misc, $foo->getMisc()); }