Created
September 30, 2019 13:55
-
-
Save kolomiec-valeriy/55ca2e7e26981f3890bf8ee55334930a to your computer and use it in GitHub Desktop.
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 Symfony\Bundle\FrameworkBundle\Controller\Controller; | |
use Symfony\Component\HttpFoundation\JsonResponse; | |
use Symfony\Component\Routing\Annotation\Route; | |
use App\Subscription\IosSubscriptionManager; | |
use App\Entity\Subscription\IAPIosReceipt; | |
use Psr\Log\LoggerInterface; | |
class FixReceiptsWithoutUsersController extends Controller | |
{ | |
/** | |
* @Route("/fix-receipts") | |
* @param IosSubscriptionManager $manager | |
* @param LoggerInterface $logger | |
* | |
* @return JsonResponse | |
*/ | |
public function fixReceiptsWithoutUsers(IosSubscriptionManager $manager) | |
{ | |
$receipts = $this->getDoctrine()->getRepository(IAPIosReceipt::class)->findBy([ | |
'account' => null, | |
]); | |
/** @var IAPIosReceipt $receipt */ | |
foreach ($receipts as $receipt) { | |
if (!$receipt->getAccount()) { | |
$manager->queue($receipt); | |
} | |
} | |
return $this->json('Found receipts without users - '.count($receipts)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment