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
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
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
At a partner only event in Chicago, members of eBay’s Magento team renewed their support for Magento 2. A few of the usual suspects were there, and a more general announcement has been promised. As for a release date? The usual. It’s interesting to look back to the Magento Developer’s Paradise conference in 2010, which [...]
astorm
Magento’s objects (that inherit from Varien_Object) have special “magic” getter and setter methods implemented with PHP’s magic __call method. If you’ve got a Magento object, you can just set and get data like this $this->setFooBar('a value'); echo $this->getFooBar(); without any setFooBar or getFooBar [...]
astorm
In Magento 2, the base Varien_Object class no longer has a custom, internal _construct method. Blocks, Controllers, Models, Resource Models, and Collections still have an internal _construct, but that’s because the core team defined _construct methods on the various abstract base classes for those objects. $ ack '->_construct' [...]
astorm
I’ve been digging into Magento 2’s layout system, and there’s significant changes from Magento 1. Conceptually, it’s still a “nested tree” of elements, but instead of just blocks there’s now a second type of thing you can add to a layout called a container. Containers look like they’re [...]
astorm
Magento 2 has “web hooks” Looks like there’s a proposal in Magento 2 for webhooks, which appear to be a a way to have Magento automatically send an HTTP POST whenever an important business logic action (customer created, order created, etc.) occurs.
astorm
3 Pillars of DI by Anton Kril Some high level overview notes on Magento 2’s dependency injection system, via simonsprankel.
astorm
magento2 – Magento 1 Class Rewrite in Magento 2 with Dependency Injection System – Magento Stack Exchange I didn’t realize this until today, but Magento 2 has completely ripped out the class rewrite system, and replaced it with a new dependency injection system. You can still rewrite a class, but instead of setting up a [...]
astorm
Populating Test Products Pure SQL solution for quickly populating Magento’s with test data. Standard warnings about using SQL and the possibility of invalid data relationships being created apply, but interesting none the less.
astorm
While you still call Mage::dispatchEvent to dispatch an event, Magento 2 has moved responsibility for event dispatch out of the Mage_Core_Mode_App class and into a stand alone Mage_Core_Model_Event_Manager class. If you’re debugging events the final dispatch method you’re interested in is #File: [...]
astorm
That last post made me realize I hadn’t mentioned one of the biggest changes to Magento 2: No more class aliases. Magento still has factory methods for instantiating objects, but instead of the shorter, more elegant, and confusing class aliases Mage::getModel('catalog/product'); You use a full PHP class name [...]
astorm
Over Magento 2’s long gestation period, there’s been a lot of back and forth on its backwards compatibility. At this point, there would need to be a major engineering effort for out of the box API compatibility with Magento 1. Extension developers will need to resign themselves to some refactoring to get their extensions [...]
astorm
The current Magento 2 source code has a number of different .htaccess files ./.htaccess ./app/.htaccess ./dev/.htaccess ./downloader/.htaccess ./downloader/template/.htaccess ./lib/.htaccess ./pub/.htaccess ./pub/errors/.htaccess ./pub/lib/.htaccess ./pub/media/.htaccess ./pub/media/customer/.htaccess ./pub/media/downloadable/.htaccess [...]
astorm
Magento 2 seems to be moving in a more Symfony/Zend 2/modern direction by splitting out the source folder (app) from the publicly browsable folder (pub). This is good, but the default distribution has a little weirdness — there’s two index.php files. There’s the one you’d expect in pub pub/index.php and then [...]
astorm
For reasons that are way too complicated to get into on Magento Quickies, while Magento 2 still has the concept of a developer mode, there’s no longer a Mage::setIsDeveloperMode method. If you’d been lazily (like me. cough) editing index.php to switch your site into developer mode, that won’t work anymore. Your only [...]
astorm
The first significant change in Magento 2? No more local, community, or even core code pools. Modules live in the top of app/code, and your modules live in their name-spaced folders. If you have any hard coded code pool paths, now’s the time to remove them.
astorm
Magento 2 Code Drop The Magento core team dropped about 4 months worth of changes to Magento 2 near the end of last week. Whatever you want to say about the core team, it can’t be that they’re sitting idle. There’s significant changes to things under the hood. Magento 2 is still a long ways off, but it’d be smart [...]
astorm