LLLLLLL Posted February 2, 2017 Share Posted February 2, 2017 I've been given an unfortunate task of working with magento. My question might be magento-specific, but I'm not sure that it is. In short, I'm troubleshooting something and confused. This code... $user = $this->getUser(); ...would seem to be quite easy to troubleshoot, but it is not. The current class has no getUser function. Its base class has no getUser function. If I print a debug statement to examine $this, the class I'm looking at -- Session -- isn't the class at all! $this is some other class! In fact, the class that is shown doesn't exist anywhere in the source code. So... what the heck? How can $this not be $this ?? Quote Link to comment Share on other sites More sharing options...
Jacques1 Posted February 2, 2017 Share Posted February 2, 2017 $this is some other class! What class? Methods can be entirely dynamic (via the __call method), and this makes a lot of sense for a simple getter. If you want to get a better understanding of the program, I recommend you use a debugger (e. g. XDebug). This lets you inspect all kind of values, analyze stack traces and whatnot. Quote Link to comment Share on other sites More sharing options...
LLLLLLL Posted February 2, 2017 Author Share Posted February 2, 2017 The class ends up being Magento\Backend\Model\Auth\Session\Interceptor, which isn't a class that exists. I assume it gets created on the fly? Seriously, there are 48,000 Magento files; the software is more bloat than I've ever seen. I'll look into XDebug, I guess. Quote Link to comment Share on other sites More sharing options...
Jacques1 Posted February 2, 2017 Share Posted February 2, 2017 Working with Magento is definitely not fun. If you have to do anything serious, I strongly recommend you spend a few days learning the infrastructure. Otherwise you'll quickly get lost in gigantic class hiearchies and arcane OOP tricks. Quote Link to comment Share on other sites More sharing options...
LLLLLLL Posted February 2, 2017 Author Share Posted February 2, 2017 Yes, it seems the goal was to write "clever" code instead of something that just works. It's likely we won't be using them long-term, but for now I'd love to figure out why I can't even reach the /setup folder to do anything. My error is the same that hundreds of others have reported.... as with most freeware carts, there are no solutions to be found on the interwebs. "Free carts aren't free." Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.