archtechx / tenancy

Automatic multi-tenancy for Laravel. No code changes needed.
https://tenancyforlaravel.com
MIT License
3.43k stars 407 forks source link

LOG.warning tenantIdColumn is deprecated #1225

Closed emerson-oliveira closed 2 weeks ago

emerson-oliveira commented 2 weeks ago

Bug description

I am encountering a warning when using the Tenancy package. The warning indicates that accessing a static trait property is deprecated. Below is the full log message:

LOG.warning: Accessing static trait property Stancl\Tenancy\Database\Concerns\BelongsToTenant::$tenantIdColumn is deprecated, it should only be accessed on a class using the trait in C:\laragon\www\dysrup-web\vendor\stancl\tenancy\src\Database\Concerns\BelongsToTenant.php on line 19

Actual Behavior

The following deprecation warning is logged:

LOG.warning: Accessing static trait property Stancl\Tenancy\Database\Concerns\BelongsToTenant::$tenantIdColumn is deprecated, it should only be accessed on a class using the trait in C:\laragon\www\dysrup-web\vendor\stancl\tenancy\src\Database\Concerns\BelongsToTenant.php on line 19

Steps to reproduce

  1. Install the Tenancy package in a Laravel project.
  2. Trigger any functionality that uses the BelongsToTenant trait.
  3. Observe the warning in the logs.

Expected behavior

No deprecation warnings should be logged.

Laravel version

9.52.16

stancl/tenancy version

3.8.3

Environment PHP version: 8.1 Operating System: Ubuntu 20.04

stancl commented 2 weeks ago

Duplicate of https://github.com/archtechx/tenancy/issues/854

Fixed in v4, can't be fixed in v3 without breaking changes.