generated factories not working properly

Notice: This thread is very old.

7 years ago

bazo
Member | 625
+
0
-

until now i have used the following entries in config.neon to define the generated factories

config.neon

embeddedMedia:
  class: Components\EmbeddedMedia
  implement: Components\IEmbeddedMediaFactory
  arguments: [%snippet%]

factory interface

<?php

namespace Components;

use Design\Snippets\MultimediaEmbedSnippet;
use Nette\Application\Application;

/**
 * IEmbeddedmediaFactory
 */
interface IEmbeddedMediaFactory {

    /** @return EmbeddedMedia */
    public function create(MultimediaEmbedSnippet $snippet);
}

until now it works perfectly, commit 3e4e4177343cc542acff12544a952c62de5770ee breaks this functionality

the container looks for %snippet% in the $params array of container

as hosiplan pointed out the snippet should be a parameter not an argument, but when i change it, it doesn't work either.

so either it was broken until now and it worked just by chance, or it broken now

7 years ago

Filip Procházka
Moderator | 4693
+
0
-

Current proper way of configuring generated factory is

embeddedMedia:
  class: Components\EmbeddedMedia(%snippet%)
  implement: Components\IEmbeddedMediaFactory
  parameters: [Design\Snippets\MultimediaEmbedSnippet snippet]

Related: https://github.com/…e/issues/873

7 years ago

bazo
Member | 625
+
0
-

thanks, it works.

somebody should add this to the documentation