Skip to content

Instantly share code, notes, and snippets.

@kolomiec-valeriy
Created January 23, 2019 09:50
Show Gist options
  • Save kolomiec-valeriy/207ed86397600778014d882a924ee290 to your computer and use it in GitHub Desktop.
Save kolomiec-valeriy/207ed86397600778014d882a924ee290 to your computer and use it in GitHub Desktop.
Update SendInBlue subscription
<?php
namespace App\Controller;
use App\Entity\ApiUser;
use Psr\Log\LoggerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\Routing\Annotation\Route;
class UpdateSendInBlueController extends Controller
{
/**
* @Route("/test")
*/
public function testAction(LoggerInterface $logger)
{
$em = $this->getDoctrine()->getManager();
$sendInBlueService = $this->get('send_in_blue_service');
// $users = $em->getRepository(ApiUser::class)->findAll();
$user = $em->getRepository(ApiUser::class)->find(59867);
// foreach ($users as $user) {
$sendInBlueService->updateContactAttributes($user->getEmail(), [
'PAID' => $user->getSubscriptionType() == 'free' ? false : true,
]);
$logger->info("SendInBlue contact updated: ".$user->getEmail());
// }
return $this->json(true);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment