From 58d793e01ef0d80f88c998f9f06cc70b0fa17a5d Mon Sep 17 00:00:00 2001 From: William DURAND Date: Mon, 10 Oct 2011 18:55:59 +0300 Subject: [PATCH] Fixes #60 thanks to drjones69 --- Security/User/ModelUserProvider.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Security/User/ModelUserProvider.php b/Security/User/ModelUserProvider.php index 40f405e..000ca64 100644 --- a/Security/User/ModelUserProvider.php +++ b/Security/User/ModelUserProvider.php @@ -35,6 +35,7 @@ class ModelUserProvider implements UserProviderInterface */ protected $queryClass; /** + * A property to use to retrieve the user. * @var string */ protected $property; @@ -61,8 +62,8 @@ class ModelUserProvider implements UserProviderInterface $query = $queryClass::create(); - if (null !== $property) { - $filter = 'filterBy' . ucfirst($property); + if (null !== $this->property) { + $filter = 'filterBy' . ucfirst($this->property); $query->$filter($username); } else { $query->filterByUsername($username); @@ -82,7 +83,7 @@ class ModelUserProvider implements UserProviderInterface */ public function refreshUser(UserInterface $user) { - if ($user instanceof $this->class) { + if (!$user instanceof $this->class) { throw new UnsupportedUserException(sprintf('Instances of "%s" are not supported.', get_class($user))); }