Skip to content

Commit 6a7af15

Browse files
committed
Removing the redundant bits of functionality for users without profiles
Also removing the unused method checkUserHasProfile.
1 parent fd882ac commit 6a7af15

2 files changed

Lines changed: 4 additions & 24 deletions

File tree

Model/Component/Manager/UserManager.php

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -32,26 +32,6 @@
3232
*/
3333
class UserManager extends BaseManager implements ManagerInterface
3434
{
35-
/**
36-
*
37-
* @access public
38-
* @param \Symfony\Component\Security\Core\User\UserInterface $user
39-
*/
40-
public function checkUserHasProfile(UserInterface $user)
41-
{
42-
if (null == $user->getProfile()) {
43-
$profile = new Profile();
44-
$profile->setUser($user);
45-
$user->setProfile($profile);
46-
47-
$this->persist($profile);
48-
$this->flush();
49-
$this->refresh($user);
50-
}
51-
52-
return $this;
53-
}
54-
5535
/**
5636
*
5737
* @access public

Model/Component/Repository/UserRepository.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function findAllUsersWithProfilePaginated($page = 1, $itemsPerPage = 25)
4343
$qb = $this->createSelectQuery(array('u'));
4444

4545
$qb
46-
->leftJoin('u.profile', 'p')
46+
->join('u.profile', 'p')
4747
->addOrderBy('u.username', 'DESC')
4848
->addOrderBy('u.registeredDate', 'DESC')
4949
;
@@ -67,7 +67,7 @@ public function findAllUsersWithProfileFilteredAtoZPaginated($alpha, $page = 1,
6767

6868
$qb
6969
->where('u.username LIKE :filter')
70-
->leftJoin('u.profile', 'p')
70+
->join('u.profile', 'p')
7171
->setParameters($params)
7272
->addOrderBy('u.username', 'DESC')
7373
->addOrderBy('u.registeredDate', 'DESC')
@@ -90,7 +90,7 @@ public function findOneUserWithProfileByUsername($username)
9090

9191
$qb
9292
->where('u.username = :username')
93-
->leftJoin('u.profile', 'p')
93+
->join('u.profile', 'p')
9494
->addOrderBy('u.username', 'DESC')
9595
->addOrderBy('u.registeredDate', 'DESC')
9696
;
@@ -112,7 +112,7 @@ public function findOneUserWithProfileById($userId)
112112

113113
$qb
114114
->where('u.id = :userId')
115-
->leftJoin('u.profile', 'p')
115+
->join('u.profile', 'p')
116116
->addOrderBy('u.username', 'DESC')
117117
->addOrderBy('u.registeredDate', 'DESC')
118118
;

0 commit comments

Comments
 (0)