2015-01-09 11:53:58 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @package dev
|
|
|
|
|
* @author David Molineus <david.molineus@netzmacht.de>
|
|
|
|
|
* @copyright 2015 netzmacht creative David Molineus
|
|
|
|
|
* @license LGPL 3.0
|
|
|
|
|
* @filesource
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
namespace Netzmacht\Contao\Leaflet\Model;
|
|
|
|
|
|
|
|
|
|
|
2015-01-09 15:24:34 +01:00
|
|
|
abstract class AbstractActiveModel extends \Model
|
2015-01-09 11:53:58 +01:00
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* @param int $modelId
|
|
|
|
|
* @param array $options
|
|
|
|
|
*
|
|
|
|
|
* @return \Model|null
|
|
|
|
|
*/
|
|
|
|
|
public static function findActiveByPK($modelId, $options = array())
|
|
|
|
|
{
|
|
|
|
|
return static::findOneBy('active=1 AND id', $modelId, $options);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*
|
2015-01-09 15:24:34 +01:00
|
|
|
* @param int $value
|
2015-01-09 11:53:58 +01:00
|
|
|
* @param array $options
|
|
|
|
|
*
|
|
|
|
|
* @return \Model|null
|
|
|
|
|
*/
|
2015-01-09 15:24:34 +01:00
|
|
|
public static function findActiveBy($column, $value, $options = array())
|
2015-01-09 11:53:58 +01:00
|
|
|
{
|
2015-01-09 15:24:34 +01:00
|
|
|
return static::findBy('active=1 AND ' . $column, $value, $options);
|
2015-01-09 11:53:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static function findActivated($options = array())
|
|
|
|
|
{
|
|
|
|
|
return static::findBy('active', '1', $options);
|
|
|
|
|
}
|
|
|
|
|
}
|