Pozor na nové verze doctrine/common 3.0.0 nekompatibilní s Nettrine

Petr Parolek
Člen | 455
+
+5
-

Ahoj, kdyby se někdo začal divit jako já, proč se mu rozbila aplikace.

Začalo mi házet chybu: Error Class 'Doctrine\Common\Persistence\AbstractManagerRegistry' not found

Vyřešil jsem problém takto:

composer require doctrine/common:<3.0.0

@Felix nebylo by dobré zamknout verze na doctrine 2, aby se nestahovala 3? Navrhuju přidat do https://github.com/…omposer.json něco takového:

"doctrine/common": "^2.10"

a vydat i opravnou verzi pro nette 2.4 nettrine/orm 0.3.1

esorimer
Člen | 114
+
0
-

Zdravím,
mohl by mi prosím někdo pomoci s rozchozením netrrine?
Zkoušel jsem to podle https://github.com/…cs/README.md#…, ale je to pro mě gibberish.

Instaloval jsem pomocí:

composer require "doctrine/common:<3.0.0"
composer require nettrine/orm
composer require nettrine/dbal
composer require contributte/console

Příkaz:

composer require nettrine/cache

vrátí chybu:

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - nettrine/annotations v0.6.1 requires nettrine/cache ^0.1.0 -> satisfiable by nettrine/cache[v0.1.0] but these conflict with your requirements or minimum-stability.
    - nettrine/annotations v0.6.1 requires nettrine/cache ^0.1.0 -> satisfiable by nettrine/cache[v0.1.0] but these conflict with your requirements or minimum-stability.
    - nettrine/annotations v0.6.1 requires nettrine/cache ^0.1.0 -> satisfiable by nettrine/cache[v0.1.0] but these conflict with your requirements or minimum-stability.
    - Installation request for nettrine/annotations (locked at v0.6.1) -> satisfiable by nettrine/annotations[v0.6.1].

V konfigu mám:

extensions:
        console: Contributte\Console\DI\ConsoleExtension(%consoleMode%)
        nettrine.orm: Nettrine\ORM\DI\OrmExtension
        nettrine.cache: Nettrine\Cache\DI\CacheExtension
        nettrine.orm.console: Nettrine\ORM\DI\OrmConsoleExtension(%consoleMode%)
        nettrine.orm.annotations: Nettrine\ORM\DI\OrmAnnotationsExtension

nettrine.orm.annotations:
  namespaces: []
  paths: []
  excludePaths: []

Pak dostanu chybu
Service of type ‚Doctrine\DBAL\Connection‘ not found.

V dokumentaci je odkaz na https://github.com/…ettrine.neon Project, ve kterém ale vypadá konfigurace úplně jinak! A ikdyž použiju to co je v tomto projektu, tak mi to nefunguje :/
(**The mandatory option ‚orm.annotations › namespaces‘ is missing. **)

S tímhle:

extensions:
        console: Contributte\Console\DI\ConsoleExtension(%consoleMode%)
		dbal: Nettrine\DBAL\DI\DbalExtension
        nettrine.orm: Nettrine\ORM\DI\OrmExtension
        nettrine.cache: Nettrine\Cache\DI\CacheExtension
        nettrine.orm.console: Nettrine\ORM\DI\OrmConsoleExtension(%consoleMode%)
        nettrine.orm.annotations: Nettrine\ORM\DI\OrmAnnotationsExtension

nettrine.orm:
        configuration:
                autoGenerateProxyClasses: %debugMode%

nettrine.orm.annotations:
       namespaces: []
       paths: []
       excludePaths: []

dostanu chybu

Service ‚nettrine.orm.annotations.annotationDriver‘ (type of Doctrine\Persistence\Mapping\Driver\MappingDriver): Service of type Doctrine\Common\Annotations\Reader needed by $reader in Nettrine\ORM\Mapping\AnnotationDriver::__construct() not found. Did you register it in configuration file?

A krom toho v konzoli bin/console nevypíše žádné orm příkazy.

esorimer
Člen | 114
+
0
-

Nějaké nápady?

Felix
Nette Core | 1245
+
0
-

