inject Model in Presenter – Class ‘Nette\DI\Extensions\ServiceCreationException’ not found
Notice: This thread is very old.
- Croc
- Member | 270
Hello, i have got this model:
namespace App\Model;
use Nette;
/**
* Users management.
*/
class LogManager extends Nette\Object
{
const
TABLE_NAME = 'table_name',
COLUMN_TYPE = 'type',
COLUMN_EVENT = 'event',
COLUMN_DATE = 'date';
/** @var Nette\Database\Context */
private $database;
public function __construct(Nette\Database\Context $database)
{
$this->database = $database;
}
/**
* Adds new user.
* @param string
* @param string
* @return void
*/
public function add($event, $type)
{
$this->database->table(self::TABLE_NAME)->insert(array(
self::COLUMN_TYPE => $type,
self::COLUMN_EVENT => $event,
self::COLUMN_DATE => new Nette\Utils\DateTime()
));
}
}
In presenter i want to inject this model:
/**
* @var \App\Model\LogManager
* @inject
*/
public $logManager;
but getting this error:
Class 'Nette\DI\Extensions\ServiceCreationException' not found
Did i miss something? or its a known bug?
Using 2.3.1 version
Last edited by Croc (2015-04-19 11:07)