Created
January 23, 2019 09:50
-
-
Save kolomiec-valeriy/207ed86397600778014d882a924ee290 to your computer and use it in GitHub Desktop.
Update SendInBlue subscription
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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