commit ea2b25e22418a3b9495047526d77379edace095a
parent 715ed2cb3339fdefdd295edae7bb22cbc4c657be
Author: Timo A. Hummel <felicitus@felicitus.org>
Date: Fri, 6 Nov 2015 23:49:47 +0100
Refactored legacy exceptions
Diffstat:
5 files changed, 0 insertions(+), 42 deletions(-)
diff --git a/src/PartKeepr/AuthBundle/Services/UserPreferenceService.php b/src/PartKeepr/AuthBundle/Services/UserPreferenceService.php
@@ -33,10 +33,6 @@ class UserPreferenceService
*/
public function setPreference(User $user, $key, $value)
{
- if (!$this->entityManager->contains($user)) {
- throw new EntityNotPersistantException();
- }
-
$dql = 'SELECT up FROM PartKeepr\AuthBundle\Entity\UserPreference up WHERE up.user = :user AND ';
$dql .= "up.preferenceKey = :key";
@@ -88,10 +84,6 @@ class UserPreferenceService
*/
public function getPreferences(User $user)
{
- if (!$this->entityManager->contains($user)) {
- throw new EntityNotPersistantException();
- }
-
$dql = "SELECT up FROM PartKeepr\AuthBundle\Entity\UserPreference up WHERE up.user = :user";
$query = $this->entityManager->createQuery($dql);
@@ -112,10 +104,6 @@ class UserPreferenceService
*/
public function getPreference(User $user, $key)
{
- if (!$this->entityManager->contains($user)) {
- throw new EntityNotPersistantException();
- }
-
$dql = "SELECT up FROM PartKeepr\AuthBundle\Entity\UserPreference up WHERE up.user = :user AND ";
$dql .= "up.preferenceKey = :key";
@@ -142,10 +130,6 @@ class UserPreferenceService
*/
public function deletePreference(User $user, $key)
{
- if (!$this->entityManager->contains($user)) {
- throw new EntityNotPersistantException();
- }
-
$dql = "DELETE FROM PartKeepr\AuthBundle\Entity\UserPreference up WHERE up.user = :user AND ";
$dql .= "up.preferenceKey = :key";
diff --git a/src/PartKeepr/PartBundle/Entity/Part.php b/src/PartKeepr/PartBundle/Entity/Part.php
@@ -14,7 +14,6 @@ use PartKeepr\StockBundle\Entity\StockEntry;
use PartKeepr\StorageLocationBundle\Entity\StorageLocation;
use PartKeepr\UploadedFileBundle\Annotation\UploadedFileCollection;
use PartKeepr\Util\BaseEntity;
-use PartKeepr\Util\Exceptions\OutOfRangeException;
use Symfony\Component\Serializer\Annotation\Groups;
/**
diff --git a/src/PartKeepr/PartBundle/Entity/PartDistributor.php b/src/PartKeepr/PartBundle/Entity/PartDistributor.php
@@ -4,9 +4,7 @@ namespace PartKeepr\PartBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use PartKeepr\DistributorBundle\Entity\Distributor;
use PartKeepr\PartBundle\Exceptions\PackagingUnitOutOfRangeException;
-use PartKeepr\PartKeepr;
use PartKeepr\Util\BaseEntity;
-use PartKeepr\Util\Exceptions\OutOfRangeException;
use Symfony\Component\Serializer\Annotation\Groups;
/**
diff --git a/src/backend/PartKeepr/Util/Exceptions/ObjectNotFoundException.php b/src/backend/PartKeepr/Util/Exceptions/ObjectNotFoundException.php
@@ -1,17 +0,0 @@
-<?php
-namespace PartKeepr\Util\Exceptions;
-
-use PartKeepr\Util\SerializableException,
- PartKeepr\PartKeepr;
-
-/**
- * Thrown when an object was no found.
- */
-class ObjectNotFoundException extends SerializableException {
- public function __construct ($class, $id) {
- parent::__construct(
- sprintf(
- PartKeepr::i18n("The object of type %s with the id %s could not be found in the database."),
- $class, $id));
- }
-}
diff --git a/src/backend/PartKeepr/Util/Exceptions/OutOfRangeException.php b/src/backend/PartKeepr/Util/Exceptions/OutOfRangeException.php
@@ -1,6 +0,0 @@
-<?php
-namespace PartKeepr\Util\Exceptions;
-
-use PartKeepr\Util\SerializableException;
-
-class OutOfRangeException extends SerializableException {}