Pop quiz: You’ve got your head wrapped around Magento 2’s dependency injection. You’re taking a stroll through the code base, and you see this constructor. #File: lib/Magento/PubSub/Event/QueueHandler.php public function __construct(MagentoPubSubEventQueueReaderInterface $eventQueue, MagentoPubSubJobQueueWriterInterface [...]
astorm
While the concept of The Global Config still exists in Magento, a module’s etc/config.xml is no longer the place where developers will enter most of a module’s configuration. In fact, if you try to use a Magento 1 config.xml file in Magento 2 and turn on developer mode, you’ll be greeted by the following. Invalid XML in [...]
astorm
Magento 2: Translation Mechanism An explanation of Magento 2’s translation mechanism. (Pro Tip; European developers will love your open source project forever it it’s easily translatable)
astorm
Not a comprehensive guide, and as always, let the core module’s be your guide. Router configuration has been moved from config.xml to etc/frontend/routes.xml and etc/backend/routes.xml There’s still a routerName/frontName distinction, although the router’s name is specified with an id attribute instead of the node name [...]
astorm
Magento 2: Auto Dependency Injection: No Comments Required Something something assumptions. It turns out the Magento 2 automatic dependency injection does not rely on PHPDoc comments. Instead, it (appears) to be reflection based. ALso worth noting — the core team is strongly discouraging direct use of the object manager.
astorm
Class rewrites were, in many ways, that killer developer feature of Magento 1. Killer as in “Woah, awesomely powerful thing PHP developers don’t normally get to do”, and killer as in “Oh crud, we’ve killed the site with too many rewrites that are conflicting with each other”. One of the promises of [...]
astorm
I looks like eBay threw another Magento 2 release over the wall into GitHub today. I’m going to start tagging entries here with a specific dev release tag as well as the generic magento2 tag. First big change? The object manager we’ve been discussing is a different class. When you want to grab an instance of it, you can use [...]
astorm
In Magento 1 there were three “types” of classes which you could instantiate via Magento’s various object factories: Models, Blocks, and Helpers Mage::getModel('group/class'); Mage::helper('group/class'); Mage::getSingleton('core/layout')->createBlock('group/class'); In Magento 2, all classes are available to the [...]
astorm
Another consequence of losing the global Mage class in Magento 2 is the loss of the getBaseDir method. Fortunatly, the team behind Magento 2 has a solution, the MagentoAppDir object. You can use this object to get the base directory of your Magento system. $object_manager = MagentoCoreModelObjectManager::getInstance(); $dir = [...]
astorm
Magento 1 was littered with translation functions. Helper objects, block objects, and the PHP global namespace all had a __ function or method. Magento 2 does away with this. Core team developers have removed the __ method from the base block and helper classes, leaving only the global __ function for translations. If that didn’t [...]
astorm
When you’re converting you Magento modules to Magento 2, make sure your helper classes have a _moduleName property. protected $_moduleName='Packagename_Modulename' I ran into an issue where the isModuleOutputEnabled method relied on this value being set. If the property isn’t there, Magento will attempt to infer a module name [...]
astorm
OpenERP Magento Connector — OpenERP Magento Connector documentation I’ve never used it, but it looks like some OpenERP folks are still supporting/developing a Magento connector. via Stefan Rijnhart
astorm
With the loss of the Mage class in Magento 2, you may be wondering how to instantiate a helper object. That is, the following will product an error in Magento 2 $helper = Mage::helper('core/data'); Similar to the object manager, Magento 2 has a helper factory which lets you instantiate helper methods. In fact, you use the object manager [...]
astorm
Recent builds of Magento 2 have done away with the global Mage class. There are pros and cons to this, and I feel a more in depth blog post stirring in my gut, but that will need to wait for another time. Of more immediate concern: without a Mage class, how does a developer instantiate model or magento-singleton object? The [...]
astorm
mysql – Force InnoDB to recheck foreign keys on a table/tables? – Stack Overflow Not strictly Magento related, but an interesting thread on Stack Overflow about checking your MySQL system for invalid foreign key data. (PostgreSQL folks: Please stop laughing)
astorm
I just grabbed the latest Magento 2 from source, and suddenly PHP was complaining about a method declaration PHP Fatal error: Declaration of MagentoCoreModelUrlProxy::setRequest() must be compatible with MagentoUrlInterface::setRequest(MagentoAppRequestInterface $request) in [...]
astorm
Post Deployment Database Tests Interesting series of tests Copious uses to ensure a Magento deployment went as intended.
astorm
Two Fridays ago I attended a mid-day tech talk at Copious, a fast growing agency here in Portland, OR. The talk was called Scaling Magento, but Copious isn't a Magento agency. Copious is a full service digital strategy agency, and one of the rare
astorm
I'm happy to announce a new chapter in my Leanpub published book, No Frills Command Line Magento. The new chapter Built in Shell Commands covers the three shell commands that ship with Magento. You'll learn how to clean log files, reindex the site, and
astorm
If you’re not paying attention, eBay has been a little more proactive on the Magento 2 front. The code dumps are coming regularly to git. Of course, this means the shifts in architecture direction are also coming regularly to git. In Magento 1 we had module declaration files. These lived in app/etc/modules/*.xml and [...]
astorm