Files
contao-leaflet-maps/src/Model/LayerModel.php

64 lines
1.5 KiB
PHP
Raw Normal View History

2014-12-29 16:22:16 +01:00
<?php
/**
2017-10-05 15:45:43 +02:00
* Leaflet maps for Contao CMS.
*
2016-10-11 10:40:15 +02:00
* @package contao-leaflet-maps
2014-12-29 16:22:16 +01:00
* @author David Molineus <david.molineus@netzmacht.de>
2017-10-11 15:00:48 +02:00
* @copyright 2014-2017 netzmacht David Molineus. All rights reserved.
2017-10-05 15:45:43 +02:00
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE
2014-12-29 16:22:16 +01:00
* @filesource
*/
namespace Netzmacht\Contao\Leaflet\Model;
use Contao\Model\Collection;
2014-12-29 16:22:16 +01:00
2015-01-12 19:03:29 +01:00
/**
* Class LayerModel for the tl_leaflet_layer table.
*
2015-01-18 23:20:21 +01:00
* @property mixed|null id
* @property mixed|null alias
2015-01-19 14:46:44 +01:00
* @property mixed|null pointToLayer
* @property mixed|null onEachFeature
2015-01-27 12:36:52 +01:00
* @property mixed|null boundsMode
2015-01-18 23:20:21 +01:00
*
2015-01-12 19:03:29 +01:00
* @package Netzmacht\Contao\Leaflet\Model
*/
2015-01-09 15:24:34 +01:00
class LayerModel extends AbstractActiveModel
2014-12-29 16:22:16 +01:00
{
2015-01-12 19:03:29 +01:00
/**
* Model table.
*
* @var string
*/
2014-12-29 16:22:16 +01:00
protected static $strTable = 'tl_leaflet_layer';
2015-01-12 19:03:29 +01:00
/**
* Find multiple layers by given type.
*
* @param array $types List of layer types.
* @param array $options Query options.
*
* @return Collection|null
*/
public static function findMultipleByTypes(array $types, $options = [])
2015-01-06 14:55:53 +01:00
{
if (empty($types)) {
return null;
}
$options['column'] = [
2015-01-06 14:55:53 +01:00
sprintf(
'type IN (%s)',
substr(str_repeat('?,', count($types)), 0, -1)
),
];
2015-01-06 14:55:53 +01:00
2015-01-12 19:03:29 +01:00
$options['value'] = $types;
$options['return'] = 'Collection';
2015-01-06 14:55:53 +01:00
return static::find($options);
}
2014-12-29 16:22:16 +01:00
}