Method Nette\Database\Connection::\() used in service ‚database‘ is not callable
Upozornění: Tohle vlákno je hodně staré a informace nemusí být platné pro současné Nette.

- Arthedian
- Člen | 26
Dobrý den,
snažím se vytvořit přihlašování, ale hlásí mi to chybu
Method Nette\Database\Connection::\() used in service 'database' is not callable.:
Config:
parameters:
application:
errorPresenter: Error
mapping:
*: App\*Module\Presenters\*Presenter
session:
expiration: 14 days
services:
database:
class: Nette\Database\Connection(
'mysql:host=HOSTNAME;dbname=DBNAME'
USERNAME
PASWORD
)\
- App\FrontModule\Presenters\AccountPresenter(@database)
router: App\RouterFactory::createRouter
authenticator: MyAuthenticator(@database)
Presenter:
<?php
namespace App\FrontModule\Presenters;
use Nette,
Nette\Application\UI,
Nette\Application\UI\Form as Form;
class AccountPresenter extends Nette\Application\UI\Presenter
{
private $database;
public function __construct(\Nette\Database\Connection $database)
{
$this->database = $database;
}
.
.
.
}
Kde je chyba?

- David Matějka
- Moderator | 6445
takhle spojeni nevytvarej, pouzij extension pro database https://github.com/…g.local.neon
(jinak to bude asi tim \ u definice sluzby za ),
ktere tam nema byt)

- Arthedian
- Člen | 26
David Matějka napsal(a):
takhle spojeni nevytvarej, pouzij extension pro database https://github.com/…g.local.neon
(jinak to bude asi tim
\u definice sluzby za), ktere tam nema byt)
ježiši, to je tak hloupá chyba. Díky. Pokud použiju tvojí definici, tak
mi to právě píše
toto: Service '24_App_FrontModule_Presenters_AccountPresenter': Reference to missing service 'database'