If you’re following along with Magento 2 development, you’ve probably heard the drum beat that the Model/Resource Model/Collections are old and tired, and the Repository classes are new and wired. While the move towards repositories is is a Good Thing™, a Magento 2 developers still needs to know the old CRUD system, and that [...]
astorm
How Interceptors are Generated TLDR; The object manager appends Interceptor to the class name you asked for if there’s a plugin. Then a second PHP Autoloader will look for Interceptor at the end of a classes name, and if it can’t find a definition via normal means, the autoloader generates the class.
astorm
One of the things Magento 2.1 doesn’t bring to the table is the ability to symlink your modules and other components. It’s hard to tell if this is a deliberate omission, or just something that’s not a priority for the development team and keeps getting lost in the shuffle. If you checkout the Context section of this [...]
astorm
This is another one of those 10,000 foot view posts, as much to get my own head straight about something as anything else. In programming, the term scope usually means If I’ve defined variable X “here”, where else can I access it? Magento’s core team have borrowed the term scope to described Magento’s [...]
astorm
How Can I Resolve a RequireJS Alias in Magento 2? A quick command line that will, usually, resolve those RequireJS map/shim/alias things that often obscure where a file lives in Magento 2. Spoilers find vendor/magento/ -name requirejs-config.js -exec grep addToCart '{}' +
astorm
I was investigating Magento 2’s TinyMCE implementation the other day, and came across this #File: vendor/magento//magento2-base/lib/web/mage/adminhtml/wysiwyg/tiny_mce/setup.js define([ 'jquery', 'underscore', 'tinymce', 'mage/translate', 'prototype', 'mage/adminhtml/events', 'mage/adminhtml/browser' ], function(jQuery, _, tinyMCE) [...]
astorm
Magento 2, KnockoutJS ViewModels, and Scope Binding A self answer from me over on the Magento StackExchange. The short version – Magento applies knockout bindings without a default view model. The Magento_Ui/js/core/app module/program, embeded via x-magento-init, adds view model objects to the uiRegistry. Finally, Magento has [...]
astorm
Magento 2’s core javascript library ships with a basic implementation of a class based object system, and the uiComponent feature uses these classes and objects extensively. The base class is the Magento_Ui/js/lib/core/class module/object/function, and you create a new instance of the class using javascript build-in new keyword. [...]
astorm
KnockoutJS: What Does Calling applyBindings Without Arguments do? Getting into Magento 2’s KnockoutJS implementation, and being slightly annoyed at the JS world. Knockout’s a great framework, but by positioning themselves as an MVVM framework they create the impression that Knockout itself is enough to contain your entire [...]
astorm
First, lets bask in the awful yet accurate glory of my original title for this quickie: Dependency Injection Argument Specific Instance Objects. If you’ve worked your way through my Magento 2 Object Manager series, you know its possible to tell Magento’s object system that a particular object should be instantiated every time [...]
astorm
Rackspace Magento Hosting Post Mortem – Dev Notes Rackspace has fallen a long way from the days of the defacto preferred Magento host.
astorm
The short version: I've started a Patreon. Donating will help me take on less consulting projects, giving me more time to write, which means I can start diving into the new features of Magento 2.
astorm
Magento 2 Mock Fixing Speaking of Vinai, here’s a nice how to on adjusting Magento’s test mocks, and then some good typing on what would really fix them.
astorm
Magento’s documentation tells you to run tests with the following php bin/magento dev:tests:run unit This isn’t wrong, but it pretty time consuming. You’re running every test in the suite. This one liner will let you run an individual test vendor/bin/phpunit -c dev/tests/unit/phpunit.xml.dist [...]
astorm
Today's a slight change of pace. We're going to a review a new Magento 2 book, Theme Web Page Assets: Getting Stuff Done with Magento 2.
astorm
Magento 2: Set a PHP umask It sounds like the latest version of Magento adds the ability to set a umask for PHP, which means another barrier to getting Magento up and running in industry standard, mod_php system (i.e. shared hosting and your laptop) has been knocked down. Looking forward to giving this a try when I have a moment. I know [...]
astorm
Magento 2: Sort Order gets Weird for “Around” Plugins Interesting bit of insight from Anton Kril on plugin firing order. My naive assumption on how this would work was All before plugins fire The around plugin chaining happens All after plugins fire However, based on what Anton’s said here, it sounds like an around [...]
astorm
If you grab the latest version of pestle (updated minutes ago) you should be able to use the following set of commands to create a base module with a working admin route. $ pestle.phar generate_module Pulsestorm HelloAdminPestle2 0.0.1 $ php bin/magento module:enable Pulsestorm_HelloAdminPestle2 $ php bin/magento setup:upgrade $ [...]
astorm
Magestead – The Vagrant Solution for Magento Developers Magestead just released version 2.0, with support for Magento 2. Another vagrant box to checkout if you’re looking for a way to get a sane Magento 2 enviornment up and running.
astorm
While phrases like “should we be be doing this in 2016” abound in engineering discussions, down in the trenches an arbitrary SQL query is often the fastest, most expedient way to get at the data you want. While I still regularly encourage developers new to Magento to embrace using the models and API resource models when [...]
astorm