Nette Kdyby/Doctrine – Doctrine\ORM\Mapping\ClassMetadata error
Upozornění: Tohle vlákno je hodně staré a informace nemusí být platné pro současné Nette.
- Attanon
- Člen | 25
Zdravím,
mám menší problém. Aktualizoval jsem nette a s ním i doctrine (používám kdyby/doctrine). A po aktualizaci jsem narazil na chybu, kterou mi má aplikace pořád hází.
Service ‚138‘: Service of type Doctrine\ORM\Mapping\ClassMetadata needed by Doctrine\ORM\EntityRepository::__construct() not found. Did you register it in configuration file?
Tady je můj config.neon
#
# SECURITY WARNING: it is CRITICAL that this file & directory are NOT accessible directly via a web browser!
#
# If you don't protect this directory from direct web access, anybody will be able to see your passwords.
# https://nette.org/en/security-warning
#
extensions:
console: Kdyby\Console\DI\ConsoleExtension
events: Kdyby\Events\DI\EventsExtension
annotations: Kdyby\Annotations\DI\AnnotationsExtension
doctrine: Kdyby\Doctrine\DI\OrmExtension
migrations: Ope\DI\Extension\MigrationsExtension
translation: Kdyby\Translation\DI\TranslationExtension
translation:
resolvers:
request: on
default: cs
whitelist: [cs, en, es, ru]
dirs: [%appDir%/locale]
includes:
- doctrine.config.neon
- migrations.config.neon
- console.config.neon
#- authentication.config.neon
- system/domain.config.neon
- system/model.config.neon
- system/presenter.config.neon
- system/form.config.neon
- system/controls.config.neon
- system/configuration.config.neon
php:
date.timezone: Europe/Prague
session.save_path: "%tempDir%/sessions"
zlib.output_compression: yes
nette:
application:
errorPresenter: Error
mapping:
"*": "Ope\\*\\*Presenter"
session:
expiration: 14 days
autoStart: true
services:
- Ope\RouterFactory
- Ope\Templating\Helpers
- Ope\Security\Md5PasswordHash
- Ope\Application\Settings\SystemSettings
- Ope\Cache\CacheManager
- Ope\Tools\ImageTool
- Nette\Mail\Message
- Ope\Mail\MailSender
- Ope\Application\SessionStorage
router: @Ope\RouterFactory::createRouter
authenticator: Ope\Security\Authenticators\BackendAuthenticator
cache:
class: Nette\Caching\Cache
cacheStorage:
#class: Nette\Caching\Storages\MemcachedStorage()
class: Nette\Caching\Storages\FileStorage("%tempDir%/cache")
doctrine.config.neon
doctrine:
console: true
driver: pdo_mysql
host: 127.0.0.1
user: JVR
password: JVR
dbname: JVR
charset: utf8
metadata:
JVR: %appDir%/libs
proxyDir: %tempDir%/proxies
proxyNamespace: JVR\Domain\Proxies
autoGenerateProxyClasses: true
dql:
string:
ifnull: DoctrineExtensions\Query\Mysql\IfNull
services:
-
class: JVR\Doctrine\Listeners\ChangeOrderListener
tags: [kdyby.subscriber]
-
class: JVR\Doctrine\Listeners\CacheListener
tags: [kdyby.subscriber]
-
class: Doctrine\ORM\Tools\Console\Command\InfoCommand
tags: [kdyby.console.command]
-
class: Doctrine\ORM\Tools\Console\Command\ValidateSchemaCommand
tags: [kdyby.console.command]
-
class: Doctrine\ORM\Tools\Console\Command\RunDqlCommand
tags: [kdyby.console.command]
system/domain.config.neon
services:
-
class: JVR\Domain\Users\UserDao(@doctrine.dao(JVR\Domain\Users\UserEntity))
-
class: JVR\Domain\ValueMaps\ValueMapDao(@doctrine.dao(JVR\Domain\ValueMaps\ValueMapEntity))
-
class: JVR\Domain\Transports\TransportDao(@doctrine.dao(JVR\Domain\Transports\TransportEntity))
-
class: JVR\Domain\Product\ProductDao(@doctrine.dao(JVR\Domain\Product\ProductEntity))
-
class: JVR\Domain\Product\ProductVariationDao(@doctrine.dao(JVR\Domain\Product\ProductVariationEntity))
-
class: JVR\Domain\Product\ImageDao(@doctrine.dao(JVR\Domain\Product\ImageEntity))
-
class: JVR\Domain\Product\ProductAttributeDao(@doctrine.dao(JVR\Domain\Product\ProductAttributeEntity))
-
class: JVR\Domain\Order\AddressDao(@doctrine.dao(JVR\Domain\Order\AddressEntity))
-
class: JVR\Domain\Order\OrderItemDao(@doctrine.dao(JVR\Domain\Order\OrderItemEntity))
-
class: JVR\Domain\Order\OrderDao(@doctrine.dao(JVR\Domain\Order\OrderEntity))
-
class: JVR\Domain\Order\OrderStateDao(@doctrine.dao(JVR\Domain\Order\OrderStateEntity))
- JVR\Orders\OrderStateProcessor
-
class: JVR\Domain\Pages\PageDao(@doctrine.dao(JVR\Domain\Pages\PageEntity))
Můžete mi prosím poradit co s tím, nějak se mi tím nedaří prokousat. A nechce se mi to psát celé znovu.
- Filip Procházka
- Moderator | 4668
Tohle by to mělo vyřešit https://github.com/…ine/pull/191
Každopádně, pokud si injektuješ do těch služeb DAO z entitymanageru, nemá smysl aby ty služby samotné dědily od DAO.