I try to create programmatically an integration in Magento 2.
I follow this tutorial :
https://magecomp.com/blog/create-activate-authorize-a-new-integration-programmatically-in-magento-2/
I have something like that :
// Create Integration
$integrationFactory = $this->integrationFactory->create();
$integration = $integrationFactory->setData($integrationData);
$integration->save();
$integrationId = $integration->getId();
$consumerName = 'Integration' . $integrationId;
// Create consumer
$consumer = $this->oauthService->createConsumer(['name' => $consumerName]);
$consumerId = $consumer->getId();
$integration->setConsumerId($consumer->getId());
$integration->save();
// Add grant permission
$this->authorizationService->grantAllPermissions($integrationId);
// Activate and Authorize
$token = $this->tokenFactory->create();
$token->createVerifierToken($consumerId);
$token->setType('access');
$token->save();
It's work but all 'save' function are deprecated. I don't succeed to find another way to save integration, consumer and token.
Do anyone have any idea?
Service Contract
(the best way), orResourceModel