If you want to use a method .getType() in a template, such as Media.getType(), do not write it as variable.type, because variable.type in templates seems to mean something different, the name of the class of variable. To call the method, always use the long version variable.getType().