Fix code style.

This commit is contained in:
David Molineus
2015-01-12 19:03:29 +01:00
parent 74c786c24b
commit 037c6c907d
77 changed files with 1068 additions and 398 deletions

View File

@@ -11,13 +11,26 @@
namespace Netzmacht\Contao\Leaflet\Model;
use Model\Collection;
/**
* Class MapModel for the tl_leaflet_map table.
*
* @package Netzmacht\Contao\Leaflet\Model
*/
class MapModel extends \Model
{
/**
* Model table.
*
* @var string
*/
protected static $strTable = 'tl_leaflet_map';
/**
* @return \Model\Collection
* Find all related layers.
*
* @return Collection|null
*/
public function findLayers()
{
@@ -26,19 +39,34 @@ class MapModel extends \Model
->prepare($query)
->execute($this->id);
return \Model\Collection::createFromDbResult($result, 'tl_leaflet_layer');
if ($result->numRows < 1) {
return null;
}
return Collection::createFromDbResult($result, 'tl_leaflet_layer');
}
/**
* @return \Model\Collection
* Find all active layers.
*
* @return Collection|null
*/
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);
$query = <<<SQL
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
SQL;
return \Model\Collection::createFromDbResult($result, 'tl_leaflet_layer');
$result = \Database::getInstance()->prepare($query)->execute($this->id);
if ($result->numRows) {
return Collection::createFromDbResult($result, 'tl_leaflet_layer');
}
return null;
}
}