Magento 2 - Release 2.0.0.0-dev46

Magento 2 - Release 2.0.0.0-dev46

It is that time again. Magento (Ebay) has published a new release of the Community Edition 2 version. A select group of partners already had the pleasure of getting an exclusive look at the new features a few days earlier in Chicago and sharing their opinions. Personally, I find that rather disappointing. Germany in particular has many developers who would certainly like to be a little more involved in development. Not that Varien (Magento) placed much value on actively engaging with the community in the past... A shame; Ebay has missed another opportunity here.

But now, on to the new features...

Translations

All __() methods have been removed from models and helpers and replaced with a new global function. This can now be found in app/code/Magento/Core/functions.php. A corresponding new i18n tool has been provided under dev/tools/Magento/Tools/I18n. However, the tool was broken for me.

JavaScript translations previously used the jstranslate.xml file. This has now been removed, and the default translations moved into the helper "app/code/Magento/Core/Helper/Js.php". We will have to see how JS translations can be maintained now.

Configurations

Some requests from the past have been implemented here. There are now XSD files to validate the data. Very nice. As part of this, however, the syntax of the configuration files had to be adjusted slightly. If you want to take a look at the XSDs, you will find some in the Core module, for example. The new XSD for the layout XML files is there too. Really very handy.

Examples:

  • app/code/Magento/Core/etc/cache.xsd
  • app/code/Magento/Core/etc/layouts.xsd

Prototype Replaced by jQuery

According to the changelog, Prototype has now been completely replaced. This was certainly one of the most labor-intensive changes.

Modules that want to provide a special configuration through their own file under "etc" can now use the class "\Magento\Core\Model\Config\Modules\Reader", which searches all modules for the relevant file and provides a combined configuration. The reader can be made directly available through dependency injection.

Mage Class Removed

The god class Mage has been removed. Anyone used to creating objects using Mage::getModel will now have to adapt. Modern approaches such as dependency injection are now used here. If you are not really used to this yet, you will have to acquire quite a bit of knowledge. The demands placed on developers are therefore increasing significantly. The advantage is certainly code that is easy to test.

The 4640 unit tests in the Magento 2 suite run in under 2 minutes for me, because everything can easily be tested through mock objects, so there is no need to run unnecessary DB queries to test the functionality of a product type, for example.

magento2_unittests

Mage Becomes \Magento

All classes beginning with "Mage" have been renamed to "Magento". This affects all core modules. The long class names have also become short class names combined with PHP namespaces. For me, this is a long-overdue change.

Example:

Mage_Catalog_Model_Product becomes Magento\Catalog\Model\Product

Renaming causes problems with classes such as Mage_Core_Block_Abstract, for example, because PHP does not allow a class to simply be called "Abstract", as this is a reserved word. The same applies to some interfaces.

Example:

Mage_Core_Block_Abstract becomes \Magento\Core\Block\AbstractBlock

All classes now follow the PSR-1 and PSR-2 standards.

Removed Functionality

The Poll module has been removed. I will not shed any tears over it, since I removed it in every project through the theme's local.xml anyway.

The following events have been removed:

  • adminhtml_widget_container_html_before
  • admin_session_user_logout
  • model_config_data_save_before
  • admin_system_config_section_save_after
  • backend_menu_load_after
  • catalog_controller_category_init_before
  • catalog_helper_output_construct
  • catalog_controller_product_init
  • catalog_category_tree_move_before
  • catalog_category_tree_move_after
  • catalog_product_website_update_before
  • catalog_product_website_update
  • catalog_product_media_save_before
  • catalog_product_media_add_image
  • catalog_product_type_grouped_price
  • catalog_product_collection_load_before
  • catalogsearch_index_process_start
  • catalogsearch_index_process_complete
  • cms_page_get_available_statuses
  • cms_wysiwyg_config_prepare
  • application_clean_cache
  • theme_copy_after
  • customer_registration_is_allowed
  • log_log_clean_before
  • log_log_clean_after
  • sales_convert_quote_payment_to_order_payment
  • sales_convert_quote_item_to_order_item
  • sales_quote_config_get_product_attributes

Plugins can now be used here.

Web Services

The web services have been refactored and moved into the Magento\Webapi module. There is now OData authentication for the SOAP interface. This was already familiar for the REST interface.

Layouts

As mentioned above, layouts have been reworked so that they can be validated through XSD. This also affects the syntax. Since the last release, handles have been moved into individual files. The filename defines the handle name here (the principle of convention over configuration). One major change now is the removal of <action> elements. Parameters must now be specified directly in the <block> element. This is certainly consistent with the switch to "constructor dependency injection".

PHP 5.4 and PHP 5.5 Compatibility

The source is now compatible with the current PHP version 5.5. A good step that offers quite a few performance benefits. Modern Linux distributions have offered versions newer than PHP 5.3 for a long time anyway. I think most developers have at least PHP 5.4 installed.

So, that was my first look. Since there were a great many file changes this time, it is very difficult to review them all. Perhaps you have discovered something great. I look forward to your comments on Magento 2.