commercetools / commercetools-php-symfony

MIT License
10 stars 6 forks source link

Extract UserInterface #27

Closed b3nl closed 7 years ago

b3nl commented 7 years ago

The written AuthenticationProvider is compatible with different "user bundles" like the one from fos. But, we can not use our own implementation for a user, because the real implementation, instead of an interface (which could contain the cart api etc.), of the commercetools user class is checked.

            if ($user instanceof User) {
                $user->setId($customer->getId());
                $cart = $result->getCart();
                if (!is_null($cart)) {
                    $user->setCartId($cart->getId());
                    $user->setCartItemCount($cart->getLineItemCount());
                }
            }

Please extract the added user api to an interface and check against this interface.

jenschude commented 7 years ago

I just extracted the user class to an Interface and changed the checked to the interface.

Would be nice if you could check if this is working using the develop branch