Closed pkid169 closed 5 years ago
What's the use case for making it externally configurable?
On Sep 25, 2017 7:34 PM, "Phuc Tran" notifications@github.com wrote:
Hi,
I wanna make $singleTableSubclasses configurable (i.e. store this under config and read it as something like $singleTableSubclasses = config('vehicle.subclasses');. Right now it's a static variable so this is not possible. Is there a quick way to achieve this without rewriting too much of your implementation?
Cheers
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Nanigans/single-table-inheritance/issues/38, or mute the thread https://github.com/notifications/unsubscribe-auth/AAUCIMcv8VAwpeQamdaVT5MTPon0tPM6ks5smDh2gaJpZM4Pjeqc .
Use case
We're writing an SDK. Sticking with the vehicle example - we, the SDK team, provides the base class Vehicle
. Developers who use our SDK can extend Vehicle with their own implementation.
Rationale
I don't want the developers to touch the Vehicle
class (which is where static $singleTableSubclasses
is defined currently). Instead it'll be great to read that externally via some config file, which I don't mind the developer to edit (in fact, I'll provide some tooling to automate that - e.g. think php artisan make:vehicle
).
This seems really hard to support in a non-invasive way. Its a pretty unique use case that you wouldn't have control over all the classes your storing in a single table. Closing for now. If you can provide a PR with a small footprint I'd be happy to take a look.
Hi,
I wanna make
$singleTableSubclasses
configurable (i.e. store this under config and read it as something like$singleTableSubclasses = config('vehicle.subclasses');
. Right now it's a static variable so this is not possible. Is there a quick way to achieve this without rewriting too much of your implementation?Cheers