diff --git a/src/Controller/GroupController.php b/src/Controller/GroupController.php index 4a08d665..3a0f5f04 100644 --- a/src/Controller/GroupController.php +++ b/src/Controller/GroupController.php @@ -33,17 +33,15 @@ namespace App\Controller; use App\Controller\AdminPages\BaseAdminController; -use App\Entity\Parts\Category; use App\Entity\UserSystem\Group; -use App\Form\AdminPages\CategoryAdminForm; use App\Form\AdminPages\GroupAdminForm; use App\Services\EntityExporter; use App\Services\EntityImporter; use App\Services\StructuralElementRecursionHelper; use Doctrine\ORM\EntityManagerInterface; -use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\Routing\Annotation\Route; /** * @Route("/group") diff --git a/src/Entity/UserSystem/User.php b/src/Entity/UserSystem/User.php index d9bea4ff..78b1e983 100644 --- a/src/Entity/UserSystem/User.php +++ b/src/Entity/UserSystem/User.php @@ -66,6 +66,7 @@ use App\Security\Interfaces\HasPermissionsInterface; use App\Validator\Constraints\Selectable; use App\Validator\Constraints\ValidPermission; use Doctrine\ORM\Mapping as ORM; +use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; use Symfony\Component\Security\Core\User\UserInterface; use Symfony\Component\Validator\Constraints as Assert; @@ -75,6 +76,7 @@ use Symfony\Component\Validator\Constraints as Assert; * * @ORM\Entity(repositoryClass="App\Repository\UserRepository") * @ORM\Table("`users`") + * @UniqueEntity("name", message="validator.user.username_already_used") */ class User extends NamedDBElement implements UserInterface, HasPermissionsInterface { @@ -139,12 +141,14 @@ class User extends NamedDBElement implements UserInterface, HasPermissionsInterf /** * @var string|null The language/locale the user prefers * @ORM\Column(type="string", name="config_language", nullable=true) + * @Assert\Locale(canonicalize=true) */ protected $language = ''; /** * @var string|null The timezone the user prefers * @ORM\Column(type="string", name="config_timezone", nullable=true) + * @Assert\Timezone() */ protected $timezone = ''; @@ -171,22 +175,22 @@ class User extends NamedDBElement implements UserInterface, HasPermissionsInterf /** * @ORM\Column(type="string", name="config_currency") */ - protected $currency; + protected $currency = ""; /** * @ORM\Column(type="text", name="config_image_path") */ - protected $image_path; + protected $image_path = ""; /** * @ORM\Column(type="text", name="config_instock_comment_w") */ - protected $instock_comment_w; + protected $instock_comment_w = ""; /** * @ORM\Column(type="text", name="config_instock_comment_a") */ - protected $instock_comment_a; + protected $instock_comment_a = ""; public function __construct() {