/**
  *
  * @since       1.1.0
  */
 protected function _beforeQuery($type)
 {
     if ($this->method == 'getElementsByID' || $this->method == 'getElementsByItemID') {
         parent::_beforeQueryElements($type);
     } else {
         parent::_beforeQuery($type);
     }
 }
 /**
  *
  * @since       1.1.0
  */
 protected function _beforeQuery($type)
 {
     switch ($this->method) {
         case 'getFieldsByID':
             parent::_beforeQueryElements($type);
             break;
         case 'getFieldsByModeID':
             // Get content type id from cache
             $data = $this->_getData($type);
             // The difference states between argument states and cache states
             $dataStates = $data->get('__states', array());
             $_states = array_diff($this->states, $dataStates);
             // The diffrence modes between argument modes and cache modes
             $dataModes = $data->get('__modes', array());
             $_modes = array_diff($this->elements, $dataModes);
             if (!empty($_modes) || !empty($_states)) {
                 // Add difference states to query varible
                 $this->_states += $_states;
                 // Add difference modes to query varible
                 $this->_modes += $_modes;
                 // When the get modes of the need, then add modes to the cache content type, because we don't need them next time
                 $data->set('__modes', array_merge($dataModes, $_modes));
                 // When the get states of the need, then add states to the cache extenion type, because we don't need them next time
                 // $data->set('__states', array_merge($dataStates, $_states));
                 // Get elements id from cache, because we don't need get that id's second time from database
                 $this->_notElements = array_merge($this->_notElements, array_keys(get_object_vars($data->get('elements', new stdClass()))));
                 // Add content type id to query varible
                 array_push($this->_types, $type);
             }
             break;
         default:
             parent::_beforeQuery($type);
             break;
     }
 }