Custom Class / Extending Object?
The examples in app.php show only how to override a built-in core class. For instance, if I want a Car class, where would the class file go so that it auto loads? Do I need to register it somehow in app.php?
Thanks for any pointers,
Anyone got any insights?
$symfonyLoader->addPrefix(NAMESPACE_SEGMENT_APPLICATION . '\\Core', DIR_APPLICATION . '/' . DIRNAME_CLASSES);
...should be added to...
...at around line 83, no? Or am I missing something?
If I'm off base here, please ignore the PR and point me in the right direction.
> way to override specific methods of core classes in 5.7...
It turns out the pull request I referenced was accepted, and it fixed the override issue. Overriding in 5.7 is actually easier than in 5.6. See app.php in the config directory for examples in the comments.
Creating a custom class based on a core class and using it in your own code is straightforward, but simply overriding/extending a core class (so that the rest of the core uses your implementation) is not. It seems the best (and proper) solution would be to fully exploit IoC and dependency injection throughout the core code -- i.e. using Core::bind() and Core::make() -- but that would entail some major refactoring.
Or am I missing something? Can anyone provide any insights or assistance?