Twig accessing protected/private model variables
问题 I have a problem with Twig, (in fact this is not really a problem but it's disturbing to me) I have a Post model class in php and i have some protected variables (I also tried with private ). To acces them I have a public function in php getMyVariable . If in my controller I try to echo the protected variable it throz me an error Cannot access protected property... so I have to use the function to echo my variable. This is totally normal and this is what I want But, then I try to render it in