@ppar nettrine/orm v0.6.1 (https://github.com/…s/tag/v0.6.1) uz ma zamknutou verzi Doctrine.

esorimer
Člen | 114
+
0
-

Felix napsal(a):

@ppar nettrine/orm v0.6.1 (https://github.com/…s/tag/v0.6.1) uz ma zamknutou verzi Doctrine.

Pořád stejná chyba:
Service ‚nettrine.orm.annotations.annotationDriver‘ (type of Doctrine\Persistence\Mapping\Driver\MappingDriver): Service of type Doctrine\Common\Annotations\Reader needed by $reader in Nettrine\ORM\Mapping\AnnotationDriver::__construct() not found. Did you register it in configuration file?

nightfish
Člen | 518
+
0
-

Pořád stejná chyba:
Service ‚nettrine.orm.annotations.annotationDriver‘ (type of Doctrine\Persistence\Mapping\Driver\MappingDriver): Service of type Doctrine\Common\Annotations\Reader needed by $reader in Nettrine\ORM\Mapping\AnnotationDriver::__construct() not found. Did you register it in configuration file?

@esorimer Přidej si ještě extension:

nettrine.annotations: Nettrine\Annotations\DI\AnnotationsExtension

Viz https://github.com/…ettrine.neon#L15

esorimer
Člen | 114
+
0
-

@esorimer Přidej si ještě extension:

nettrine.annotations: Nettrine\Annotations\DI\AnnotationsExtension

Viz https://github.com/…ettrine.neon#L15

Díky, tohle už trochu pomohlo, ale ještě to nedokáže najít mapping:

bin/console orm:info

!
! [CAUTION] You do not have any mapped Doctrine ORM entities according to the current configuration.
!
!           If you have entities or mapping files you should check your mapping configuration for errors.

V configu mam toto:

extensions:
        console: Contributte\Console\DI\ConsoleExtension(%consoleMode%)
        dbal: Nettrine\DBAL\DI\DbalExtension
        nettrine.orm: Nettrine\ORM\DI\OrmExtension
        nettrine.cache: Nettrine\Cache\DI\CacheExtension
        nettrine.orm.console: Nettrine\ORM\DI\OrmConsoleExtension(%consoleMode%)
        nettrine.orm.annotations: Nettrine\ORM\DI\OrmAnnotationsExtension
        nettrine.annotations: Nettrine\Annotations\DI\AnnotationsExtension
        nettrine.migrations: Nettrine\Migrations\DI\MigrationsExtension

nettrine.orm.annotations:
        paths:
                - %appDir%/model/entity
        namespaces:
                - App\Model\Entity

        #cache: Doctrine\Common\Cache\FilesystemCache
        #cacheDir: '%tempDir%/cache/Doctrine.Annotations'

nettrine.migrations:
        directory: %appDir%/migrations

A v app/model/entity/Buyrequest.php toto:

<?php
namespace App\Model\Entity;

use Doctrine\ORM\Mapping as ORM;


/**
 * @ORM\Entity
 * @ORM\Table(name="buyrequest")
 */
class Buyrequest {
   /**
     * @ORM\Id
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue
     * @var int
     */
    protected $id;

    /**
     * @ORM\Column(type="string")
     * @var string
     */
    protected $email;


    public function getId()
    {
        return $this->id;
    }

    public function getEmail() : string
    {
        return $this->email;
    }

    public function setEmail(string $email) : void
    {
        $this->email = $email;
    }
}

?>
esorimer
Člen | 114
+
0
-

Tak stačilo smazat cache. Už to běží! :-)

piskotek
Člen | 35
+
0
-

ahoj, aktualizoval jsem contributte/webapp-skeleton a od té doby mi to dává tento error.
Poradíte mi co s tím?

Unexpected option 'nettrine.orm.annotations › namespaces', 'nettrine.orm.annotations › paths'.

composer

		"nettrine/annotations": "^0.6.2",
		"nettrine/orm": "^0.7.1",
		"nettrine/dbal": "^0.6.4",
		"nettrine/cache": "^0.2.0",
		"nettrine/migrations": "^0.7.0",
		"nettrine/fixtures": "^0.5.1",
		"mongodb/mongodb": "^1.5",
		"symfony/filesystem": "^5.1",
		"contributte/redis": "^0.2.2",

nettrine.neon

nettrine.orm.annotations:
	namespaces:
		- App\Model\Database\Entity
	paths:
		- %appDir%/model/Database/Entity

config je komplet podle návodu na webu

Michal Hlávka
Člen | 190
+
+1
-

Smaz si kompletne balicky Nettrine, udelej si zavilost v composeru na doctrine/common:^2.13.1 a pak nainstalu Nettrine balicky. Bude ti fungovat namespaces spolu s paths.

toka
Člen | 253
+
0
-

piskotek napsal(a):

ahoj, aktualizoval jsem „contributte/webapp-skeleton“ a od té doby mi to dává tento error.
Poradíte mi co s tím?

Unexpected option 'nettrine.orm.annotations › namespaces', 'nettrine.orm.annotations › paths'.

composer

		"nettrine/annotations": "^0.6.2",
		"nettrine/orm": "^0.7.1",
		"nettrine/dbal": "^0.6.4",
		"nettrine/cache": "^0.2.0",
		"nettrine/migrations": "^0.7.0",
		"nettrine/fixtures": "^0.5.1",
		"mongodb/mongodb": "^1.5",
		"symfony/filesystem": "^5.1",
		"contributte/redis": "^0.2.2",

nettrine.neon

nettrine.orm.annotations:
	namespaces:
		- App\Model\Database\Entity
	paths:
		- %appDir%/model/Database/Entity

config je komplet podle návodu na webu

Uprav si konfiguraci následovně:

nettrine.orm.annotations:
	mapping:
		App\Model\Database\Entity: %appDir%/model/Database/Entity
Felix
Nette Core | 1245
+
+2
-

Aktualne vysla nove verze Nettrine, ktera podporuje Doctrine DBAL 4.x a ORM 3.x. Doporucuju aktualizovat, zjednodusil se i zapis konfigurace.