@Override
public void apply(ICompletionReporter reporter) {
try {
TemplateVariableCompletionContext ctxt = (TemplateVariableCompletionContext) getContext();
SymfonyModelAccess model = SymfonyModelAccess.getDefault();
ISourceModule module = ctxt.getSourceModule();
IType controller = model.findControllerByTemplate(module);
List<TemplateField>variables = model.findTemplateVariables(controller);
String viewPath = PathUtils.createViewPathFromTemplate(ctxt.getSourceModule(), true);
SourceRange range = getReplacementRange(ctxt);
// prepend the php dollar variable for the equals check
String prefix = "$" +ctxt.getPrefix();
for(TemplateField element : variables) {
if (viewPath.equals(element.getViewPath()) && CodeAssistUtils.startsWithIgnoreCase(element.getElementName(), prefix)) {
reporter.reportField(new FakeField(element, element.getElementName(), Modifiers.AccPublic), "", range, true);