user1679267
user1679267

Reputation: 77

Symfony2: accessing parameter.yml in view ( php template )

am using following parameters.yml

parameters:
    mailer_transport: smtp
    mailer_host: 127.0.0.1
    mailer_user: null
    mailer_password: null
    locale: en
    secret: ThisTokenIsNotSoSecretChangeIt
    name: krishnakumar 

but when an trying to access the parameter like the below

<?php echo $view->container->parameters['name']; ?>

this throwing an error

Error: Cannot access private property appProdDebugProjectContainer::$parameters

Upvotes: 1

Views: 313

Answers (1)

Tomasz Madeyski
Tomasz Madeyski

Reputation: 10890

Try this one:

<?php echo $view->container->getParameter('name'); ?>

Upvotes: 2

Related Questions