H
H
hollanditkzn2017-05-15 11:43:07
Yii
hollanditkzn, 2017-05-15 11:43:07

How to pass id to model functions?

Is it possible to pass id in the model somehow? or not. For example, in the controller, passing id to the getter is acceptable and, accordingly, it happened without errors. I get this error Calling unknown method: app\models\Notification::byIdUser()
Here is the model

public function getByIdUser($id)
    {
        $zakaz = new Zakaz();
        $notification->id_user = $id;
        $notification->name = 'Доставка '.$model->description;
        $notification->id_zakaz = $zakaz->id_zakaz;
    }

In the controller
$notification->byIdUser(7);
$notification->byIdUser(7);

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Timofeev, 2017-05-15
@hollanditkzn

If it is the id of the current user, that is:
But your function returns nothing. It is basically meaningless.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question