Files
contao-leaflet-maps/src/Netzmacht/Contao/Leaflet/Model/MapModel.php

45 lines
1.1 KiB
PHP
Raw Normal View History

2014-12-29 12:17:40 +01:00
<?php
/**
* @package dev
* @author David Molineus <david.molineus@netzmacht.de>
* @copyright 2014 netzmacht creative David Molineus
* @license LGPL 3.0
* @filesource
*
*/
namespace Netzmacht\Contao\Leaflet\Model;
class MapModel extends \Model
{
protected static $strTable = 'tl_leaflet_map';
2015-01-09 22:33:57 +01:00
/**
* @return \Model\Collection
*/
public function findLayers()
{
$query = 'SELECT l.* FROM tl_leaflet_layer l LEFT JOIN tl_leaflet_map_layer m ON l.id = m.lid WHERE m.mid=?';
$result = \Database::getInstance()
->prepare($query)
->execute($this->id);
return \Model\Collection::createFromDbResult($result, 'tl_leaflet_layer');
}
2015-01-09 23:48:25 +01:00
/**
* @return \Model\Collection
*/
public function findActiveLayers()
{
$query = 'SELECT l.* FROM tl_leaflet_layer l LEFT JOIN tl_leaflet_map_layer m ON l.id = m.lid WHERE m.mid=? AND l.active=1';
$result = \Database::getInstance()
->prepare($query)
->execute($this->id);
return \Model\Collection::createFromDbResult($result, 'tl_leaflet_layer');
}
2014-12-29 12:17:40 +01:00
}