$customer = Customer::findOne(123);
$order = new Order();
/// ....
$order->save();
$order->link('customer', $customer);
how to make sure that $order->link('customer', $customer); have worked?
And how to make these two requests are fulfilled, and not one of them?
"Unable to link models: the models being linked cannot be newly created."
$user = User::findOne(Yii::$app->user->id);
$truck = new Truck();
$truck->load(Yii::$app->getRequest()->getBodyParams(), ");
$truck->link('users', $user);
if ($this->getIsNewRecord() && $model->getIsNewRecord()) {
throw new InvalidCallException('Unable to link models: at most one model can be newly created.');
}
commented on June 10th 19 at 15:35Find more questions by tags Yii
convert in beforeValidate - Henderson_Beat commented on June 10th 19 at 15:36