Doctrine vlastni DAO – spatny navratovy typ App\Dao\UserDAO vs Kdyby\Doctrine\EntityDao

uchytma
Člen | 1
+
0
-

Ahoj,

snažím se přejít na verzi nette 2.4 a zasekl jsem se na následující chybě:

Return value of Container_e2bb3911f9::createServiceUserDAO() must be an instance of App\Dao\UserDAO, instance of Kdyby\Doctrine\EntityDao returned

File: .../cache/Nette.Configurator/Container_e2bb3911f9.php:5291

5281:        {
5282:            $service = $this->getService('doctrine.default.entityManager')->getRepository('Generated\UserCommissionsItem');
5283:            return $service;
5284:        }
5285:
5286:
5287:        public function createServiceUserDAO(): App\Dao\UserDAO
5288:        {
5289:            $service = $this->getService('doctrine.default.entityManager')->getRepository('Generated\User');
5290:
5291:            return $service;
5292:        }
5293:
5294:
5295:        public function createServiceUserPermissionDAO(): App\Dao\UserPermissionDAO


.../www/adela/app/vendor/nette/di/src/DI/Container.php:178	source  Container_e2bb3911f9->createServiceUserDAO()
.../www/adela/app/vendor/nette/di/src/DI/Container.php:104	source  Nette\DI\Container->createService(arguments)
.../cache/Nette.Configurator/Container_e2bb3911f9.php:2637	source  Nette\DI\Container->getService(arguments)
.../www/adela/app/vendor/nette/di/src/DI/Container.php:178	source  Container_e2bb3911f9->createService__207_App_Factory_UserFactory()
.../www/adela/app/vendor/nette/di/src/DI/Container.php:104	source  Nette\DI\Container->createService(arguments)
.../cache/Nette.Configurator/Container_e2bb3911f9.php:2145	source  Nette\DI\Container->getService(arguments)
.../www/adela/app/vendor/nette/di/src/DI/Container.php:178	source  Container_e2bb3911f9->createService__120_App_Model_UserManager()
.../www/adela/app/vendor/nette/di/src/DI/Container.php:104	source  Nette\DI\Container->createService(arguments)
.../cache/Nette.Configurator/Container_e2bb3911f9.php:5212	source  Nette\DI\Container->getService(arguments)
.../www/adela/app/vendor/nette/di/src/DI/Container.php:178	source  Container_e2bb3911f9->createServiceSecurity__user()
.../www/adela/app/vendor/nette/di/src/DI/Container.php:104	source  Nette\DI\Container->createService(arguments)
.../www/adela/app/vendor/nette/di/src/DI/Container.php:102	source  Nette\DI\Container->getService(arguments)
.../cache/Nette.Configurator/Container_e2bb3911f9.php:5336	source  Nette\DI\Container->getService(arguments)
.../nette/bootstrap/src/Bootstrap/Configurator.php:247	source  Container_e2bb3911f9->initialize()
/var/www/adela/app/app/bootstrap.php:51	source  Nette\Configurator->createContainer()
/var/www/adela/app/www/index.php:6	source  require(arguments)

Konfiguraci mám následovně:

services:
	userDAO:
	     class: App\Dao\UserDAO(Generated\User)
	     tags:
	         doctrine.repositoryEntity: Generated\User

Třídy:

<?php

class UserDAO extends BaseDAO
{
\\...
}


class BaseDAO extends \Kdyby\Doctrine\EntityDao {
	public function __construct($class, \Kdyby\Doctrine\EntityManager $em) {
		parent::__construct($em, new \Doctrine\ORM\Mapping\ClassMetadata($class));
	}
	\\...
}

?>

edit: prikladam verze:

"require": {
    "php": ">= 7.1",
    "nette/nette": "~2.4.0",
    "dg/adminer-custom": "~1.5",
    "symfony/yaml": "~2.6",
    "kdyby/doctrine": "~3.2.1",
    "nextras/datagrid": "~2.1",
    "beberlei/DoctrineExtensions": "~1.0",
    "setasign/fpdi":"~1.5.4",
	"mpdf/mpdf":"~6.0",
    "phpoffice/phpexcel": "^1.8",
	"guzzlehttp/guzzle": "~6.0",
	"salamek/raven-nette": "1.3.1",
	"kdyby/console": "~2.4.0"
}

Děkuji za pomoc.

Editoval uchytma (29. 10. 2017 15:18)

Blonďák
Člen | 11
+
0
-

Ahoj, trápím se s podobným problémem, podařilo se ti ho nějak vyřešit?