Remove Duplicate entity alias Drupal 8

use Drupal\ Core\ Database\ Database;
use Drupal\ taxonomy\ Entity\ Term;
/** * Remove duplicate alias. */
function remove_duplicate_alias_update_8001() {
    // Retrieves a \Drupal\Core\Database\Connection which is a PDO instance. 
    $connection = Database::getConnection();
    // Load taxonomy. 
    $vid = ; 
    $terms = \Drupal::entityTypeManager() - > getStorage('taxonomy_term') - > loadTree($vid);
    $aliasManager = \Drupal::service('path.alias_manager');
    foreach($terms as $term) {
        // Load alias by path. 
        $term_alias = $aliasManager - > getAliasByPath('/taxonomy/term/'.$term - > tid);
        // Load path by alias. 
        if (is_numeric(end(explode('-', $term_alias)))) {
            $term_alias = substr($term_alias, 0, strrpos($term_alias, "-"));
        }
        $query = $connection - > select('path_alias', 'a') - > fields('a', ['path']) - > condition('a.alias', '%'.$term_alias.
            '%', 'LIKE');
        $data = $query - > execute();
        $results = $data - > fetchAll();
        if (count($results) > 1) {
            foreach($results as $key => $value) {
                $term_path = explode('/', $value - > path);
                if (is_numeric(end($term_path))) {
                    $term_data = Term::load(end($term_path));
                    if (count($term_data) == 0 && !empty($term_alias)) {
                        // Delete duplicate alias. 
                        $connection - > delete('path_alias') - > condition('alias', '%'.$term_alias.
                            '%', 'LIKE') - > execute();
                    }
                }
            }
        }
        // Save term so that alias will be genreated. 
        $taxonomy_term = Term::load($term - > tid);
        $taxonomy_term - > Save();
    }
}

Salesforce Interview Questions

  • Difference between Standard and Custom Controller
  • Difference between Trigger and Workflow
  • Difference between Master-Detail and Lookup relationship
  • Difference between Custom Settings and Custom Metadata
  • Difference between Profile and Permission Sets and OWD
  • Batch Class
  • Future Class
  • Webservice & Callouts  (Integration)
  • Junction Object

Entitlements

Milestones
Action: Customize | Cases | Entitlement Management | Milestones
We have created two milestones to track and report on performance.
1. First Response
A first response milestone represents how quickly your support organization must initially respond to a customer case when logged.
2. Resolution
Resolution time is usually defined as the time required to successfully resolve a customer issue.

Entitlement Processes
Action: Customize | Cases | Entitlement Management | Entitlement Processes
We have created an Entitlement Process i.e. Standard Support Process to customizable timelines that include all the milestones that support agents must complete to resolve a Case.

Entitlement section on Account
Entitlement section needs to be enabled from Page layout of Account object

Entitlement Creation
A sample Entitlement has been created for “Grand Hotels & Resorts Ltd” account.
Duration: 1 year
Type: Web Support
Entitlement Process: Standard Support Process