Open
Description
Hello,
I have this error:
Argument 1 passed to yii2mod\cart\Cart::add() must be an instance of yii2mod\cart\models\CartItemInterface
is in this method:
public function add(CartItemInterface $element, $save = true): self
I follow the doc and configured the extension in correct way:
'cart' => [
'class' => 'yii2mod\cart\Cart',
// you can change default storage class as following:
'storageClass' => [
'class' => 'yii2mod\cart\storage\DatabaseStorage',
// you can also override some properties
'deleteIfEmpty' => true
]
],
Then in my controller, just this simple code:
public function actionCart()
{
$cart = \Yii::$app->cart;
$cart->add(2);
}
I tried to:
- Remove configuration in main.php and is not working because configuration are missing, so mean is correctly configurate
- implement CartItemInterface in controller
- implement add() method in model and call from controller
- I try to pass in method integer, array and string
Where I am wrong?
Thank you
Metadata
Metadata
Assignees
Labels
No labels