Backend\Modules\Location\Engine\Model::getAll PHP Method

getAll() public static method

Fetch a record from the database
public static getAll ( ) : array
return array
    public static function getAll()
    {
        return (array) BackendModel::getContainer()->get('database')->getRecords('SELECT i.*
             FROM location AS i
             WHERE i.language = ? AND i.show_overview = ?', array(BL::getWorkingLanguage(), 'Y'));
    }

Usage Example

Example #1
0
 /**
  * Load the settings
  */
 protected function loadData()
 {
     $this->items = BackendLocationModel::getAll();
     $this->settings = BackendLocationModel::getMapSettings(0);
     $firstMarker = current($this->items);
     // if there are no markers we reset it to the birthplace of Fork
     if ($firstMarker === false) {
         $firstMarker = array('lat' => '51.052146', 'lng' => '3.720491');
     }
     // load the settings from the general settings
     if (empty($this->settings)) {
         $this->settings = $this->get('fork.settings')->getForModule('Location');
         $this->settings['center']['lat'] = $firstMarker['lat'];
         $this->settings['center']['lng'] = $firstMarker['lng'];
     }
     // no center point given yet, use the first occurrence
     if (!isset($this->settings['center'])) {
         $this->settings['center']['lat'] = $firstMarker['lat'];
         $this->settings['center']['lng'] = $firstMarker['lng'];
     }
 }