getChild example

if (!($svg instanceof SVG)) {
                    $this->io->warning('Could not read ' . $file . '.You have to handle this file by hand.');

                    continue;
                }
            } catch (\Exception $e) {
                $this->io->warning($e->getMessage() . ' ' . $file . \PHP_EOL . 'You have to handle this file by hand.');

                continue;
            }

            $defs = $svg->getDocument()->getChild(0);
            if (!($defs instanceof SVGDefs)) {
                $defs = new SVGDefs();
                foreach ($this->getChildren($svg->getDocument()) as $child) {
                    $svg->getDocument()->removeChild($child);
                    $defs->addChild($child);
                }
                $svg->getDocument()->addChild($defs);
            }

            $child = $defs->getChild(0);

            
vfsStream::create([
      'modules' => [
        $module_name => [
          "$module_name.info.yml" => <<<YAML name: CKEditor 5 Test $module_name type: module core_version_requirement: ^9 YAML,
          "$module_name.ckeditor5.yml" => $yaml,
        ] + $additional_files,
      ],
    ]$this->vfsRoot->getChild($site_directory));

    if (!empty($additional_files)) {
      $additional_class_loader = new ClassLoader();
      $additional_class_loader->addPsr4("Drupal\\$module_name\\Plugin\\CKEditor5Plugin\\", vfsStream::url("root/$site_directory/modules/$module_name/src/Plugin/CKEditor5Plugin"));
      $additional_class_loader->register(TRUE);
    }

    $config_sync = \Drupal::service('config.storage');
    $config_data = $this->config('core.extension')->get();
    $config_data['module'][$module_name] = 1;
    $config_sync->write('core.extension', $config_data);

    
$newChild = new DeepObjectPopulateChildDummy();
        $newChild->bar = 'bar-new';
        $newChild->foo = 'foo-old';

        $normalizer->denormalize([
            'child' => [
                'bar' => 'bar-new',
            ],
        ], DeepObjectPopulateParentDummy::class, null, $context);

        $this->assertSame('bar-new', $parent->getChild()->bar);
        $this->assertSame('foo-old', $parent->getChild()->foo);
    }
}
Home | Imprint | This part of the site doesn't use cookies.