-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Closed
Labels
Description
Description
Currently behavior methods like SomeBehavior::foo()
can be directly accessed through the table instance, the behavior is attached to, as $table->foo()
. While this was a good convenience to have back in the day, it's effectively been made redundant since the availability of traits in PHP.
The feature cause various problems:
- It adds unnecessary code and checks to proxy the call to the behavior instance when the method is called on the table instance.
- It hinders static analysis as the tools are unaware of this "magic" and requires either stubs or custom plugins to avoid "method doesn't exist" errors by the tools.
- It causes issue when trying to reflect a method argument as highlighted here
- Another issue reported below is comments is using
LocatorAwareTrait
in two behaviors and load them in the same table triggers a LogicException due to the duplicate methods check in the behavior registry.
So I propose dropping this feature and instead users can use traits.
CakePHP Version
6.0
LordSimal, Phally and rochamarcelonicosp