Model and Presenter linking error

Upozornění: Tohle vlákno je hodně staré a informace nemusí být platné pro současné Nette.
dhosek
Člen | 12
+
0
-

Hello community,
I got a following problem with a model and a pressenter. I've just created a new file called „Hp.php“ in app\model folder. The file contains a namespace and a class.

These lines are in the Presenter:

.....
use App\Model\Hp;
/**
 * Homepage presenter.
 */
class HomepagePresenter extends BasePresenter
{
	/** @var \App\Model\Hp @inject */
    public $hp;
.....

and These lines are in config.neon:

....
services:
	- App\Model\Hp
....

But the Tracy says an error:

Nette\DI\ServiceCreationException
Class App\Model\Hp used in service ‚26_App_Model_Hp‘ not found or is not instantiable.

Thank you, regards Dan.

Lukeluha
Člen | 130
+
0
-

Show us your Hp.php file, it has to be something wrong with it.

Btw, english phorum is here

Editoval Lukeluha (8. 7. 2015 18:41)

Unlink
Člen | 298
+
0
-

Do you have

namespace App\Model;

in your Hp.php?

Editoval Unlink (8. 7. 2015 19:46)