Yii2 Rest cannot send the field Name of another Table

Asked

Viewed 46 times

1

How do I submit the name of the Employee that is in the Employees table to appear in a request REST?

I’m new, he shows up in the view I tested, but I can’t find the right way to send by REST.

table Asos has the function and the Employee table has the function And has not FK because it is myIsam.

MODEL

public function getFuncionarios()
{
   return $this->hasMany(Funcionarios::className(),['idFuncionario'=>'idFuncionario']);
}

CONTROLLER

class DefaultController extends ActiveController
{
   public $modelClass = 'app\models\Asos';
}

model -> Bitbucket

Controller -> Bitbucket

  • You want to display the related data by method getFuncionarios()?

  • That, or if there’s an easier way

  • What error is being displayed? How are you calling the API?

  • Nothing appears, just nothing appears, I use the Postman for testing, I am calling this way in the controller public Function actionIndex() { $query = City::find()->with('cTUF'); Return new Activedataprovider([ 'query' => $query, ]); }

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.