Contribution Date
Technology
Contribution Project
Contribution Details
@naghai, couple things needs to be improved here.
1) Passing the db connection as dependency injection in constructor would be great.
2) can we also change the query to use:
https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Database%...
There are couple of more places where we can change the query written like below:
+ $cache[$cache_key] = \Drupal::database()->query(
+ "SELECT parent FROM {taxonomy_term_hierarchy} WHERE tid = :tid",
+ array(':tid' => $tid)
+ )->fetchField();
2.1) And instead of writing it inline, can have execute the query before if statement, that will make code more cleaner.
+ if ($force || !($depth = Drupal::database()
+ ->query('SELECT depth_level FROM {taxonomy_term_field_data} WHERE tid=:tid', array(':tid' => $tid))
+ ->fetchField())
+ ) {
Contribution Issue Link
Files count
0
Patches count
0