/**
  * @param User                $mixed
  * @param GroupInterface|null $group
  *
  * @return FacadeInterface
  */
 public function transform($mixed, GroupInterface $group = null)
 {
     $facade = $this->newFacade();
     $facade->username = $mixed->getUsername();
     $facade->firstName = $mixed->getFirstName();
     $facade->lastName = $mixed->getLastName();
     $facade->email = $mixed->getEmail();
     if (null !== $group && $this->authorizationChecker->isGranted(AdministrationPanelStrategy::ROLE_ACCESS_UPDATE_USER)) {
         $facade->addLink('_self_delete', $this->generateRoute('open_orchestra_api_user_remove_group', array('userId' => $mixed->getId(), 'groupId' => $group->getId())));
         $facade->addLink('_self_add', $this->generateRoute('open_orchestra_api_user_add_group', array('userId' => $mixed->getId(), 'groupId' => $group->getId())));
     }
     return $facade;
 }
 /**
  * @param FacadeInterface $facade
  * @param GroupInterface  $group
  *
  * @return FacadeInterface
  */
 protected function addLinks(FacadeInterface $facade, GroupInterface $group)
 {
     if ($this->authorizationChecker->isGranted(AdministrationPanelStrategy::ROLE_ACCESS_GROUP)) {
         $facade->addLink('_self', $this->generateRoute('open_orchestra_api_group_show', array('groupId' => $group->getId())));
     }
     if ($this->authorizationChecker->isGranted(AdministrationPanelStrategy::ROLE_ACCESS_DELETE_GROUP)) {
         $facade->addLink('_self_delete', $this->generateRoute('open_orchestra_api_group_delete', array('groupId' => $group->getId())));
     }
     if ($this->authorizationChecker->isGranted(AdministrationPanelStrategy::ROLE_ACCESS_UPDATE_GROUP)) {
         $facade->addLink('_self_form', $this->generateRoute('open_orchestra_backoffice_group_form', array('groupId' => $group->getId())));
         $facade->addLink('_self_edit', $this->generateRoute('open_orchestra_api_group_edit', array('groupId' => $group->getId())));
         $this->eventDispatcher->dispatch(GroupFacadeEvents::POST_GROUP_TRANSFORMATION, new GroupFacadeEvent($group, $facade));
     }
     if ($this->authorizationChecker->isGranted(AdministrationPanelStrategy::ROLE_ACCESS_CREATE_GROUP)) {
         $facade->addLink('_self_duplicate', $this->generateRoute('open_orchestra_api_group_duplicate', array('groupId' => $group->getId())));
     }
     return $facade;
 }