/**
  *
  * @since       1.1.0
  */
 protected function _getQuery()
 {
     // Get db and query
     $query = $this->_db->getQuery(true);
     $query->select('*')->from($this->_db->quoteName('#__fieldsandfilters_fields'))->where($this->_db->quoteName('state') . ' IN (' . implode(',', $this->_states) . ')')->where($this->_db->quoteName('content_type_id') . ' IN(' . implode(',', $this->_types) . ')');
     // Fields where contents type id
     if ($this->method == 'getFieldsByID') {
         $query->where($this->_db->quoteName('id') . ' IN (' . implode(',', $this->elements) . ')');
     } else {
         if ($this->method == 'getFieldsByModeID') {
             $query->where($this->_db->quoteName('mode') . ' IN (' . implode(',', $this->_modes) . ')');
         }
     }
     // We no need same elements id
     if (!empty($this->_notElements)) {
         JArrayHelper::toInteger($this->_notElements);
         $query->where($this->_db->quoteName('id') . ' NOT IN (' . implode(',', $this->_notElements) . ')');
     }
     $query->order($this->_db->quoteName('ordering') . ' ASC');
     /* @deprecated 1.2.0 */
     if (FieldsandfiltersFactory::useOldStructure()) {
         $query->select(array($this->_db->quoteName('id', 'field_id'), $this->_db->quoteName('name', 'field_name'), $this->_db->quoteName('alias', 'field_alias'), $this->_db->quoteName('type', 'field_type')));
     }
     /* @end deprecated 1.2.0 */
     return $query;
 }