-
-
Notifications
You must be signed in to change notification settings - Fork 444
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
PHP 8.1: Deprecation notice Accessing static trait property ($tenantIdColumn) #854
Comments
Thanks, we'll change this to use something like a config key. |
fixed ? |
1 similar comment
fixed ? |
@stancl please reopen this issue |
Oki so for everyone else wondering, I sorted it out temporarily like this: In I copied the following files from
Inside of the boot method in
In those files that I now have locally, I override any instance of Then in my models I just use the local trait I also ran I stopped seeing |
I don't think the |
You're probably right that that bit might be nnecessary. In the past when fighting with Nova overrides on unrelated stuff, adding those bind calls helped. Think I dumped it there out of habit. |
Here it just seems like you're binding your class to the package class (so it's in the opposite direction than what you'd want anyway), and I don't think it gets used because traits use PHP, not Laravel, so the service container bindings won't be able to change anything. |
@stancl I submitted a PR that resolves this for me locally. I'm not sure that it's the direction you want to go with it but that PR resolves this issue. |
Fixed in 4.x |
Bug description
I'm getting this deprecation notice (PHP 8.1):
PHP Deprecated: Accessing static trait property Stancl\Tenancy\Database\Concerns\BelongsToTenant::$tenantIdColumn is deprecated, it should only be accessed on a class using the trait in /var/www/html/vendor/stancl/tenancy/src/Database/TenantScope.php on line 20
PHP Deprecated: Accessing static trait property Stancl\Tenancy\Database\Concerns\BelongsToTenant::$tenantIdColumn is deprecated, it should only be accessed on a class using the trait in /var/www/html/vendor/stancl/tenancy/src/Database/Concerns/BelongsToTenant.php on line 19
Steps to reproduce
php artisan tinker
tenancy()->initialize(Tenant::first())
User::first()->tenant
Expected behavior
no messages
Laravel version
8.83.5
stancl/tenancy version
3.5.6
The text was updated successfully, but these errors were encountered: