I am starting a symfony4 project, and I learned the "parameters.yaml" is now "sevice.yaml".
I setted some variables inside like:
parameters:
smugmug.oauth_token: 'XXX'
smugmug.oauth_token_secret: 'XXX'
And i try to access it from my controller like:
dump($this->container->get('smugmug.oauth_token'));
But I have an error...
How does this new way of storing global variables is working?
I think you have forgotten to extend the Controller class
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
class ArticleController extends Controller
{
public function controlAction()
{
// ...
dump($this->container->getParameter('smugmug.oauth_token'));
// Or this solution
dump($this->getParameter('smugmug.oauth_token'));
// ...
// return a response
}
}