Drupal Dump

Drupal Snippets, Hacks and more....

441 posts since 2011

DrupalVM can't mount NFS or similar access problems on Mac OSX

This problem with access permissions has become common in latest versions of Mac OS, you need to give permissions to apps (executables) so they can do/use stuff on your disk/computer. Most of the times you will get a prompt for asking/checking this but sometimes this will quietly fail.

Quickly create patch files from fixed contrib modules

You fixed something in contrib module and you want to create quick patch from that, if it spans through multiple commits, best way to do that is to make a patch from multiple commits, to combine them into one file, write this

3 ways to load payments associated with order in drupal 8

So you have and order, but don't know how to get to payments that are referencing this order, there are few ways you can achieve that. First is to load it by properties

$payments = \Drupal::entityTypeManager()->getStorage('commerce_payment')->loadByProperties(['order_id' => $order->id()]);

second is to load them by order

GitLab revert the reverted merge

So you made a mistake and made a revert, then you want to introduce again the code you use in new merge, if you try to make merge request(MR) from branch you made original MR you reverted you will get nothing in that MR. This is not a bug, but a feature of git. Reverting does not roll back, but rather appends the revert to the front of the HEAD.

How to load an order entity

If you wan to get some info from ORDER entity there is a method to do that.  We can do that by loading by some property or by loading order per ID