Skip to content

Commit

Permalink
Codesniffer: use 8.2 ruleset
Browse files Browse the repository at this point in the history
  • Loading branch information
f3l1x committed Dec 12, 2024
1 parent 7e59609 commit 1bf3d13
Show file tree
Hide file tree
Showing 6 changed files with 465 additions and 86 deletions.
27 changes: 18 additions & 9 deletions app/UI/Home/HomePresenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,48 @@

use App\Domain\Database\User;
use App\UI\BasePresenter;
use Nette\DI\Attributes\Inject;
use Doctrine\ORM\EntityManagerInterface;
use Nette\Utils\Random;
use Nettrine\ORM\ManagerRegistry;
use Nettrine\ORM\ManagerProvider;

class HomePresenter extends BasePresenter
{

#[Inject]
public ManagerRegistry $managerRegistry;
private EntityManagerInterface $db1;

private EntityManagerInterface $db2;

public function __construct(ManagerProvider $managerProvider)
{
parent::__construct();

$this->db1 = $managerProvider->getManager('default');
$this->db2 = $managerProvider->getManager('second');
}

public function actionDefault(): void
{
// PostgreSQL
$users = $this->managerRegistry->getManager('default')->getRepository(User::class)->findAll();
$users = $this->db1->getRepository(User::class)->findAll();

// MariaDB
$users2 = $this->managerRegistry->getManager('second')->getRepository(User::class)->findAll();
$users2 = $this->db2->getRepository(User::class)->findAll();

$this->template->users = [...$users, ...$users2];
}

public function handleCreateUser(): void
{
$user = new User(Random::generate(20));
$this->managerRegistry->getManager('default')->persist($user);
$this->managerRegistry->getManager('default')->flush();
$this->db1->persist($user);
$this->db1->flush();
$this->flashMessage('Saved');
$this->redirect('this');
}

public function handleDeleteUsers(): void
{
$this->managerRegistry->getManager('default')->getRepository(User::class)
$this->db1->getRepository(User::class)
->createQueryBuilder('u')
->delete()
->getQuery()
Expand Down
8 changes: 5 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@
"php": ">8.2",
"contributte/nella": "^0.3.0",

"contributte/console": "dev-master",
"contributte/event-dispatcher": "dev-master",
"contributte/console": "^0.11.0",
"contributte/event-dispatcher": "^0.10.0",

"nettrine/dbal": "^0.10.0",
"nettrine/orm": "^0.10.0",
"nettrine/extra": "^0.2.0"
"nettrine/extra": "^0.2.0",
"nettrine/fixtures": "^0.8.0",
"nettrine/migrations": "^0.10.0"
},
"require-dev": {
"contributte/qa": "^0.4",
Expand Down
Loading

0 comments on commit 1bf3d13

Please sign in to comment.