commit c6737cc6711c6f1e24a6e23ed434e41ebbd75296
parent c603b6a7678c98bfb62b41fe24c2aa273ab7e2f4
Author: Felicitus <felicitus@felicitus.org>
Date: Sun, 29 Mar 2015 21:25:36 +0200
Readded uses for annotations which the PhpStorm Optimize Imports function removed. Also fixes the missing error template in the frontend.
Diffstat:
6 files changed, 41 insertions(+), 16 deletions(-)
diff --git a/src/PartKeepr/AuthBundle/Controller/DefaultController.php b/src/PartKeepr/AuthBundle/Controller/DefaultController.php
@@ -3,12 +3,17 @@
namespace PartKeepr\AuthBundle\Controller;
use FOS\RestBundle\Controller\FOSRestController;
-use FOS\RestBundle\Request\ParamFetcher;
-use PartKeepr\AuthBundle\Entity\User\Exceptions\InvalidLoginDataException;
+use Sensio\Bundle\FrameworkExtraBundle\Configuration as Routing;
use PartKeepr\AuthBundle\Entity\User\User;
-use PartKeepr\AuthBundle\Entity\UserManager;
+use Nelmio\ApiDocBundle\Annotation\ApiDoc;
+use FOS\RestBundle\Controller\Annotations\View;
use PartKeepr\Session\SessionManager;
-use Sensio\Bundle\FrameworkExtraBundle\Configuration as Routing;
+use FOS\RestBundle\Controller\Annotations\RequestParam;
+use FOS\RestBundle\Request\ParamFetcher;
+use PartKeepr\AuthBundle\Entity\UserManager;
+use PartKeepr\AuthBundle\Entity\User\Exceptions\InvalidLoginDataException;
+use PartKeepr\AuthBundle\Validator\Constraints\Username;
+use PartKeepr\AuthBundle\Validator\Constraints\PasswordMD5Hash;
use Symfony\Component\HttpKernel\Exception\HttpException;
class DefaultController extends FOSRestController
diff --git a/src/PartKeepr/AuthBundle/Entity/User/User.php b/src/PartKeepr/AuthBundle/Entity/User/User.php
@@ -243,7 +243,7 @@ class User extends BaseEntity implements Serializable, Deserializable {
* Returns all user preferences for this user
*
* @param none
- * @return Array An array of UserPreference objects
+ * @return UserPreference[] An array of UserPreference objects
* @throws EntityNotPersistantException Thrown if the entity is not persistant
*/
public function getPreferences () {
diff --git a/src/PartKeepr/FrontendBundle/Controller/IndexController.php b/src/PartKeepr/FrontendBundle/Controller/IndexController.php
@@ -2,11 +2,13 @@
namespace PartKeepr\FrontendBundle\Controller;
-use PartKeepr\AuthBundle\Entity\User\User;
-use PartKeepr\PartKeepr;
-use PartKeepr\Session\SessionManager;
-use PartKeepr\Util\Configuration;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
+use \PartKeepr\AuthBundle\Entity\User\User,
+ PartKeepr\PartKeepr,
+ PartKeepr\Session\SessionManager,
+ PartKeepr\Util\Configuration;
+
+use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
class IndexController extends Controller
{
@@ -33,12 +35,14 @@ class IndexController extends Controller
if (!class_exists("Imagick")) {
// @todo This check is deprecated and shouldn't be done here. Sf2 should automatically take care of this
- $template = $twig->loadTemplate("error.tpl");
- echo $template->render(array(
+
+ return $this->render('PartKeeprFrontendBundle::error.html.twig',
+ array(
"title" => PartKeepr::i18n("ImageMagick is not installed"),
- "error" => PartKeepr::i18n("You are missing the ImageMagick extension. Please install it and restart the setup to verify that the library was installed correctly.")
+ "error" => PartKeepr::i18n(
+ "You are missing the ImageMagick extension. Please install it and restart the setup to verify that the library was installed correctly."
+ )
));
- exit;
}
/* ImageMagick formats */
diff --git a/src/PartKeepr/FrontendBundle/Resources/views/error.html.twig b/src/PartKeepr/FrontendBundle/Resources/views/error.html.twig
@@ -0,0 +1,13 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
+ "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
+ <title>Error</title>
+</head>
+<body>
+ <h1>{{ title }}</h1>
+
+ <p>{{ error }}</p>
+</body>
+</html>
diff --git a/src/backend/PartKeepr/Session/Session.php b/src/backend/PartKeepr/Session/Session.php
@@ -17,6 +17,7 @@ class Session {
private $sessionid;
/**
+ * @var User
* @ORM\ManyToOne(targetEntity="PartKeepr\AuthBundle\Entity\User\User")
*/
private $user;
@@ -51,7 +52,11 @@ class Session {
session_id($this->sessionid);
session_start();
}
-
+
+ /**
+ * Returns the user object
+ * @return User
+ */
public function getUser () {
return $this->user;
}
diff --git a/src/backend/PartKeepr/UserPreference/UserPreference.php b/src/backend/PartKeepr/UserPreference/UserPreference.php
@@ -19,8 +19,6 @@ use PartKeepr\Util\Serializable;
*
* Note that values are stored internally as serialized PHP values to keep their type.
*
- * @Service(description="Represents a user preference",
- * documentation="User preferences are user-specific settings, which are identified by keys and values. Think of them as an associative array.")
* @ORM\Entity
**/
class UserPreference implements Serializable {