Setting up Customer class in the customer-data-framework plugin

Using this guide: https://github.com/pimcore/customer-data-framework/blob/master/doc/02_Installation.md
When I use SSO to register a new customer I get the error:

Blockquote
Type error: Argument 1 passed to CustomerManagementFrameworkBundle\Security\OAuth\OAuthRegistrationHandler::connectSsoIdentity() must implement interface Symfony\Component\Security\Core\User\UserInterface, instance of Pimcore\Model\DataObject\Customer given, called in /var/www/rhinoafrica.com/src/AppBundle/Controller/AuthController.php on line 185

I think it’s because I’m not ‘linking’ my Customer.php with the Pimcore generated Customer.

These are the steps I followed:

  1. Using the example json import, pimcore generates Customer.php (see https://github.com/pimcore/customer-data-framework/blob/master/install/class_source/optional/class_Customer_export.json)
    var/classes/DataObject/Customer.php
namespace Pimcore\Model\DataObject;
class Customer extends \CustomerManagementFrameworkBundle\Model\AbstractCustomer implements \Pimcore\Model\DataObject\DirtyIndicatorInterface {
...
  1. Copied Customer.php from https://github.com/pimcore/customer-data-framework/blob/master/frontend-samples/sso_client/src/AppBundle/Model/Customer.php
namespace AppBundle\Model\DataObject\Data;
use CustomerManagementFrameworkBundle\Model\AbstractCustomer\DefaultAbstractUserawareCustomer;
use CustomerManagementFrameworkBundle\Model\SsoAwareCustomerInterface;
abstract class Customer extends DefaultAbstractUserawareCustomer implements SsoAwareCustomerInterface
{
}
  1. In config.yml
pimcore_customer_management_framework:
    oauth_client:
        enabled: true

    # Configuration of general settings
    general:
        customerPimcoreClass: Customer
        mailBlackListFile:    /home/customerdataframework/www/var/config/cmf/mail-blacklist.txt
... etc
  1. Registering a new customer after login via SSO
    In AuthController.php
    Copied from https://github.com/pimcore/customer-data-framework/blob/master/frontend-samples/sso_client/src/AppBundle/Controller/AuthController.php
        ...
        // create a new, empty customer instance
        /** @var CustomerInterface|\Pimcore\Model\DataObject\Customer $customer */
        $customer = $customerProvider->create();

I get the above error at this point.
Is there additional configuration needed for the AppBundle\Model\DataObject\Data\Customer.php to extend Pimcore\Model\DataObject\Customer class?

Hi,
you need to make sure, that your customer data object class is extending your abstract customer class… see also parent class for data objects.

BR
Christian

Thanks Christian. This has helped me. I had understood that my Customer class should extend the pimcore generated class. But after considering your reply, my Customer class is the base of the generated Customer class.
Thanks for your help!