Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-stanek committed Sep 28, 2023
1 parent 85096b7 commit d1cc6ce
Show file tree
Hide file tree
Showing 256 changed files with 916 additions and 939 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
class DocumentTagsGridControl extends Control
{
public function __construct(
private Translator $translator,
private RoleRepository $roleRepository,
private AclService $aclService,
private TagRepository $tagRepository,
private readonly Translator $translator,
private readonly RoleRepository $roleRepository,
private readonly AclService $aclService,
private readonly TagRepository $tagRepository,
) {
}

Expand Down
8 changes: 4 additions & 4 deletions app/AdminModule/CmsModule/Components/DocumentsGridControl.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@
class DocumentsGridControl extends Control
{
public function __construct(
private Translator $translator,
private DocumentRepository $documentRepository,
private TagRepository $tagRepository,
private FilesService $filesService,
private readonly Translator $translator,
private readonly DocumentRepository $documentRepository,
private readonly TagRepository $tagRepository,
private readonly FilesService $filesService,
) {
}

Expand Down
7 changes: 3 additions & 4 deletions app/AdminModule/CmsModule/Components/FaqGridControl.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use App\Model\Cms\Repositories\FaqRepository;
use Doctrine\ORM\NonUniqueResultException;
use Doctrine\ORM\ORMException;
use Doctrine\ORM\NoResultException;
use Nette\Application\AbortException;
use Nette\Application\UI\Control;
use Nette\Localization\Translator;
Expand All @@ -19,7 +19,7 @@
*/
class FaqGridControl extends Control
{
public function __construct(private Translator $translator, private FaqRepository $faqRepository)
public function __construct(private readonly Translator $translator, private readonly FaqRepository $faqRepository)
{
}

Expand Down Expand Up @@ -102,7 +102,6 @@ public function handleDelete(int $id): void
/**
* Přesuene otázku $item_id mezi $prev_id a $next_id.
*
* @throws ORMException
* @throws AbortException
*/
public function handleSort(string|null $item_id, string|null $prev_id, string|null $next_id): void
Expand All @@ -124,8 +123,8 @@ public function handleSort(string|null $item_id, string|null $prev_id, string|nu
* Změní viditelnost otázky.
*
* @throws NonUniqueResultException
* @throws ORMException
* @throws AbortException
* @throws NoResultException
*/
public function changeStatus(string $id, string $public): void
{
Expand Down
4 changes: 1 addition & 3 deletions app/AdminModule/CmsModule/Components/NewsGridControl.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

use App\Model\Cms\Repositories\NewsRepository;
use App\Utils\Helpers;
use Doctrine\ORM\ORMException;
use Nette\Application\AbortException;
use Nette\Application\UI\Control;
use Nette\Localization\Translator;
Expand All @@ -19,7 +18,7 @@
*/
class NewsGridControl extends Control
{
public function __construct(private Translator $translator, private NewsRepository $newsRepository)
public function __construct(private readonly Translator $translator, private readonly NewsRepository $newsRepository)
{
}

Expand Down Expand Up @@ -98,7 +97,6 @@ public function handleDelete(int $id): void
/**
* Změní připíchnutí aktuality.
*
* @throws ORMException
* @throws AbortException
*/
public function changePinned(string $id, string $pinned): void
Expand Down
24 changes: 12 additions & 12 deletions app/AdminModule/CmsModule/Components/PagesGridControl.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
use App\Services\AclService;
use App\Services\CmsService;
use Doctrine\ORM\NonUniqueResultException;
use Doctrine\ORM\NoResultException;
use Doctrine\ORM\OptimisticLockException;
use Doctrine\ORM\ORMException;
use Nette\Application\AbortException;
use Nette\Application\UI\Control;
use Nette\Application\UI\Form;
Expand All @@ -34,11 +34,11 @@
class PagesGridControl extends Control
{
public function __construct(
private Translator $translator,
private CmsService $cmsService,
private PageRepository $pageRepository,
private RoleRepository $roleRepository,
private AclService $aclService,
private readonly Translator $translator,
private readonly CmsService $cmsService,
private readonly PageRepository $pageRepository,
private readonly RoleRepository $roleRepository,
private readonly AclService $aclService,
) {
}

Expand Down Expand Up @@ -159,8 +159,8 @@ public function createComponentPagesGrid(string $name): DataGrid
* Zpracuje přidání stránky.
*
* @throws NonUniqueResultException
* @throws ORMException
* @throws OptimisticLockException
* @throws NoResultException
* @throws NoResultException
*/
public function add(stdClass $values): void
{
Expand All @@ -180,8 +180,8 @@ public function add(stdClass $values): void
* Zpracuje upravení stránky.
*
* @throws NonUniqueResultException
* @throws ORMException
* @throws OptimisticLockException
* @throws NoResultException
* @throws NoResultException
*/
public function edit(string $id, stdClass $values): void
{
Expand Down Expand Up @@ -219,7 +219,6 @@ public function handleDelete(int $id): void
* Přesune stránku s $item_id mezi $prev_id a $next_id.
*
* @throws AbortException
* @throws ORMException
* @throws OptimisticLockException
*/
public function handleSort(string|null $item_id, string|null $prev_id, string|null $next_id): void
Expand All @@ -242,8 +241,9 @@ public function handleSort(string|null $item_id, string|null $prev_id, string|nu
*
* @throws AbortException
* @throws NonUniqueResultException
* @throws ORMException
* @throws OptimisticLockException
* @throws NoResultException
* @throws NoResultException
*/
public function changeStatus(string $id, string $public): void
{
Expand Down
12 changes: 6 additions & 6 deletions app/AdminModule/CmsModule/Forms/FaqFormFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use App\Model\User\Repositories\UserRepository;
use App\Model\User\User;
use Doctrine\ORM\NonUniqueResultException;
use Doctrine\ORM\ORMException;
use Doctrine\ORM\NoResultException;
use Nette;
use Nette\Application\UI\Form;
use stdClass;
Expand All @@ -33,9 +33,9 @@ class FaqFormFactory
private User|null $user = null;

public function __construct(
private BaseFormFactory $baseFormFactory,
private FaqRepository $faqRepository,
private UserRepository $userRepository,
private readonly BaseFormFactory $baseFormFactory,
private readonly FaqRepository $faqRepository,
private readonly UserRepository $userRepository,
) {
}

Expand Down Expand Up @@ -88,11 +88,11 @@ public function create(int|null $id, int $userId): Form
* Zpracuje formulář.
*
* @throws NonUniqueResultException
* @throws ORMException
* @throws NoResultException
*/
public function processForm(Form $form, stdClass $values): void
{
if ($form->isSubmitted() === $form['cancel']) {
if ($form->isSubmitted() == $form['cancel']) {
return;
}

Expand Down
4 changes: 2 additions & 2 deletions app/AdminModule/CmsModule/Forms/NewsFormFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class NewsFormFactory
*/
private News|null $news = null;

public function __construct(private BaseFormFactory $baseFormFactory, private NewsRepository $newsRepository)
public function __construct(private readonly BaseFormFactory $baseFormFactory, private readonly NewsRepository $newsRepository)
{
}

Expand Down Expand Up @@ -82,7 +82,7 @@ public function create(int|null $id): Form
*/
public function processForm(Form $form, stdClass $values): void
{
if ($form->isSubmitted() === $form['cancel']) {
if ($form->isSubmitted() == $form['cancel']) {
return;
}

Expand Down
26 changes: 12 additions & 14 deletions app/AdminModule/CmsModule/Forms/PageForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
use App\Services\CmsService;
use App\Services\FilesService;
use Doctrine\ORM\OptimisticLockException;
use Doctrine\ORM\ORMException;
use Nette\Application\UI;
use Nette\Application\UI\Form;
use stdClass;
Expand Down Expand Up @@ -59,13 +58,13 @@ class PageForm extends UI\Control
public function __construct(
public int $id,
public string $area,
private BaseFormFactory $baseFormFactory,
private PageRepository $pageRepository,
private AclService $aclService,
private CmsService $cmsService,
private RoleRepository $roleRepository,
private TagRepository $tagRepository,
private FilesService $filesService,
private readonly BaseFormFactory $baseFormFactory,
private readonly PageRepository $pageRepository,
private readonly AclService $aclService,
private readonly CmsService $cmsService,
private readonly RoleRepository $roleRepository,
private readonly TagRepository $tagRepository,
private readonly FilesService $filesService,
) {
$this->page = $this->pageRepository->findById($id);
}
Expand Down Expand Up @@ -153,7 +152,6 @@ public function createComponentForm(): Form
* Zpracuje formulář.
*
* @throws PageException
* @throws ORMException
* @throws OptimisticLockException
*/
public function processForm(Form $form, stdClass $values): void
Expand All @@ -174,20 +172,20 @@ public function processForm(Form $form, stdClass $values): void
}
}

if ($form->isSubmitted() === $form['submitAdd']) {
if ($form->isSubmitted() == $form['submitAdd']) {
$contentClass = '\\App\\Model\\Cms\\' . str_replace('_', '', ucwords($type, '_')) . 'Content';
$content = new $contentClass($page, $area);
$content->setHeading($form->getTranslator()->translate('common.content.default_heading.' . $type));
$this->cmsService->saveContent($content);
}

if ($form->isSubmitted() === $form['submitAdd']) {
if ($form->isSubmitted() == $form['submitAdd']) {
$submitName = 'submitAdd';
} elseif ($form->isSubmitted() === $form['submitMain']) {
} elseif ($form->isSubmitted() == $form['submitMain']) {
$submitName = 'submitMain';
} elseif ($form->isSubmitted() === $form['submitSidebar']) {
} elseif ($form->isSubmitted() == $form['submitSidebar']) {
$submitName = 'submitSidebar';
} elseif ($form->isSubmitted() === $form['submitAndContinue']) {
} elseif ($form->isSubmitted() == $form['submitAndContinue']) {
$submitName = 'submitAndContinue';
} else {
$submitName = 'submit';
Expand Down
2 changes: 1 addition & 1 deletion app/AdminModule/CmsModule/Forms/templates/page_form.latte
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<div id="content-{$id}" class="card contents-item mb-3">
<div class="card-header">
<div class="float-left">
{_common.content.name.$type}
{_"common.content.name.$type"}
</div>
<div class="float-right">
<a href="#content-{$id}" class="btn btn-xs btn-danger delete-content">
Expand Down
4 changes: 2 additions & 2 deletions app/AdminModule/CmsModule/Presenters/FaqPresenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ protected function createComponentFaqForm(): Form
$form = $this->faqFormFactory->create((int) $this->getParameter('id'), $this->user->id);

$form->onSuccess[] = function (Form $form, stdClass $values): void {
if ($form->isSubmitted() === $form['cancel']) {
if ($form->isSubmitted() == $form['cancel']) {
$this->redirect('Faq:default');
}

$this->flashMessage('admin.cms.faq.message.save_success', 'success');

if ($form->isSubmitted() === $form['submitAndContinue']) {
if ($form->isSubmitted() == $form['submitAndContinue']) {
$id = $values->id ?: $this->faqRepository->findLastId(); // todo: nahradit
$this->redirect('Faq:edit', ['id' => $id]);
} else {
Expand Down
4 changes: 2 additions & 2 deletions app/AdminModule/CmsModule/Presenters/NewsPresenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ protected function createComponentNewsForm(): Form
$form = $this->newsFormFactory->create((int) $this->getParameter('id'));

$form->onSuccess[] = function (Form $form, stdClass $values): void {
if ($form->isSubmitted() === $form['cancel']) {
if ($form->isSubmitted() == $form['cancel']) {
$this->redirect('News:default');
}

$this->flashMessage('admin.cms.news.message.save_success', 'success');

if ($form->isSubmitted() === $form['submitAndContinue']) {
if ($form->isSubmitted() == $form['submitAndContinue']) {
$id = $values->id ?: $this->newsRepository->findLastId(); // todo: nahradit
$this->redirect('News:edit', ['id' => $id]);
} else {
Expand Down
16 changes: 8 additions & 8 deletions app/AdminModule/Components/ApplicationsGridControl.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ class ApplicationsGridControl extends Control
private User|null $user = null;

public function __construct(
private Translator $translator,
private EntityManagerInterface $em,
private ApplicationRepository $applicationRepository,
private UserRepository $userRepository,
private SubeventRepository $subeventRepository,
private ApplicationService $applicationService,
private SubeventService $subeventService,
private Validators $validators,
private readonly Translator $translator,
private readonly EntityManagerInterface $em,
private readonly ApplicationRepository $applicationRepository,
private readonly UserRepository $userRepository,
private readonly SubeventRepository $subeventRepository,
private readonly ApplicationService $applicationService,
private readonly SubeventService $subeventService,
private readonly Validators $validators,
) {
}

Expand Down
8 changes: 3 additions & 5 deletions app/AdminModule/Components/RolesGridControl.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
use App\Services\AclService;
use App\Utils\Helpers;
use Doctrine\ORM\OptimisticLockException;
use Doctrine\ORM\ORMException;
use Nette\Application\AbortException;
use Nette\Application\UI\Control;
use Nette\Localization\Translator;
Expand All @@ -24,9 +23,9 @@
class RolesGridControl extends Control
{
public function __construct(
private Translator $translator,
private AclService $aclService,
private RoleRepository $roleRepository,
private readonly Translator $translator,
private readonly AclService $aclService,
private readonly RoleRepository $roleRepository,
) {
}

Expand Down Expand Up @@ -129,7 +128,6 @@ public function handleDelete(int $id): void
* Změní registrovatelnost role.
*
* @throws AbortException
* @throws ORMException
* @throws OptimisticLockException
*/
public function changeRegisterable(string $id, string $registerable): void
Expand Down
Loading

0 comments on commit d1cc6ce

Please sign in to comment.