Nettrine / Doctrine – Doctrine DBAL 4.x + ORM 3.x
- Felix
- Nette Core | 1245
Nettrine balicky prosly tento mesic velkou aktualizaci a pridaly spoustu novych funkci. Osobne z toho mam velmi dobry pocit.
Features
- Podpora aktualni Doctrine DBAL 4.x.
- Podpora aktualni Doctrine ORM 3.x.
- Podpora pro vice databazi.
- Podpora pro Doctrine middlewares.
Deprecations
- Odstranena podpora pro anotace.
- Odstranena podpora pro doctrine/cache.
Doctrine DBAL 4.x + ORM 3.x
Co noveho prinasi Doctrine se muzete docist primo na oficialnich strankach:
- https://www.doctrine-project.org/…eleased.html
- https://www.doctrine-project.org/…2/index.html
- https://www.doctrine-project.org/…3/index.html
Existuji i upgrade manualy primo od Doctrine teamu:
- Upgrade DBAL: https://github.com/…x/UPGRADE.md
- Upgrade ORM: https://github.com/…x/UPGRADE.md
Konfigurace
Soucasti zmen bylo i vylepseni dokumentace.
Stara konfigurace
Takto vypadala stare konfigurace, kde bylo zapotrebi pouzivat vice extensions. To jiz v nove verzi neni potreba.
extensions:
console: Contributte\Console\DI\ConsoleExtension(%consoleMode%)
nettrine.annotations: Nettrine\Annotations\DI\AnnotationsExtension
nettrine.cache: Nettrine\Cache\DI\CacheExtension
nettrine.dbal: Nettrine\DBAL\DI\DbalExtension
nettrine.dbal.console: Nettrine\DBAL\DI\DbalConsoleExtension
nettrine.orm: Nettrine\ORM\DI\OrmExtension
nettrine.orm.cache: Nettrine\ORM\DI\OrmCacheExtension
nettrine.orm.console: Nettrine\ORM\DI\OrmConsoleExtension(%consoleMode%)
nettrine.orm.annotations: Nettrine\ORM\DI\OrmAnnotationsExtension
nettrine.dbal:
connection:
driver: %database.driver%
host: %database.host%
port: %database.port%
dbname: %database.dbname%
user: %database.user%
password: %database.password%
charset: UTF8
serverVersion: '15.0'
debug:
panel: %debugMode%
sourcePaths: [%appDir%]
nettrine.orm:
entityManagerDecoratorClass: App\Model\Database\EntityManagerDecorator
nettrine.orm.annotations:
mapping:
App\Domain\Database: %appDir%/Domain/Database
Nova konfigurace
Nova konfigurace vyzaduje pouze DBAL a ORM extension. Vse konfiguruje automaticky a zaroven je mozne nove pridat vice pripojeni do DB a taktez vice EntityManageru.
extensions:
console: Contributte\Console\DI\ConsoleExtension(%consoleMode%)
nettrine.dbal: Nettrine\DBAL\DI\DbalExtension
nettrine.orm: Nettrine\ORM\DI\OrmExtension
nettrine.dbal:
debug:
panel: %debugMode%
connections:
default:
driver: %postgres.driver%
host: %postgres.host%
port: %postgres.port%
dbname: %postgres.dbname%
user: %postgres.user%
password: %postgres.password%
charset: UTF8
serverVersion: 15.0.0
second:
driver: %mariadb.driver%
host: %mariadb.host%
port: %mariadb.port%
dbname: %mariadb.dbname%
user: %mariadb.user%
password: %mariadb.password%
charset: UTF8
serverVersion: 10.10.0
nettrine.orm:
managers:
default:
connection: default
mapping:
App:
type: attributes
dirs: [%appDir%/Domain/Database]
namespace: App\Domain\Database
second:
connection: second
mapping:
App:
type: attributes
dirs: [%appDir%/Domain/Database]
namespace: App\Domain\Database
Balicky
Takto muzete pouzit novou verzi jeste pred finalnim vydanim.
{
"require": {
"php": ">=8.2",
"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/fixtures": "^0.8.0",
"nettrine/migrations": "^0.10.0"
},
"prefer-stable": true,
"minimum-stability": "dev"
}
Dejte vedet jak se vam s tim pracuje.