Class and factory are missing in definition of service
Upozornění: Tohle vlákno je hodně staré a informace nemusí být platné pro současné Nette.
- esorimer
- Člen | 114
Zdravím.
Aktualizoval jsem nette na 2.3.0 a dostal jsem tuto chybu:
Nette\InvalidStateException
Ambiguous class C resolution; defined in …nette/libs/nette/tester/tests/CodeCoverage/parse/lines.php and in ../nette/libs/nette/tester/tests/CodeCoverage/parse/methods.php
Vytvořil jsem tedy soubor netterobots.txt:
Disallow: /nette/tester
A teď dostávám chybu:
Class and factory are missing in definition of service ‚database.programy‘
config.neon vypadá takto:
common:
parameters:
lang: cs
dataDir: %appDir%/../data/
php:
date.timezone: Europe/Prague
# zlib.output_compression: yes
nette:
application:
errorPresenter: Error
database:
default:
dsn: 'mysql:host=example.org;dbname=example'
user: 'example'
password: '*****'
programy:
dsn: sqlite:%dataDir%programy/programy.db3
reflection: 'discovered'
session:
autoStar: smart
expiration: 14 days
security:
frames: yes # ovlivňuje hlavičku X-Frame-Options
debugger:
email: %webmasterEmail%
services:
nette.database.programy:
setup:
- query( 'PRAGMA foreign_keys = ON' )
translator:
create: NetteTranslator\Gettext::getTranslator
setup:
- addFile(%appDir%/lang, front)
- addFile(%appDir%/lang, formMessages)
- NetteTranslator\Panel::register
logger:
class: \Nette\Logger\FileLogger
setup:
- setMinimumLogLevel( 7 )
cache: \Nette\Caching\Cache
authenticator: Authenticator
cache: \Nette\Caching\Cache
authenticator: Authenticator
authorizator:
class: \Nette\Security\Permission
setup:
- addRole('guest')
- addRole('user','guest')
- addRole('editor','user')
- addRole('admin','editor')
- addResource('Sign')
- addResource('UserProfil')
- addResource('Admin:Auth')
- addResource('Admin:Default')
- addResource('Admin:Mailing')
- addResource('Admin:Users')
- addResource('Admin:Donation')
- addResource('Admin:LoadFiles')
- allow('guest', ['Sign', 'Admin:Auth' ] )
- allow('user', 'UserProfil')
- allow('editor', 'Admin:Default')
- allow('admin')
routerFactory: RouterFactory
router: @routerFactory::createRouter
malingFactory:
class: \SX\lib\mailing\IMailingFactory
create: \SX\lib\mailing\MailingFactory
menuRepository: \SX\Model\MenuRepository
programyRepository: \SX\Model\ProgramyRepository( @nette.database.programy.context )
programVersionRepository: \SX\Model\ProgramVersionRepository( @nette.database.default.context )
...
Update:
Když ze service smažu toto:
nette.database.programy:
setup:
- query( 'PRAGMA foreign_keys = ON' )
tak uz to tu chybu nehlásí. Otázka teda je, jak to nastavit správně? Potřebuju spustit ten query …
Editoval esorimer (20. 3. 2015 14:04)