feat: customize name of Shield Tables#628
feat: customize name of Shield Tables#628datamweb wants to merge 15 commits intocodeigniter4:developfrom
Conversation
566dec8 to
52423f1
Compare
I also have no error on my local environment. |
The test does not seem to pass on Windows from the beginning.
|
|
@kenjis , thanks for the explanation, it made sense. |
|
I thought it could be fixed. |
|
Why? |
|
PHP 7.4: Error: Trying to get property 'tables' of non-object
------ -----------------------------------------------
Line src/Config/Constants.php
------ -----------------------------------------------
10 Trying to get property 'tables' of non-object
------ ----------------------------------------------- |
03d4069 to
9dc0525
Compare
479b840 to
07c85e1
Compare
|
@kenjis , after many efforts, I finally found the solution. |
|
@datamweb I don't know what's wrong with PHPStan. But why don't we remove the constant? Ion Auth also havs $table, but it does not use a constant. We can get the values with I gave it a try. See #633 |
The reason I used constant was to add this feature with minimal changes.( Also, I think it is easier to read and review with this implementation. For example, look at PR commit, it's easier to suggest a change for /**
* Auth Table names
*/
private array $tables;
public function __construct(?Forge $forge = null)
{
parent::__construct($forge);
/** @var Auth $authConfig */
$authConfig = config('Auth');
$this->tables = $authConfig->tables;
}
// and ...In fact, I believe that using constant makes our codes shorter and more readable. Technically yes you are right, but we have an example of using constant in Bonfire2. |
| use CodeIgniter\Shield\Filters\SessionAuth; | ||
| use CodeIgniter\Shield\Filters\TokenAuth; | ||
|
|
||
| include_once __DIR__ . '/Constants.php'; |
There was a problem hiding this comment.
I don't know we should use the constant or not.
But even if we use it, I would like to remove the include_once line and the constant file.
|
If we add |
|
Okay, we will continue in your PR. |
|
Closed by #633 |




No description provided.