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()
?– Marcelo de Andrade
That, or if there’s an easier way
– Nelson Willian
What error is being displayed? How are you calling the
API
?– Marcelo de Andrade
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, ]); }
– Nelson Willian