-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom getConnectionName
not called on extended MagicLink
model due to usage of self
instead of static
#72
Comments
Please, feel free to submit a PR |
savander
pushed a commit
to savander/laravel-magiclink
that referenced
this issue
Aug 12, 2022
cesargb
added a commit
that referenced
this issue
Aug 13, 2022
* fixes issue #72 - use static instead of self in MagicLink class * ingonre unsafe usage of new static Co-authored-by: Adam Jaworski <[email protected]> Co-authored-by: Cesar <[email protected]>
cesargb
added a commit
that referenced
this issue
Sep 25, 2022
…#74) * fixes issue #72 - use static instead of self in MagicLink class * ingonre unsafe usage of new static Co-authored-by: Adam Jaworski <[email protected]> Co-authored-by: Cesar <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The latest change to the library broke my code:
laravel-magiclink/src/MagicLink.php
Line 93 in 82c82f9
I have extended your model class and done some modifications, such as overriding
\Illuminate\Database\Eloquent\Model::getConnectionName
to my custom one. Theself
keyword, do break the code, since it refers to the same class in which the new keyword is actually written. In that case, mygetConnectionName
is ignored and is not called.The solution would be to use
static
since it uses late static binding, which refers to the class you called the method on.It should not break your code, but enable it for further modification/extension.
Is there any reason to do that? Why would you restrict modification of your code?
In this case, other methods will also be affected, for example:
laravel-magiclink/src/MagicLink.php
Lines 165 to 177 in 82c82f9
The text was updated successfully, but these errors were encountered: