forked from Sylius/Sylius
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request Sylius#2824 from aRn0D/user_spec
[UserBundle] CS fixes and missing specs
- Loading branch information
Showing
47 changed files
with
757 additions
and
181 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,21 +20,22 @@ | |
* | ||
* @author Michał Marcinkowski <[email protected]> | ||
*/ | ||
class DefaultUsernameListener | ||
class DefaultUsernameORMListener | ||
{ | ||
/** | ||
* @param LifecycleEventArgs $event | ||
*/ | ||
public function prePersist(LifecycleEventArgs $event) | ||
{ | ||
$item = $event->getEntity(); | ||
$user = $event->getEntity(); | ||
|
||
if (!$item instanceof UserInterface) { | ||
if (!$user instanceof UserInterface) { | ||
return; | ||
} | ||
$customer = $item->getCustomer(); | ||
if (null !== $customer && $customer->getEmail() !== $item->getUsername()) { | ||
$item->setUsername($customer->getEmail()); | ||
|
||
$customer = $user->getCustomer(); | ||
if (null !== $customer && $customer->getEmail() !== $user->getUsername()) { | ||
$user->setUsername($customer->getEmail()); | ||
} | ||
} | ||
|
||
|
@@ -43,14 +44,15 @@ public function prePersist(LifecycleEventArgs $event) | |
*/ | ||
public function preUpdate(LifecycleEventArgs $event) | ||
{ | ||
$item = $event->getEntity(); | ||
$customer = $event->getEntity(); | ||
|
||
if (!$item instanceof CustomerInterface) { | ||
if (!$customer instanceof CustomerInterface) { | ||
return; | ||
} | ||
$user = $item->getUser(); | ||
if (null !== $user && $user->getUsername() !== $item->getEmail()) { | ||
$user->setUsername($item->getEmail()); | ||
|
||
$user = $customer->getUser(); | ||
if (null !== $user && $user->getUsername() !== $customer->getEmail()) { | ||
$user->setUsername($customer->getEmail()); | ||
$entityManager = $event->getEntityManager(); | ||
$entityManager->persist($user); | ||
$entityManager->flush($user); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ | |
use Symfony\Component\EventDispatcher\GenericEvent; | ||
|
||
/** | ||
* Mailer listener for User actions | ||
* Mailer listener for User actions. | ||
* | ||
* @author Łukasz Chruściel <[email protected]> | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ | |
namespace Sylius\Bundle\UserBundle\Form\Model; | ||
|
||
/** | ||
* Model class for email validation | ||
* Model class for email validation. | ||
* | ||
* @author Łukasz Chruściel <[email protected]> | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,6 @@ | |
|
||
use Symfony\Component\Form\FormBuilderInterface; | ||
use Sylius\Bundle\ResourceBundle\Form\Type\AbstractResourceType; | ||
use Symfony\Component\OptionsResolver\OptionsResolverInterface; | ||
|
||
/** | ||
* @author Łukasz Chruściel <[email protected]> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,7 @@ | |
/** | ||
* @author Łukasz Chruściel <[email protected]> | ||
*/ | ||
abstract class UserProvider implements UserProviderInterface | ||
abstract class AbstractUserProvider implements UserProviderInterface | ||
{ | ||
/** | ||
* @var string | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ | |
/** | ||
* @author Łukasz Chruściel <[email protected]> | ||
*/ | ||
class EmailProvider extends UserProvider | ||
class EmailProvider extends AbstractUserProvider | ||
{ | ||
/** | ||
* {@inheritDoc} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ | |
/** | ||
* @author Łukasz Chruściel <[email protected]> | ||
*/ | ||
class UsernameOrEmailProvider extends UserProvider | ||
class UsernameOrEmailProvider extends AbstractUserProvider | ||
{ | ||
/** | ||
* {@inheritDoc} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ | |
/** | ||
* @author Łukasz Chruściel <[email protected]> | ||
*/ | ||
class UsernameProvider extends UserProvider | ||
class UsernameProvider extends AbstractUserProvider | ||
{ | ||
/** | ||
* {@inheritDoc} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,8 +15,8 @@ | |
use Sylius\Component\User\Model\UserInterface; | ||
|
||
/** | ||
* @author Łukasz Chruściel <[email protected]> | ||
*/ | ||
* @author Łukasz Chruściel <[email protected]> | ||
*/ | ||
class UserReloader implements UserReloaderInterface | ||
{ | ||
/** | ||
|
Oops, something went wrong.