문제

I have had a look around the web and can't find a good explanation.

Using Gii I generate models. I was wondering how I can get the generator to also add a custom method to all of my models I generate? I want to add a method where I pass it the result of a "->queryAll()" and it maps it to itself for me.

Thanks in advance

도움이 되었습니까?

해결책

You should read this :

http://www.yiiframework.com/doc/guide/1.1/en/topics.gii#extending-gii

Gii can be extended in two ways: customizing the code templates of the existing code generators, and writing new code generators.

But a proper way for adding a custom method to all your models is to extends CActiveRecord, and modify Gii template accordingly.

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