문제

In a view, I've created a function that masks some repeating helper calls.
The problem is that it can't use the $this variable, since it's not in a context. the error is:

Fatal error: Using $this when not in object context
  1. How can I override it?
  2. What is the context in the view? is it the view class?

it's cake 1.3

도움이 되었습니까?

해결책

Seems that it is impossible, it's a language restriction.

The solution was to call the class itself, by using HelperName::method_name() from within the function.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top