mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-15 22:09:48 +08:00
Fixed a wrong method calling.
If using `all()`, the value of `$customer` will be an array of
`Customer` instances, not a `Customer` instance. Consequently,
```
$customer->unlink('orders', $customer->orders[0]);
```
will throw a PHP Fatal Error: Call to a member function unlink() on array.
This commit is contained in:
@@ -1221,7 +1221,7 @@ The opposite operation to [[yii\db\ActiveRecord::link()|link()]] is [[yii\db\Act
|
||||
which breaks an existing relationship between two Active Record instances. For example,
|
||||
|
||||
```php
|
||||
$customer = Customer::find()->with('orders')->all();
|
||||
$customer = Customer::find()->with('orders')->one();
|
||||
$customer->unlink('orders', $customer->orders[0]);
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user