Skip to content

Commit 2dd03b2

Browse files
committed
Merge pull request #11 from maartenJacobs/interfaces
Interfaces for (nearly) everything
2 parents db63554 + 7beb6cc commit 2dd03b2

33 files changed

Lines changed: 880 additions & 186 deletions

Component/Crumbs/CrumbBuilder.php

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
namespace CCDNUser\ProfileBundle\Component\Crumbs;
1515

16-
use Symfony\Component\Security\Core\User\UserInterface;
16+
use CCDNUser\ProfileBundle\Entity\ProfileUserInterface;
1717

1818
/**
1919
*
@@ -43,10 +43,10 @@ public function addMemberIndex()
4343
/**
4444
*
4545
* @access public
46-
* @param \Symfony\Component\Security\Core\User\UserInterface $user
46+
* @param ProfileUserInterface $user
4747
* @return \CCDNUser\ProfileBundle\Component\Crumbs\Factory\CrumbTrail
4848
*/
49-
public function addProfileOverviewShow(UserInterface $user)
49+
public function addProfileOverviewShow(ProfileUserInterface $user)
5050
{
5151
return $this->addMemberIndex()
5252
->add(
@@ -69,10 +69,10 @@ public function addProfileOverviewShow(UserInterface $user)
6969
/**
7070
*
7171
* @access public
72-
* @param \Symfony\Component\Security\Core\User\UserInterface $user
72+
* @param ProfileUserInterface $user
7373
* @return \CCDNUser\ProfileBundle\Component\Crumbs\Factory\CrumbTrail
7474
*/
75-
public function addProfileBioShow(UserInterface $user)
75+
public function addProfileBioShow(ProfileUserInterface $user)
7676
{
7777
return $this->addMemberIndex()
7878
->add(
@@ -95,10 +95,10 @@ public function addProfileBioShow(UserInterface $user)
9595
/**
9696
*
9797
* @access public
98-
* @param \Symfony\Component\Security\Core\User\UserInterface $user
98+
* @param ProfileUserInterface $user
9999
* @return \CCDNUser\ProfileBundle\Component\Crumbs\Factory\CrumbTrail
100100
*/
101-
public function addProfilePersonalEdit(UserInterface $user)
101+
public function addProfilePersonalEdit(ProfileUserInterface $user)
102102
{
103103
return $this->addProfileOverviewShow($user)
104104
->add('crumbs.profile.personal.edit',
@@ -115,10 +115,10 @@ public function addProfilePersonalEdit(UserInterface $user)
115115
/**
116116
*
117117
* @access public
118-
* @param \Symfony\Component\Security\Core\User\UserInterface $user
118+
* @param ProfileUserInterface $user
119119
* @return \CCDNUser\ProfileBundle\Component\Crumbs\Factory\CrumbTrail
120120
*/
121-
public function addProfileInfoEdit(UserInterface $user)
121+
public function addProfileInfoEdit(ProfileUserInterface $user)
122122
{
123123
return $this->addProfileOverviewShow($user)
124124
->add('crumbs.profile.info.edit',
@@ -135,10 +135,10 @@ public function addProfileInfoEdit(UserInterface $user)
135135
/**
136136
*
137137
* @access public
138-
* @param \Symfony\Component\Security\Core\User\UserInterface $user
138+
* @param ProfileUserInterface $user
139139
* @return \CCDNUser\ProfileBundle\Component\Crumbs\Factory\CrumbTrail
140140
*/
141-
public function addProfileContactEdit(UserInterface $user)
141+
public function addProfileContactEdit(ProfileUserInterface $user)
142142
{
143143
return $this->addProfileOverviewShow($user)
144144
->add('crumbs.profile.contact.edit',
@@ -155,10 +155,10 @@ public function addProfileContactEdit(UserInterface $user)
155155
/**
156156
*
157157
* @access public
158-
* @param \Symfony\Component\Security\Core\User\UserInterface $user
158+
* @param ProfileUserInterface $user
159159
* @return \CCDNUser\ProfileBundle\Component\Crumbs\Factory\CrumbTrail
160160
*/
161-
public function addProfileAvatarEdit(UserInterface $user)
161+
public function addProfileAvatarEdit(ProfileUserInterface $user)
162162
{
163163
return $this->addProfileOverviewShow($user)
164164
->add('crumbs.profile.avatar.edit',
@@ -175,10 +175,10 @@ public function addProfileAvatarEdit(UserInterface $user)
175175
/**
176176
*
177177
* @access public
178-
* @param \Symfony\Component\Security\Core\User\UserInterface $user
178+
* @param ProfileUserInterface $user
179179
* @return \CCDNUser\ProfileBundle\Component\Crumbs\Factory\CrumbTrail
180180
*/
181-
public function addProfileBioEdit(UserInterface $user)
181+
public function addProfileBioEdit(ProfileUserInterface $user)
182182
{
183183
return $this->addProfileOverviewShow($user)
184184
->add('crumbs.profile.bio.edit',
@@ -195,10 +195,10 @@ public function addProfileBioEdit(UserInterface $user)
195195
/**
196196
*
197197
* @access public
198-
* @param \Symfony\Component\Security\Core\User\UserInterface $user
198+
* @param ProfileUserInterface $user
199199
* @return \CCDNUser\ProfileBundle\Component\Crumbs\Factory\CrumbTrail
200200
*/
201-
public function addProfileSignatureEdit(UserInterface $user)
201+
public function addProfileSignatureEdit(ProfileUserInterface $user)
202202
{
203203
return $this->addProfileOverviewShow($user)
204204
->add('crumbs.profile.signature.edit',

Controller/BaseController.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
1919
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
2020
use Symfony\Component\EventDispatcher\Event;
21+
use CCDNUser\ProfileBundle\Entity\ProfileUserInterface;
2122

2223
/**
2324
*
@@ -252,7 +253,7 @@ protected function getSecurityContext()
252253
/**
253254
*
254255
* @access protected
255-
* @return \Symfony\Component\Security\Core\User\UserInterface
256+
* @return ProfileUserInterface
256257
*/
257258
protected function getUser()
258259
{

Controller/ProfileBaseController.php

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313

1414
namespace CCDNUser\ProfileBundle\Controller;
1515

16-
use Symfony\Component\Security\Core\User\UserInterface;
17-
use CCDNUser\ProfileBundle\Controller\BaseController;
16+
use CCDNUser\ProfileBundle\Entity\ProfileUserInterface;
1817

1918
/**
2019
*
@@ -32,10 +31,10 @@ class ProfileBaseController extends BaseController
3231
/**
3332
*
3433
* @access protected
35-
* @param \Symfony\Component\Security\Core\User\UserInterface $user
36-
* @return \CCDNUser\ProfileBundle\Form\Handler\UpdatePersonalFormHandler
34+
* @param ProfileUserInterface $user
35+
* @return \CCDNUser\ProfileBundle\Form\Handler\User\Profile\UpdatePersonalFormHandler
3736
*/
38-
protected function getFormHandlerToEditPersonal(UserInterface $user)
37+
protected function getFormHandlerToEditPersonal(ProfileUserInterface $user)
3938
{
4039
$formHandler = $this->container->get('ccdn_user_profile.form.handler.personal');
4140

@@ -48,10 +47,10 @@ protected function getFormHandlerToEditPersonal(UserInterface $user)
4847
/**
4948
*
5049
* @access protected
51-
* @param \Symfony\Component\Security\Core\User\UserInterface $user
52-
* @return \CCDNUser\ProfileBundle\Form\Handler\UpdateInfoFormHandler
50+
* @param ProfileUserInterface $user
51+
* @return \CCDNUser\ProfileBundle\Form\Handler\User\Profile\UpdateInfoFormHandler
5352
*/
54-
protected function getFormHandlerToEditInfo(UserInterface $user)
53+
protected function getFormHandlerToEditInfo(ProfileUserInterface $user)
5554
{
5655
$formHandler = $this->container->get('ccdn_user_profile.form.handler.info');
5756

@@ -64,10 +63,10 @@ protected function getFormHandlerToEditInfo(UserInterface $user)
6463
/**
6564
*
6665
* @access protected
67-
* @param \Symfony\Component\Security\Core\User\UserInterface $user
68-
* @return \CCDNUser\ProfileBundle\Form\Handler\UpdateContactFormHandler
66+
* @param ProfileUserInterface $user
67+
* @return \CCDNUser\ProfileBundle\Form\Handler\User\Profile\UpdateContactFormHandler
6968
*/
70-
protected function getFormHandlerToEditContact(UserInterface $user)
69+
protected function getFormHandlerToEditContact(ProfileUserInterface $user)
7170
{
7271
$formHandler = $this->container->get('ccdn_user_profile.form.handler.contact');
7372

@@ -80,10 +79,10 @@ protected function getFormHandlerToEditContact(UserInterface $user)
8079
/**
8180
*
8281
* @access protected
83-
* @param \Symfony\Component\Security\Core\User\UserInterface $user
84-
* @return \CCDNUser\ProfileBundle\Form\Handler\UpdateAvatarFormHandler
82+
* @param ProfileUserInterface $user
83+
* @return \CCDNUser\ProfileBundle\Form\Handler\User\Profile\UpdateAvatarFormHandler
8584
*/
86-
protected function getFormHandlerToEditAvatar(UserInterface $user)
85+
protected function getFormHandlerToEditAvatar(ProfileUserInterface $user)
8786
{
8887
$formHandler = $this->container->get('ccdn_user_profile.form.handler.avatar');
8988

@@ -96,10 +95,10 @@ protected function getFormHandlerToEditAvatar(UserInterface $user)
9695
/**
9796
*
9897
* @access protected
99-
* @param \Symfony\Component\Security\Core\User\UserInterface $user
100-
* @return \CCDNUser\ProfileBundle\Form\Handler\UpdateBioFormHandler
98+
* @param ProfileUserInterface $user
99+
* @return \CCDNUser\ProfileBundle\Form\Handler\User\Profile\UpdateBioFormHandler
101100
*/
102-
protected function getFormHandlerToEditBio(UserInterface $user)
101+
protected function getFormHandlerToEditBio(ProfileUserInterface $user)
103102
{
104103
$formHandler = $this->container->get('ccdn_user_profile.form.handler.bio');
105104

@@ -112,10 +111,10 @@ protected function getFormHandlerToEditBio(UserInterface $user)
112111
/**
113112
*
114113
* @access protected
115-
* @param \Symfony\Component\Security\Core\User\UserInterface $user
116-
* @return \CCDNUser\ProfileBundle\Form\Handler\UpdateSignatureFormHandler
114+
* @param ProfileUserInterface $user
115+
* @return \CCDNUser\ProfileBundle\Form\Handler\User\Profile\UpdateSignatureFormHandler
117116
*/
118-
protected function getFormHandlerToEditSignature(UserInterface $user)
117+
protected function getFormHandlerToEditSignature(ProfileUserInterface $user)
119118
{
120119
$formHandler = $this->container->get('ccdn_user_profile.form.handler.signature');
121120

Controller/ProfileController.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
namespace CCDNUser\ProfileBundle\Controller;
1515

16-
use CCDNUser\ProfileBundle\Controller\ProfileBaseController;
1716
use CCDNUser\ProfileBundle\Component\Dispatcher\ProfileEvents;
1817
use CCDNUser\ProfileBundle\Component\Dispatcher\Event\UserProfileResponseEvent;
1918

Entity/Model/ProfileModel.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
namespace CCDNUser\ProfileBundle\Entity\Model;
1515

16-
use Symfony\Component\Security\Core\User\UserInterface;
16+
use CCDNUser\ProfileBundle\Entity\ProfileUserInterface;
1717

1818
/**
1919
*
@@ -32,14 +32,14 @@ abstract class ProfileModel
3232
/**
3333
*
3434
* @access protected
35-
* @var Symfony\Component\Security\Core\User\UserInterface $user
35+
* @var ProfileUserInterface $user
3636
*/
3737
protected $user;
3838

3939
/**
4040
* Get user
4141
*
42-
* @return UserInterface
42+
* @return ProfileUserInterface
4343
*/
4444
public function getUser()
4545
{
@@ -49,10 +49,10 @@ public function getUser()
4949
/**
5050
* Set user
5151
*
52-
* @param UserInterface $user
52+
* @param ProfileUserInterface $user
5353
* @return Profile
5454
*/
55-
public function setUser(UserInterface $user = null)
55+
public function setUser(ProfileUserInterface $user = null)
5656
{
5757
$this->user = $user;
5858

Entity/ProfileUserInterface.php

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the CCDNUser ProfileBundle
5+
*
6+
* (c) CCDN (c) CodeConsortium <http://www.codeconsortium.com/>
7+
*
8+
* Available on github <http://www.github.com/codeconsortium/>
9+
*
10+
* For the full copyright and license information, please view the LICENSE
11+
* file that was distributed with this source code.
12+
*/
13+
14+
namespace CCDNUser\ProfileBundle\Entity;
15+
16+
use Symfony\Component\Security\Core\User\UserInterface;
17+
18+
/**
19+
*
20+
* @category CCDNUser
21+
* @package ProfileBundle
22+
*
23+
* @author Maarten Jacobs <maarten.j.jacobs@gmail.com>
24+
* @license http://opensource.org/licenses/MIT MIT
25+
* @version Release: 2.0
26+
* @link https://github.com/codeconsortium/CCDNUserProfileBundle
27+
*
28+
*/
29+
interface ProfileUserInterface extends UserInterface
30+
{
31+
/**
32+
* Set profile
33+
*
34+
* @param Profile $profile
35+
*/
36+
public function setProfile(Profile $profile);
37+
38+
/**
39+
* Get profile
40+
*
41+
* @return Profile
42+
*/
43+
public function getProfile();
44+
45+
/**
46+
* Get registered date
47+
*
48+
* @return \Datetime
49+
*/
50+
public function getRegisteredDate();
51+
52+
/**
53+
* Set registered date
54+
*
55+
* @param \Datetime $registeredDate
56+
*/
57+
public function setRegisteredDate(\Datetime $registeredDate);
58+
}

EventListener/ProfileUserCreationListener.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
namespace CCDNUser\ProfileBundle\EventListener;
1515

1616
use CCDNUser\ProfileBundle\Entity\Factory\ProfileFactoryInterface;
17-
use Symfony\Component\Security\Core\User\UserInterface;
17+
use CCDNUser\ProfileBundle\Entity\ProfileUserInterface;
1818
use Doctrine\ORM\Event\LifecycleEventArgs;
1919

2020
/**
@@ -54,7 +54,7 @@ public function __construct(ProfileFactoryInterface $profileFactory)
5454
public function prePersist(LifecycleEventArgs $args)
5555
{
5656
$entity = $args->getEntity();
57-
if ($entity instanceof UserInterface) {
57+
if ($entity instanceof ProfileUserInterface) {
5858
$profile = $this->profileFactory->createDefaultProfile();
5959
$profile->setUser($entity);
6060
$entity->setProfile($profile);

Form/Handler/BaseFormHandler.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
namespace CCDNUser\ProfileBundle\Form\Handler;
1515

1616
use Symfony\Component\HttpFoundation\Request;
17-
use Symfony\Component\Security\Core\User\UserInterface;
17+
use CCDNUser\ProfileBundle\Entity\ProfileUserInterface;
1818

1919
/**
2020
*
@@ -60,17 +60,17 @@ class BaseFormHandler
6060
/**
6161
*
6262
* @access protected
63-
* @var \Symfony\Component\Security\Core\User\UserInterface $user
63+
* @var ProfileUserInterface $user
6464
*/
6565
protected $user;
6666

6767
/**
6868
*
6969
* @access public
70-
* @param \Symfony\Component\Security\Core\User\UserInterface $user
70+
* @param ProfileUserInterface $user
7171
* @return \CCDNUser\ProfileBundle\Form\Handler\BaseFormHandler
7272
*/
73-
public function setUser(UserInterface $user)
73+
public function setUser(ProfileUserInterface $user)
7474
{
7575
$this->user = $user;
7676

Form/Handler/User/Profile/UpdateAvatarFormHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public function getForm()
8686
*
8787
* @access protected
8888
* @param \CCDNUser\ProfileBundle\Entity\Profile $profile
89-
* @return \CCDNUser\ProfileBundle\Manager\ProfileManager
89+
* @return \CCDNUser\ProfileBundle\Model\Component\Manager\ProfileManager
9090
*/
9191
protected function onSuccess(Profile $profile)
9292
{

0 commit comments

Comments
 (0)