partkeepr

fork of partkeepr
git clone https://git.e1e0.net/partkeepr.git
Log | Files | Refs | Submodules | README | LICENSE

commit 26827be27ee07275bdeac480919f46a8499ab2a2
parent 50ec8155577b58898d01644145ac724d16ecd71d
Author: Felicitus <felicitus@felicitus.org>
Date:   Wed, 16 Sep 2015 15:21:27 +0200

Moved UserPreferenceNotFoundException to the proper bundle

Diffstat:
Asrc/PartKeepr/AuthBundle/Exceptions/UserPreferenceNotFoundException.php | 21+++++++++++++++++++++
Msrc/PartKeepr/AuthBundle/Services/UserPreferenceService.php | 6+++---
Msrc/PartKeepr/AuthBundle/Tests/Services/UserPreferenceServiceTest.php | 2+-
Dsrc/backend/PartKeepr/UserPreference/Exceptions/UserPreferenceNotFoundException.php | 21---------------------
4 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/src/PartKeepr/AuthBundle/Exceptions/UserPreferenceNotFoundException.php b/src/PartKeepr/AuthBundle/Exceptions/UserPreferenceNotFoundException.php @@ -0,0 +1,21 @@ +<?php +namespace PartKeepr\AuthBundle\Exceptions; + +use PartKeepr\AuthBundle\Entity\User; +use PartKeepr\Util\SerializableException; + +/** + * Is thrown when the user has given wrong credentials. + */ +class UserPreferenceNotFoundException extends SerializableException +{ + public function __construct(User $user, $preferenceKey) + { + $message = sprintf("User preference %s not found for user %s (%s)", + $preferenceKey, + $user->getUsername(), + $user->getId()); + + parent::__construct($message); + } +} diff --git a/src/PartKeepr/AuthBundle/Services/UserPreferenceService.php b/src/PartKeepr/AuthBundle/Services/UserPreferenceService.php @@ -5,7 +5,7 @@ use Doctrine\ORM\EntityManager; use Doctrine\ORM\NoResultException; use PartKeepr\AuthBundle\Entity\User; use PartKeepr\AuthBundle\Entity\UserPreference; -use PartKeepr\UserPreference\Exceptions\UserPreferenceNotFoundException; +use PartKeepr\AuthBundle\Exceptions\UserPreferenceNotFoundException; use PartKeepr\Util\Exceptions\EntityNotPersistantException; class UserPreferenceService @@ -66,7 +66,7 @@ class UserPreferenceService * @param string $key The preference key to retrieve * * @return string The preference string - * @throws UserPreferenceNotFoundException Thrown if the preference key was not found + * @throws \PartKeepr\AuthBundle\Exceptions\UserPreferenceNotFoundException Thrown if the preference key was not found * @throws EntityNotPersistantException Thrown if the entity is not persistant */ public function getPreferenceValue(User $user, $key) @@ -104,7 +104,7 @@ class UserPreferenceService * @param string $key The preference key to retrieve * * @return UserPreference The preference object - * @throws UserPreferenceNotFoundException Thrown if the preference key was not found + * @throws \PartKeepr\AuthBundle\Exceptions\UserPreferenceNotFoundException Thrown if the preference key was not found * @throws EntityNotPersistantException Thrown if the entity is not persistant */ public function getPreference(User $user, $key) diff --git a/src/PartKeepr/AuthBundle/Tests/Services/UserPreferenceServiceTest.php b/src/PartKeepr/AuthBundle/Tests/Services/UserPreferenceServiceTest.php @@ -85,7 +85,7 @@ class UserPreferenceServiceTest extends WebTestCase */ $user = $this->getContainer()->get("partkeepr.userservice")->getProxyUser("admin", "test"); - $this->setExpectedException("PartKeepr\UserPreference\Exceptions\UserPreferenceNotFoundException"); + $this->setExpectedException("PartKeepr\AuthBundle\Exceptions\UserPreferenceNotFoundException"); $service->getPreference($user, "BLA"); } diff --git a/src/backend/PartKeepr/UserPreference/Exceptions/UserPreferenceNotFoundException.php b/src/backend/PartKeepr/UserPreference/Exceptions/UserPreferenceNotFoundException.php @@ -1,20 +0,0 @@ -<?php -namespace PartKeepr\UserPreference\Exceptions; - -use PartKeepr\AuthBundle\Entity\User; -use PartKeepr\PartKeepr; -use PartKeepr\Util\SerializableException; - -/** - * Is thrown when the user has given wrong credentials. - */ -class UserPreferenceNotFoundException extends SerializableException { - public function __construct (User $user, $preferenceKey) { - $message = sprintf( PartKeepr::i18n("User preference %s not found for user %s (%s)"), - $preferenceKey, - $user->getUsername(), - $user->getId()); - - parent::__construct($message); - } -}- \ No newline at end of file