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

get() public static method

Fetch a record from the database
public static get ( integer $id ) : array
$id integer The id of the record to fetch.
return array
    public static function get($id)
    {
        return (array) BackendModel::getContainer()->get('database')->getRecord('SELECT i.*
             FROM location AS i
             WHERE i.id = ? AND i.language = ?', array((int) $id, BL::getWorkingLanguage()));
    }

Usage Example

Example #1
0
 /**
  * Get the data
  */
 private function loadData()
 {
     $this->record = (array) BackendLocationModel::get($this->id);
     // no item found, throw an exceptions, because somebody is f*****g with our URL
     if (empty($this->record)) {
         $this->redirect(BackendModel::createURLForAction('Index') . '&error=non-existing');
     }
     $this->settings = BackendLocationModel::getMapSettings($this->id);
     // load the settings from the general settings
     if (empty($this->settings)) {
         $settings = $this->get('fork.settings')->getForModule('Location');
         $this->settings['width'] = $settings['width_widget'];
         $this->settings['height'] = $settings['height_widget'];
         $this->settings['map_type'] = $settings['map_type_widget'];
         $this->settings['map_style'] = isset($settings['map_style_widget']) ? $settings['map_style_widget'] : 'standard';
         $this->settings['zoom_level'] = $settings['zoom_level_widget'];
         $this->settings['center']['lat'] = $this->record['lat'];
         $this->settings['center']['lng'] = $this->record['lng'];
     }
     // no center point given yet, use the first occurrence
     if (!isset($this->settings['center'])) {
         $this->settings['center']['lat'] = $this->record['lat'];
         $this->settings['center']['lng'] = $this->record['lng'];
     }
     $this->settings['full_url'] = isset($this->settings['full_url']) ? $this->settings['full_url'] : false;
     $this->settings['directions'] = isset($this->settings['directions']) ? $this->settings['directions'] : false;
 }
All Usage Examples Of Backend\Modules\Location\Engine\Model::get