Fix $this/self:: errors and  add PHPDoc to model template