Support

Drupal 8 Drush SQL Export

Using Drupal 8 Drush 9 you can export your database with the help of the following command.

drush sql-dump --result-file=name.sql

If you want your database to be exported as compressed, you can use the command below.

drush sql-dump --gzip --result-file=name.sql

 

Drupal 8 Drush SQL Import

You can use the following code to import mysql using Drupal 8 drush 9. You can change the database name in the following command to match the name of the database.

drush sql-cli < database.sql

 

Drupal 8 Taxonomy Term Load

To access taxonomy terms in Drupal 8, you must include the Term class in your project.

use Drupal\taxonomy\Entity\Term;

In order to load the taxonomy, you must send the tid to the term: load function.

$term = Term::load($tid);

The getName function is used to get the name of the taxonomy loaded with the term: load function.

Drupal 8 Get Current User ID

The following command must be used to get the current user id for drupal 8.

\Drupal::currentUser()->id();