Skip to content

Commit

Permalink
composer: Update Nextras ORM
Browse files Browse the repository at this point in the history
- https://nextras.org/orm/docs/5.0/migrate_5.0
- get() has been deprecated in 4.0
  https://nextras.org/orm/docs/4.0/migrate_4.0#toc-deprecations

Changelogs summary:

 - nette/tokenizer removed (installed version was v3.1.1)

 - phpstan/phpdoc-parser installed in version 2.0.0
   Release notes: https://github.com/phpstan/phpdoc-parser/releases/tag/2.0.0

 - nextras/dbal updated from v4.0.5 to v5.0.1 major
   See changes: nextras/dbal@v4.0.5...v5.0.1
   Release notes: https://github.com/nextras/dbal/releases/tag/v5.0.1

 - nextras/orm updated from v4.0.7 to v5.0.0 major
   See changes: nextras/orm@v4.0.7...v5.0.0
   Release notes: https://github.com/nextras/orm/releases/tag/v5.0.0

 - nextras/orm-phpstan updated from v1.0.1 to v2.0.0 major
   See changes: nextras/orm-phpstan@v1.0.1...v2.0.0
   Release notes: https://github.com/nextras/orm-phpstan/releases/tag/v2.0.0
  • Loading branch information
jtojnar committed Jan 5, 2025
1 parent a3a9b41 commit 87de7d9
Show file tree
Hide file tree
Showing 18 changed files with 163 additions and 121 deletions.
10 changes: 8 additions & 2 deletions app/Model/Orm/BaseMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,17 @@

namespace App\Model\Orm;

use Nextras\Orm\Entity\IEntity;
use Nextras\Orm\Mapper\Dbal\Conventions\Conventions;
use Nextras\Orm\Mapper\Dbal\Conventions\IConventions;
use Nextras\Orm\Mapper\Mapper;
use Nextras\Orm\Mapper\Dbal\DbalMapper;

class BaseMapper extends Mapper {
/**
* @template E of IEntity
*
* @extends DbalMapper<E>
*/
class BaseMapper extends DbalMapper {
protected function createConventions(): IConventions {
$conventions = parent::createConventions();
\assert($conventions instanceof Conventions); // property is not available on interface
Expand Down
3 changes: 3 additions & 0 deletions app/Model/Orm/Country/CountryMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,8 @@

use App\Model\Orm\BaseMapper;

/**
* @extends BaseMapper<Country>
*/
final class CountryMapper extends BaseMapper {
}
3 changes: 3 additions & 0 deletions app/Model/Orm/Country/CountryRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

use Nextras\Orm\Repository\Repository;

/**
* @extends Repository<Country>
*/
final class CountryRepository extends Repository {
public static function getEntityClassNames(): array {
return [Country::class];
Expand Down
3 changes: 3 additions & 0 deletions app/Model/Orm/Invoice/InvoiceMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
use Nette\Utils\Json;
use Nextras\Orm\Mapper\Dbal\Conventions\IConventions;

/**
* @extends BaseMapper<Invoice>
*/
final class InvoiceMapper extends BaseMapper {
protected function createConventions(): IConventions {
$conventions = parent::createConventions();
Expand Down
3 changes: 3 additions & 0 deletions app/Model/Orm/Invoice/InvoiceRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

use Nextras\Orm\Repository\Repository;

/**
* @extends Repository<Invoice>
*/
final class InvoiceRepository extends Repository {
public static function getEntityClassNames(): array {
return [Invoice::class];
Expand Down
3 changes: 3 additions & 0 deletions app/Model/Orm/ItemReservation/ItemReservationMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
use App\Model\Orm\BaseMapper;
use Nextras\Dbal\Result\Result;

/**
* @extends BaseMapper<ItemReservation>
*/
final class ItemReservationMapper extends BaseMapper {
public function getStats(): Result {
$query = $this->builder()->select('name')->addSelect('COUNT(*) AS cnt')->groupBy('name')->getQuerySql();
Expand Down
2 changes: 2 additions & 0 deletions app/Model/Orm/ItemReservation/ItemReservationRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
use Nextras\Orm\Repository\Repository;

/**
* @extends Repository<ItemReservation>
*
* @property ItemReservationMapper $mapper
*/
final class ItemReservationRepository extends Repository {
Expand Down
3 changes: 3 additions & 0 deletions app/Model/Orm/Message/MessageMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,8 @@

use App\Model\Orm\BaseMapper;

/**
* @extends BaseMapper<Message>
*/
final class MessageMapper extends BaseMapper {
}
3 changes: 3 additions & 0 deletions app/Model/Orm/Message/MessageRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

use Nextras\Orm\Repository\Repository;

/**
* @extends Repository<Message>
*/
final class MessageRepository extends Repository {
public static function getEntityClassNames(): array {
return [Message::class];
Expand Down
3 changes: 3 additions & 0 deletions app/Model/Orm/Person/PersonMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,8 @@

use App\Model\Orm\BaseMapper;

/**
* @extends BaseMapper<Person>
*/
final class PersonMapper extends BaseMapper {
}
3 changes: 3 additions & 0 deletions app/Model/Orm/Person/PersonRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

use Nextras\Orm\Repository\Repository;

/**
* @extends Repository<Person>
*/
final class PersonRepository extends Repository {
public static function getEntityClassNames(): array {
return [Person::class];
Expand Down
2 changes: 1 addition & 1 deletion app/Model/Orm/Team/Team.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function setJsonData(array|\stdClass $data): void {
}

public function getterLastInvoice(): Invoice {
$invoice = $this->invoices->get()->orderBy(['timestamp' => 'DESC'])->fetch();
$invoice = $this->invoices->toCollection()->orderBy(['timestamp' => 'DESC'])->fetch();

if ($invoice === null) {
throw new \Exception('Team has no invoice!');
Expand Down
3 changes: 3 additions & 0 deletions app/Model/Orm/Team/TeamMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,8 @@

use App\Model\Orm\BaseMapper;

/**
* @extends BaseMapper<Team>
*/
final class TeamMapper extends BaseMapper {
}
3 changes: 3 additions & 0 deletions app/Model/Orm/Team/TeamRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

use Nextras\Orm\Repository\Repository;

/**
* @extends Repository<Team>
*/
final class TeamRepository extends Repository {
public static function getEntityClassNames(): array {
return [Team::class];
Expand Down
3 changes: 3 additions & 0 deletions app/Model/Orm/Token/TokenMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,8 @@

use App\Model\Orm\BaseMapper;

/**
* @extends BaseMapper<Token>
*/
final class TokenMapper extends BaseMapper {
}
3 changes: 3 additions & 0 deletions app/Model/Orm/Token/TokenRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
use Nette\Utils\Random;
use Nextras\Orm\Repository\Repository;

/**
* @extends Repository<Token>
*/
final class TokenRepository extends Repository {
public static function getEntityClassNames(): array {
return [Token::class];
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@
"nette/utils": "~3.0",
"nextras/form-components": "^1.0.0",
"nextras/forms-rendering": "@dev",
"nextras/orm": "~4.0",
"nextras/orm": "^5.0",
"pelago/emogrifier": "^7.0",
"tracy/tracy": "~2.6"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.0",
"nette/tester": "^2.2.0",
"nextras/mail-panel": "^2.5",
"nextras/orm-phpstan": "^1.0",
"nextras/orm-phpstan": "^2.0",
"php-parallel-lint/php-parallel-lint": "^1.3",
"phpstan/phpstan": "^1.5",
"phpstan/phpstan-nette": "^1.0"
Expand Down
Loading

0 comments on commit 87de7d9

Please sign in to comment.