Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
class UserRegistrationService
{
private $em;
private $service1;
private $service2;
public function register(User $user, $cardToken)
{
$this->em->transactional(function() {
$this->service1->create($user);
$this->service2->createCustomer($user, $cardToken);
});
}
}
<?php
class UserService
{
public function create(User $user)
{
$this->entityManager->persist($user);
$this->entityManager->flush();
}
}
<?php
class StripeService
{
public function createCustomer(User $user, $cardToken)
{
// Make the call to Stripe API, retrieve the customer ID, and save it
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.