1

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

user1679267
  • 77
  • 2
  • 8
  • Why not get the parameter in your controller function, and then just pass it to the view? This would offer more flexibility. – Rooneyl Feb 17 '15 at 11:16

1 Answers1

2

Try this one:

<?php echo $view->container->getParameter('name'); ?>
Tomasz Madeyski
  • 10,742
  • 3
  • 50
  • 62