Coder Social home page Coder Social logo

[Insight] The Symfony Dependency Injection Container should not be passed as an argument - in Decoda/Hook/EmoticonHook.php, line 56 about fmbbcodebundle HOT 4 CLOSED

helios-ag avatar helios-ag commented on June 3, 2024
[Insight] The Symfony Dependency Injection Container should not be passed as an argument - in Decoda/Hook/EmoticonHook.php, line 56

from fmbbcodebundle.

Comments (4)

alquerci avatar alquerci commented on June 3, 2024

There is a good reason to inject the container because we need them to replace placeholders [ref] like on the Symfony\Bundle\FrameworkBundle\Routing\Router [ref].

from fmbbcodebundle.

helios-ag avatar helios-ag commented on June 3, 2024

Another approach is to inject parameters directly, so we can process them inside hook. Yaml file can be read by Yaml\Parser. What is your opinion, @alquerci ?

from fmbbcodebundle.

alquerci avatar alquerci commented on June 3, 2024

inject parameters directly

Indeed here we just need of all container parameters but it is not possible to inject all of them.

Yaml file can be read by Yaml\Parser.

I do not understand you idea with this sentence. A parser can only parse and do not anything else.

This is the exception to the rule of not injecting the container.

The behind feature is a way to use all container parameters to avoid duplicate configuration like shown on the README:

# path/to/emoticons.yml
imports:
  - { resource: path/to/another/emoticons.yml }

emoticons:
  my_emoticon:
    url:   # Default: %fm_bbcode.emoticon.path%/my_emoticon.png
    html:  # Default: <img src="%fm_bbcode.emoticon.path%/my_emoticon.png" alt="" >
    xHtml: # Default: <img src="%fm_bbcode.emoticon.path%/my_emoticon.png" alt="" />
    smilies:
      - ":my_emoticon:"

In order to keep back compatibility we cannot remove this feature.

But it's possible that is only useful to resolve the fm_bbcode.emoticon parameter namespace. In that case we can inject only all needed parameters to resolve them for the next major version (it is a regression).

from fmbbcodebundle.

helios-ag avatar helios-ag commented on June 3, 2024

I do not understand you idea with this sentence. A parser can only parse and do not anything else.

My idea was to address emoticon file via fm_bbcode.emoticon parameter, and then process it, so we were able to avoid inject whole container.

This is the exception to the rule of not injecting the container.

Ok i got it.

from fmbbcodebundle.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.