Comments (7)
+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.
@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.
+1
from cometcultbraintreebundle.
Can any of you confirm if the solution in #12 is ok for you (@mamartins, @flomerz, @scyrma) ?
from cometcultbraintreebundle.
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.
@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.
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cometcultbraintreebundle.