Closed rauwebieten closed 2 years ago
@rauwebieten Which adapter are you using?
I'm using the SQL adapter. https://github.com/php-casbin/database-adapter/ Guess I should submit this issue there?
Problem is (I think) following code in constructor of adapter:
public function __construct(array $config)
{
$this->config = $config;
$this->filtered = false;
$this->connection = (new Manager($config))->getConnection();
$this->initTable();
}
So initTable is called before the $casbinRuleTableName property can be modified.
@linvery
@rauwebieten See https://github.com/php-casbin/database-adapter/pull/22/files
I see in code that the initTable method is invoked in the constructor.
This means the db table is created (with the default name) before the casbinRuleTableName parameter can be set.
This also means the default table is -always- created, when you choose to use a custom table name.
I think it's better to remove the initTable invokation from the constructor, and let the developer use this method manually to create the tables.