public function transformEntityData(EntityData $entityData) { switch ($entityData->getEntityName()) { case 'product': $product = new LocalProduct(); // In reality the local persistence gateway would generate the local id $product->id = 'local' . $entityData->getEntityId(); $product->category = $entityData->getDependencyReference('category'); return $product; case 'category': $cat = new LocalProductCategory(); // In reality the local persistence gateway would generate the local id $cat->name = $entityData->getEntityId(); return $cat; default: throw new \Exception('this should never be reached'); } }