Giter Site home page Giter Site logo

Comments (7)

flomerz avatar flomerz commented on July 3, 2024 1

+1
I also want to know how to do this.

For now I use:

$this->get('comet_cult_braintree.factory');
\Braintree_ClientToken::generate()

The factory call is essential to load the configs.

from cometcultbraintreebundle.

marianflorin avatar marianflorin commented on July 3, 2024 1

@grEvenX - This solution doesn't work, at least for me. From what I tested the calls in https://github.com/cometcult/CometCultBraintreeBundle/blob/4621db02708e2ad1c65733d3dd3cb6e538d7e510/DependencyInjection/CometCultBraintreeExtension.php are executed only when the Symfony cache is generated. These calls are setting a PHP static variable, so they should be executed on every page load. What worked for me was to override the boot method in app/AppKernel.php file, like below:

public function boot()
{
parent::boot();

\Braintree_Configuration::environment($this->getContainer()->getParameter('braintree.environment'));
\Braintree_Configuration::merchantId($this->getContainer()->getParameter('braintree.merchant_id'));
\Braintree_Configuration::publicKey($this->getContainer()->getParameter('braintree.public_key'));
\Braintree_Configuration::privateKey($this->getContainer()->getParameter('braintree.private_key'));
}

from cometcultbraintreebundle.

mamartins avatar mamartins commented on July 3, 2024

+1

from cometcultbraintreebundle.

grEvenX avatar grEvenX commented on July 3, 2024

Can any of you confirm if the solution in #12 is ok for you (@mamartins, @flomerz, @scyrma) ?

from cometcultbraintreebundle.

mamartins avatar mamartins commented on July 3, 2024

yes, I can call the method, and I have to do so in many functions that do not have factory, and sometimes even with some that do have factory but require parameters

from cometcultbraintreebundle.

grEvenX avatar grEvenX commented on July 3, 2024

@mamartins I mean with change I added in 4621db0, are you able use the code without having to get the factory before calling the static methods.

You should now be able to just call the following code as long as the CometCultBraintreeBundle is loaded:

\Braintree_ClientToken::generate()

from cometcultbraintreebundle.

mamartins avatar mamartins commented on July 3, 2024

ah, sorry. yes! :)

but I was before because I am injecting the factory in some services so the settings are loaded to the hole app.

from cometcultbraintreebundle.

Related Issues (9)

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.