Nettrine / Doctrine – Doctrine DBAL 4.x + ORM 3.x

Felix
Nette Core | 1245
+
+8
-

Nettrine balicky prosly tento mesic velkou aktualizaci a pridaly spoustu novych funkci. Osobne z toho mam velmi dobry pocit.

Features

  1. Podpora aktualni Doctrine DBAL 4.x.
  2. Podpora aktualni Doctrine ORM 3.x.
  3. Podpora pro vice databazi.
  4. Podpora pro Doctrine middlewares.

Deprecations

  1. Odstranena podpora pro anotace.
  2. Odstranena podpora pro doctrine/cache.

Doctrine DBAL 4.x + ORM 3.x

Co noveho prinasi Doctrine se muzete docist primo na oficialnich strankach:

Existuji i upgrade manualy primo od Doctrine teamu:

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.