Install optional config

// Install optional config.
$path_to_module = \Drupal::service('extension.path.resolver')->getPath('module', 'dev_tools');
$config_path = $path_to_module . '/config';
$config_source = new FileStorage($config_path);
\Drupal::service('config.installer')->installOptionalConfig($config_source);

Docker troubles

Error response from daemon: Ports are not available: exposing port TCP 127.0.0.1:443 -> 0.0.0.0:0: failed to connect to /var/run/com.docker.vmnetd.sock: is vmnetd running?: dial unix /var/run/com.docker.vmnetd.sock: connect: no such file or directory' 

/Applications/Docker.app/Contents/MacOS/install remove-vmnetd
sudo /Applications/Docker.app/Contents/MacOS/install vmnetd

[Docker Desktop for Mac] ERROR ==> connect ENOENT /var/run/docker.sock

Database query examples

Update the 'pair' field using an expression to concatenate the fields.

$database = \Drupal::service('database');
$database->update('mono_currency_rates')
  ->expression('pair', "CONCAT(currency_code_sell, '/', currency_code_buy)")
  ->isNull('pair')
  ->execute();

Sort:

Key Symfony Components Used in Drupal

  1. HttpFoundation: This component replaces PHP's native global variables, offering a more powerful and flexible way to handle HTTP requests and responses. It standardizes how Drupal handles web requests and responses, improving consistency and reliability.
  2. Routing: Symfony's Routing component is used to map URLs to specific controllers and actions in Drupal.