public function getBranchByDaxkoBranchId($id) {
    $cache = &drupal_static(__FUNCTION__);

    if (!isset($cache[$id])) {
      $ids = $this->queryFactory
        ->get('mapping')
        ->condition('type', 'branch')
        ->condition('field_daxko_branch_id', $id)
        ->execute();

      if (!$ids) {
        return NULL;
      }

      // Get mapping.
      $mapping_storage = $this->entityTypeManager->getStorage('mapping');
      $mapping = $mapping_storage->load(reset($ids));

      // Get node.
      $node_id = $mapping->field_ref_branch_id->target_id;
      $node_storage = $this->entityTypeManager->getStorage('node');
      $cache[$id] = $node_storage->load($node_id);
    }

    return $cache[$id];
  }
public function getBranchByDaxkoBranchId($id) {
    $cache = &drupal_static(__FUNCTION__);

    if (!isset($cache[$id])) {
      $ids = $this->queryFactory
        ->get('mapping')
        ->condition('type', 'branch')
        ->condition('field_daxko_branch_id', $id)
        ->execute();

      if (!$ids) {
        return NULL;
      }

      // Get mapping.
      $mapping_storage = $this->entityTypeManager->getStorage('mapping');
      $mapping = $mapping_storage->load(reset($ids));

      // Get node.
      $node_id = $mapping->field_ref_branch_id->target_id;
      $node_storage = $this->entityTypeManager->getStorage('node');
      $cache[$id] = $node_storage->load($node_id);
    }

    return $cache[$id];
  }
public function getBranchByDaxkoBranchId ( $ id ) { $ cache = & drupal_static ( __FUNCTION__ ) ; if ( ! isset ( $ cache [ $ id ] ) ) { $ ids = $ this -> queryFactory -> get ( 'mapping' ) -> condition ( 'type' , 'branch' ) -> condition ( 'field_daxko_branch_id' , $ id ) -> execute ( ) ; if ( ! $ ids ) { return NULL ; } // Get mapping. $ mapping_storage = $ this -> entityTypeManager -> getStorage ( 'mapping' ) ; $ mapping = $ mapping_storage -> load ( reset ( $ ids ) ) ; // Get node. $ node_id = $ mapping -> field_ref_branch_id -> target_id ; $ node_storage = $ this -> entityTypeManager -> getStorage ( 'node' ) ; $ cache [ $ id ] = $ node_storage -> load ( $ node_id ) ; } return $ cache [ $ id ] ; }
Get branch by Daxko branch ID.

@param int $id
Daxko branch ID.

@return \Drupal\node\NodeInterface
Branch node.
Get branch by Daxko branch ID .