How to access database from Authorizator?
- kevin.waterson@gmail.com
- Member | 81
When using roles/entitlements/resources from a database, how best to access the database?
If I use try to access via the constructor, I get an error
<?php
public function __construct(\Nette\Database\Context $context)
{
// ......
}
?>
ArgumentCountError
Too few arguments to function App\Model\DrpAuthorization::__construct(),
0 passed
Because no context is passed when instantiated?
Or is there another preferred method of accessing the database?
Last edited by kevin.waterson@gmail.com (2019-12-09 10:16)
- kevin.waterson@gmail.com
- Member | 81
MajklNajt wrote:
how you get an intance of
App\Model\DrpAuthorization
?is registred as service in
config.neon
?services: - App\Model\DrpAuthorization
then it will work with autowiring… otherwise you must pass arguments to contructor manualy
yes, but it was also being called in the startup() function.
Thanks for the pointer.