partkeepr

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

UserPreferenceNotFoundException.php (751B)


      1 <?php
      2 
      3 namespace PartKeepr\AuthBundle\Exceptions;
      4 
      5 use PartKeepr\AuthBundle\Entity\User;
      6 use PartKeepr\CoreBundle\Exceptions\TranslatableException;
      7 
      8 /**
      9  * Is thrown when the user preference couldn't be found.
     10  */
     11 class UserPreferenceNotFoundException extends TranslatableException
     12 {
     13     private $user;
     14     private $key;
     15 
     16     public function __construct(User $user, $key, $code = 0, \Throwable $previous = null)
     17     {
     18         $this->user = $user;
     19         $this->key = $key;
     20 
     21         parent::__construct($code, $previous);
     22     }
     23 
     24     public function getMessageKey()
     25     {
     26         return sprintf(
     27             'The requested user preference %s was not found for user %s',
     28             $this->key,
     29             $this->user->getUsername()
     30         );
     31     }
     32 }