1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100:
<?php
namespace LeanMapper;
use Closure;
use DibiFluent;
use LeanMapper\Exception\InvalidArgumentException;
class Fluent extends DibiFluent
{
public static $masks = array(
'SELECT' => array('SELECT', 'DISTINCT', 'FROM', 'WHERE', 'GROUP BY',
'HAVING', 'ORDER BY', 'LIMIT', 'OFFSET', 'UNION'),
'UPDATE' => array('UPDATE', 'SET', 'WHERE', 'ORDER BY', 'LIMIT'),
'INSERT' => array('INSERT', 'INTO', 'VALUES', 'SELECT'),
'DELETE' => array('DELETE', 'FROM', 'USING', 'WHERE', 'ORDER BY', 'LIMIT'),
);
private $relatedKeys;
public function applyFilter($filter, $args = null)
{
$args = func_get_args();
$args[0] = $this;
return call_user_func_array(
$filter instanceof Closure ? $filter : $this->getConnection()->getFilterCallback($filter),
$args
);
}
public function createSelect($args = null)
{
return call_user_func_array(array($this->getConnection(), 'select'), func_get_args());
}
public function _export($clause = null, $args = null)
{
return parent::_export($clause, $args);
}
public function getRelatedKeys()
{
return $this->relatedKeys;
}
public function setRelatedKeys($keys)
{
if (!is_array($keys) and $keys !== null) {
throw new InvalidArgumentException('Invalid related keys given. Expected array or null, ' . gettype($keys) . ' given.');
}
$this->relatedKeys = $keys;
return $this;
}
}