Use expand in actionMyfunction()

I am developing REST API and I have an action Myfunction() and i wand to use expand
Here is my code

public function actionMyfunction() {
 $query = $this->model::find();
  return $query

My Model is

 public function fields() {
    return [

public function extraFields() {
     return ['status'];

This url not working for me


@samdark will you help ?

Maybe i could help you. :slight_smile:

What do you get there? a 404 ?

Have you enabled prettyUrls?

Have you checked yii-debug ?

Here is explained, how you could use it :

From which Controller are you extending ?

yii/web/controller or yii/rest/controller?

1 Like

Extend from yii/rest/controller ActiveController

Can you answer my other questions? :slight_smile:

yes i am using pretty url and debugging

does it work without params?


with or without param its give one result. Not give status

if status is just a db field or property and not a model relation, then it won’t work because extraFields() is used to return data from a relation.

1 Like