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

get() public static method

Get an item
public static get ( integer $id ) : array
$id integer The id of the item to fetch.
return array
    public static function get($id)
    {
        return (array) FrontendModel::getContainer()->get('database')->getRecord('SELECT *
             FROM location
             WHERE id = ? AND language = ?', array((int) $id, LANGUAGE));
    }

Usage Example

Beispiel #1
0
 /**
  * Load the data
  */
 protected function loadData()
 {
     $this->item = FrontendLocationModel::get($this->data['id']);
     $this->settings = FrontendLocationModel::getMapSettings($this->data['id']);
     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['zoom_level'] = $settings['zoom_level_widget'];
         $this->settings['center']['lat'] = $this->item['lat'];
         $this->settings['center']['lng'] = $this->item['lng'];
     }
     // no center point given yet, use the first occurrence
     if (!isset($this->settings['center'])) {
         $this->settings['center']['lat'] = $this->item['lat'];
         $this->settings['center']['lng'] = $this->item['lng'];
     }
     $this->settings['maps_url'] = FrontendLocationModel::buildUrl($this->settings, array($this->item));
 }