for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace AppBundle\Tenant\Unloader;
use AppBundle\Entity\OAuth;
use Doctrine\ORM\EntityManager;
use Ds\Component\Tenant\Entity\Tenant;
use Ds\Component\Tenant\Loader\Unloader;
/**
* Class OAuthUnloader
*/
class OAuthUnloader implements Unloader
{
* @var \Doctrine\ORM\EntityManager
protected $entityManager;
* Constructor
*
* @param \Doctrine\ORM\EntityManager $entityManager
public function __construct(EntityManager $entityManager)
$this->entityManager = $entityManager;
}
* {@inheritdoc}
public function unload(Tenant $tenant)
$builder = $this->entityManager->getRepository(OAuth::class)->createQueryBuilder('e');
$builder
->delete()
->where('e.tenant = :tenant')
->setParameter('tenant', $tenant->getUuid());
$query = $builder->getQuery();
$query->execute();