src/Presentation/UserPresentation.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Presentation;
  3. use Oberon\Bundle\PresentationBundle\Presentation\BasePresentation;
  4. use App\Entity\User;
  5. use Symfony\Component\DependencyInjection\ContainerInterface;
  6. class UserPresentation extends BasePresentation
  7. {
  8. protected $user;
  9. public function __construct(User $user, $scope = null, array $data = null, ContainerInterface $container = null)
  10. {
  11. $this->user = $user;
  12. parent::__construct($scope, $data, $container);
  13. }
  14. public function getPresentation()
  15. {
  16. return [
  17. 'username' => $this->user->getUsername(),
  18. 'email' => $this->user->getEmail(),
  19. 'id' => (int)$this->user->getId(),
  20. ];
  21. }
  22. }