Categories


Archives


Recent Posts


Categories


No More Class Aliases

astorm

Frustrated by Magento? Then you’ll love Commerce Bug, the must have debugging extension for anyone using Magento. Whether you’re just starting out or you’re a seasoned pro, Commerce Bug will save you and your team hours everyday. Grab a copy and start working with Magento instead of against it.

Updated for Magento 2! No Frills Magento Layout is the only Magento front end book you'll ever need. Get your copy today!

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

Mage::getModel('Mage_Core_Model_Product');

Class rewrites are still available — this just removes one level of complexity from the configuration (where you need to specify a base class name to use for an alias group).

This is probably the right choice, but I’ll miss class aliases — under the hood they may have been complicated but for day to day programming they were an elegant solution for a namespace-less PHP.

Copyright © Alana Storm 1975 – 2023 All Rights Reserved

Originally Posted: 21st August 2013

email hidden; JavaScript is required