public function mapExternalAssociation(
        ExternalAssociation $externalAssociation
    ) {
        // @See https://github.com/doctrine/common/issues/336
        //if (!($referenceManager instanceof DocumentManager || $referenceManager instanceof EntityManagerInterface)) {
        if (!(method_exists($externalAssociation->getReferenceManager(), 'getReference'))) {
            $msg = '$referenceManager needs to implements a `getReference` method';
            throw new \InvalidArgumentException($msg);
        }

        $this->eventListener->addExternalAssoctiation($externalAssociation);


        $externalAssociation->getObjectManager()
            ->getEventManager()
            ->addEventListener(['postLoad'], $this->eventListener);
        // todo switch to doctrine event when https://github.com/doctrine/common/pull/335 is merged
    }