Skip to content

Instantly share code, notes, and snippets.

@johnriberto
Last active August 23, 2017 16:52
Show Gist options
  • Save johnriberto/b907877e1bb18423bd4ed68d273f152a to your computer and use it in GitHub Desktop.
Save johnriberto/b907877e1bb18423bd4ed68d273f152a to your computer and use it in GitHub Desktop.
<?php
namespace AppBundle\Security;
use .....
class UserData
{
private $stack;
......
public function __construct(.....)
{
.......
}
public function checkUser($username)
{
$user = $this->entityManager->getRepository('AppBundle:User')->findOneBy(['username' => $username]);
if ($user) {
$camp = $this->entityManager->getRepository('AppBundle:Campaigns')->findOneBy(['id' => $user->getTarget()]);
if ($camp) {
// redirect
return $this->redirectResponse('facebook.com', 301);
}
}
return true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment