Skip to content

Commit

Permalink
states
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-stanek committed Nov 1, 2024
1 parent 5608e95 commit 89a69eb
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions app/AdminModule/Forms/EditUserTransferFormFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,15 @@

namespace App\AdminModule\Forms;

use App\Model\Acl\Role;
use App\Model\Application\Application;
use App\Model\Enums\ApplicationState;
use App\Model\User\Repositories\UserRepository;
use App\Model\User\User;
use App\Services\ApplicationService;
use Contributte\Translation\Translator;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Nette;
use Nette\Application\UI\Form;
use Nette\Utils\ImageException;
Expand Down Expand Up @@ -66,9 +71,40 @@ public function processForm(Form $form, stdClass $values): void
$userRoles = $this->user->getRoles();
$targetUserRoles = $targetUser->getRoles();

$targetRoles = new ArrayCollection();
foreach ($userRoles as $role) {
if (!$targetRoles->contains($role)) {

Check failure on line 76 in app/AdminModule/Forms/EditUserTransferFormFactory.php

View workflow job for this annotation

GitHub Actions / PHPStan analysis

Negated boolean expression is always true.
$targetRoles->add($role);
}
}
foreach ($targetUserRoles as $role) {
if (!$targetRoles->contains($role) && $role->getSystemName() !== Role::NONREGISTERED) {

Check failure on line 81 in app/AdminModule/Forms/EditUserTransferFormFactory.php

View workflow job for this annotation

GitHub Actions / PHPStan analysis

Negated boolean expression is always true.
$targetRoles->add($role);
}
}

$userSubevents = $this->user->getSubevents();
$targetUserSubevents = $this->user->getSubevents();

$targetSubevents = new ArrayCollection();
foreach ($userSubevents as $subevent) {
if (!$targetSubevents->contains($subevent)) {

Check failure on line 91 in app/AdminModule/Forms/EditUserTransferFormFactory.php

View workflow job for this annotation

GitHub Actions / PHPStan analysis

Negated boolean expression is always true.
$targetSubevents->add($subevent);
}
}
foreach ($targetUserSubevents as $subevent) {
if (!$targetSubevents->contains($subevent)) {

Check failure on line 96 in app/AdminModule/Forms/EditUserTransferFormFactory.php

View workflow job for this annotation

GitHub Actions / PHPStan analysis

Negated boolean expression is always true.
$targetSubevents->add($subevent);
}
}

$loggedUser = $form->getPresenter()->getDbUser();

Check failure on line 101 in app/AdminModule/Forms/EditUserTransferFormFactory.php

View workflow job for this annotation

GitHub Actions / PHPStan analysis

Call to an undefined method Nette\Application\UI\Presenter::getDbUser().

$this->applicationService->cancelRegistration($this->user, ApplicationState::CANCELED_TRANSFERED, $loggedUser);

Check failure on line 103 in app/AdminModule/Forms/EditUserTransferFormFactory.php

View workflow job for this annotation

GitHub Actions / PHPStan analysis

Access to undefined constant App\Model\Enums\ApplicationState::CANCELED_TRANSFERED.
$this->applicationService->updateRoles($targetUser, $targetRoles, $form->getPresenter()->getDbUser(), $loggedUser);

Check failure on line 104 in app/AdminModule/Forms/EditUserTransferFormFactory.php

View workflow job for this annotation

GitHub Actions / PHPStan analysis

Call to an undefined method Nette\Application\UI\Presenter::getDbUser().
$this->applicationService->addSubeventsApplication($targetUser, $targetSubevents, $loggedUser);

// todo: pridani platby za vsechny role a podakce (i ty ktere uz mel)

// $this->user->setFirstName($values->firstName);
// $this->user->setLastName($values->lastName);
Expand Down

0 comments on commit 89a69eb

Please sign in to comment.