DemodataContext example

 {
    }

    public function generate(DemodataRequest $request, Context $context, ?SymfonyStyle $console): DemodataContext
    {
        if (!$console) {
            $console = new ShopwareStyle(new ArgvInput()new NullOutput());
        }

        $faker = $this->getFaker();

        $demodataContext = new DemodataContext($context$faker$this->projectDir, $console$this->registry);

        foreach ($request->all() as $definitionClass => $numberOfItems) {
            if ($numberOfItems === 0) {
                continue;
            }

            $definition = $this->registry->get($definitionClass);

            $console->section(sprintf('Generating %d items for %s', $numberOfItems$definition->getEntityName()));

            $validGenerators = array_filter(iterator_to_array($this->generators)static fn (DemodataGeneratorInterface $generator) => $generator->getDefinition() === $definitionClass);

            
Home | Imprint | This part of the site doesn't use cookies.