xDebug config in VS Code for lando

To add xdebug config to VS CODE for lando, use this config

{
    "version": "0.2.0",
    "configurations": [
      {
        "name": "Listen for XDebug",
        "type": "php",
        "request": "launch",
        "port": 9000,
        "pathMappings": {
          "/app/": "${workspaceFolder}/",
        }
      }
    ]
  }

 

Adding your git ssh keys to docker container (for linux)

I wanted to have an option to use ssh keys I use for git not only on host machine but also on remote one made by docker. To do that I tried several ways how to push this key to container. There are some info on SSH forwarding but in the end what worked best for me is just simple mounting a file (ssh key) to php container (using docker4drupal by wodby).

Copy paste images to CKeditor body field like on Medium

By default you can't copy and paste images from clipboard to text field using CKeditor, I would argue this should even be in core as if you are writing an article this would be very useful to have, even more then what "Media" module brings. So how to add this to drupal. Well not easy as usual :)

PHP Fatal error: entity type does not exist

If you somehow get into this nasty problem, you have probably made some big mistake and now you are missing entity definition in your database. To quickly fix that you need to recreate it, you can use drush for it.  So if you are lucky find in code where this entity was added, probably in some hook_update in module.install file 

Database tables created that are not from entity definitions

If you browse around the DB tables in your drupal site, you might stumble into tables with double underscore names like commerce_order__shipments, this is most probably a table created as part of drupal field API system, mostly created as a multivalue field for some entity. It could be created when user creates field in UI or it could be programmatically made, like here

503 Max restarts limit reached

So we had "503 Max restarts limit reached" problem on our production while doing some batch operations and some edits of entities. Problem for both was that server response was slow as both have large queries running which take more than 20 seconds(yeah should be optimized and probably add some indexes to fields).

Getting country name from country code

To get full country name you need to use CountryManager class and you can then get all the info you need.  So lets say you have some country code store in $shipping_code variable, to get full country name

Checking all crontabs on server

To get all crontabs from users on your system write this one liner

for user in $(getent passwd | cut -f1 -d: ); do echo $user; crontab -u $user -l; done

to check other crons you need to see what is in for example 

ls -la /etc/cron.daily

or