Git Product home page Git Product logo

Comments (5)

schmittjoh avatar schmittjoh commented on August 28, 2024

There are tests for this.

If you think it is not working please try to add a failing, reproducible test case.

from jmsdiextrabundle.

schmittjoh avatar schmittjoh commented on August 28, 2024

Closing as no further feedback was provided.

from jmsdiextrabundle.

stevelacey avatar stevelacey commented on August 28, 2024

For anyone else experiencing this problem; I never solved it, and don't have the time to test, it's easy enough to work around, I've just avoided using customised automatic injection.

from jmsdiextrabundle.

stevelacey avatar stevelacey commented on August 28, 2024

Having tried to use this another another unrelated project, I'm still convinced they're broken.

Attempted to run the tests on the bundle, but I couldn't get them working, whilst PHPUnit is not something I'm that familiar with– amongst the errors was "missing JMS\DiExtraBundle\Finder\ServiceFinder in PerformanceTest", which doesn't seem to exist in the bundle, I searched the entire project.

Either way, the chances of me understanding this and debugging the problem is slim, DI is hard– I just wanted to report what I think is a problem.

from jmsdiextrabundle.

stevelacey avatar stevelacey commented on August 28, 2024

I just worked out why I couldn't get this working, I was using it completely wrong, I expected this functionality to build on the magic that happens when you do:

public function indexAction(Request $request) {}

So that I could simply do:

public function indexAction(MyAPIClient $api_client, Request $request) {}

As opposed to simply populating properties set on the class.

protected $api_client

public function indexAction(Request $request) {
    var_dump($api_client); // my service
}

I think I mostly fell into this because the example provided in http://jmsyst.com/bundles/JMSDiExtraBundle/master/configuration#automatic-controller-injections is for @request and @router, where @request you'd typically use in a controller as above rather than inject it to a property

It wasn't until I recently read through the tests that I worked out how this was meant to be used, perhaps this could be made clearer in the documentation.

from jmsdiextrabundle.

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.