Thursday, 15 April 2010

yii - RESTful expand by default -


How can I return model relations without increasing the parameters in the URL? I tried to add some code to the model

  public function field () {$ fields = parent :: fields (); $ Field ['profile'] = $ this- & gt; Profile; Return $ field; }  

but I'm getting the error:

  call_user_func () parameter 1 is expected to be a valid callback, no array or string is given  

This method works:

  $ _ GET ['extension'] = 'profile';  

But this is a bad solution.

try it

  public function fields () {$ fields = Parent :: fields (); $ Field [] = 'profile'; Return $ field; }  

Make sure that you've set the relationship worked for me


No comments:

Post a Comment