Category: Programming Quickies
Back in they day, I ran a Tumblr blog named Magento Quickies where I’d post shorter, less in-depth posts about my travels through Magento’s source code. This Programming Quickies categories is the successor to that Tumblr blog. You’ll find all the old Magento Quickies content here, as well as new short posts about programming in general.
This section has its own RSS feed, the old Magento Quickies feed should should be redirecting, and we’re cross posting notifications for new posts over to magento-quickies.tumblr.com. In other words, you shouldn’t need to know any of this, but the duct tape that keeps the internet held together isn’t aging well, so your mileage may vary.
Below you'll find all the Programming Quickies articles on the site,
followed by a chronological listing of the same.
You may also browse the
7
series directly via the following links.
Pestle, Four Steps to Async Iterators, Checking in on OpenMage and Magento in 2020, Text Encoding and Unicode, Shopware's Development Environment, A Sentimental Gen-X Programmer Culls his Tech Books, and, Containers, Containers, Containers.
Magento 2 validates most, if not all, of its XML configuration files via a schema document. If you’re dealing with someone else’s code and you need to jump to the source of a schema problems, here’s a debugging snippet. #File: vendor/magento/framework/Config/Dom.php public function validate($schemaFileName, &$errors [...]
astorm
A quick primer on running Magento 2’s development tests. Most of this is just reworded information from Vinai Kopp guiding me through. If you’re working with the Magento 2 GitHub repository, you can run the project’s unit tests with vendor/bin/phpunit -c dev/tests/unit/phpunit.xml This assumes you’ve copied [...]
astorm
PHP – Object equivalent of array_slice(); PHP’s built in interfaces for advanced object functionality remain a hidden feature of the language that too many developers don’t understand. In this Stack Exchange answer I outline the basics of how Magento 1 uses those interfaces for collection functionality, and why you [...]
astorm
I’m working on a few projects converting old Magento 1 extensions to Magento 2. One extension I was working on had a “frontend area checker” in an observer that would return early if the request didn’t happen on the frontend. Like any good refactoring programmer, rather than spend days trying to piece together why [...]
astorm
Alternate Magento 1 Configuration Model There’s a handful of classes you can’t rewrite in Magento 1, but more modern version of Magento provide a way to slot in your own configuration class. I still wish I lived in the alternate universe where Varien had the resources to take the brilliant parts of Magento 1 and refine them [...]
astorm
One interesting thing about Magento 2’s refactored layout system is how it enables multiple XML trees modifying one global structure object. The layout builder for page objects #File: vendor/magento/framework/View/Page/Builder.php protected function generateLayoutBlocks() { $this->readPageLayout(); return [...]
astorm
Magento 2’s remove Tag Stack Exchange answer covering where Magento 2’s layout remove=“1” attribute tag is implemented. Short version – the block/container reader/scheduler classes look for it, and then tell the scheduler there’s an item to remove from the layout. Then, when the Generator pool builds [...]
astorm
One recent Magento 2 discovery that caught me off guard is, per the dev docs site, the <action/> method tag is depreciated The <action> instruction is deprecated. If the method implementation allows, use the <argument> for <block> or <referenceBlock> to access block public API. Given this, it sort of makes [...]
astorm
I’m starting to get a handle on how Magento 2 renders a layout and how those changes will impact folks to spend their day in layout handle XML files. This one’s mainly for myself – posting it here to get it out of my head. The first step of layout rendering in Magento 2 is still building a “package layout” [...]
astorm
The app/etc/config.php file contains a list of all the modules in Magento that have been enabled/disabled. It’s also the master list for module ordering – i.e. Magento references this file when deciding what order to load configuration files in. The order of modules in app/etc/config.php is, itself, determined by the [...]
astorm
Magento 2: Sequence Gotcha A little bit of the old derp form yours truly. Magento 2’s module.xml file contain a <sequence/> node that acts like the old <depends/> from Magento 1’s app/etc/modules declaration files. There’s a small catch though – in order to make Magento recognize changes to your [...]
astorm
Mage2Katas Screencast demonstrations from Vinai Kopp covering TDD methods in Magento 2. Watching an experienced developer work (the “code katas” approach) can be super useful – it’s one thing to read “you should do X”, but when you watch someone “do X” understanding can rapidly click in.
astorm
Welcome to your fortnightly “Open Magento 2 Technical Questions” post. If you’ve got an answer to any of the following please use the provided Stack Exchange thread to answer, or say hello via email if public communication isn’t possible. First off, we’ve got a slew of new questions. After that, some follow [...]
astorm
This one deserves a longer post, but my schedule is not forgiving. This assumes you’ve read and understand the concepts from my Magento object manager series. Many Magento provided classes have a special context object in their constructor. #File: vendor/magento/module-catalog/Controller/Product/View.php //... use [...]
astorm
Magestead – A Vagrant LEMP Stack for Magento Developers Magestead looks like another contender in the “geting a Magento 2 system up and running using vagrant and VMs”. Homestead inspired, it may be worth checking out.
astorm
Request: .user.ini files for FPM config · Issue #705 · magento/magento2 Somehow I’d always assumed nginx worked hard to be apache compatible. It doesn’t sound like that’s the case, which is a shame. I also found this on the official nginx wiki Stop using .htaccess. It’s horrible for performance. NGINX is designed to be [...]
astorm
For over a decade I’ve kept most my development work confined to the physical Macintosh OS X laptop I use every day, running server software using the OS X unix/bsd/darwin internals. I pick a stable version of PHP and install the php-osx package (previously the entropy.ch package), install MySQL via MySQL/Oracle’s OS X [...]
astorm
I’m not super conversant in the less CSS preprocessor, so I’m not sure how useful they are, but Magento 2 ships with some useful looking UI library docs in lib/web/css/docs/index.html You won’t be able to browse to these files via HTTP – you’ll need to open them directly in a web browser.
astorm
Magento 2 Marketplace Upload Validation Tool (Quick Note) Magento’s lead architect, Alan Kent, just posted a small command line program to validate a “composer zip archive” for Magento Marketplace. Magento Marketplace is the replacement for Magento Connect, and although its details remain a secret, its assumed to be an [...]
astorm
Thanks to some late, post merchant beta changes made to Magento, distributing modules via Composer (PHP’s de-facto package/dependency manager) has never been easier. While we’re all interested to see how the new Marketplace turns out, thanks to Magento 2’s architecture changes we should all be able to distribute our [...]
astorm