Call to a member function getTemplateVars() on null