SimpleDataProvider
B.Kamer <[email protected]> Fri, 24 Jun 2005 00:08:25 +0200
| Newsgroups | gmane.comp.lib.binarycloud.devel |
|---|---|
| Message-ID | <[email protected]> |
is this a useful addition? This way you could have some parameters
(eg for searching) in the calledMethods
... snip ...
function SimpleDataProvider($params = null) {
... snip ...
+ if (!isset($params['method_params']))
+ $params['method_params'] = array();
... snip ...
}
... snip ...
function getCount() {
if ($this->count === null) {
if (is_array($this->params['method']) && isset($this-
>params['method']['count'])) {
// count query is there
- $sql = call_user_func(array($this->entity_name,
$this->params['method']['count']));
+ $sql = call_user_func(array($this->entity_name,
$this->params['method']['count']), $this->params['method_params']);
SimpleEntity::_getClass('SET', $this->entity_name);
$res = call_user_func(array($this-
>entity_name,'_getData'), $sql);
if (bc_catch('BcException', $e)) {
bc_throw($e);
... snip ...
function getData($from, $length=0) {
if ($this->data === null) {
if (is_array($this->params['method']) && isset($this-
>params['method']['data'])) {
$query_method = $this->params['method']['data'];
} else {
$query_method = $this->params['method'];
}
- $sql = call_user_func(array($this->entity_name,
$query_method));
+ $sql = call_user_func(array($this->entity_name,
$query_method), $this->params['method_params']);
// add sorting
if (isset($this->params['sort']) && is_array($this-
>params['sort'])
&& $this->params['sort']
['enabled']) {
... etc ...
_______________________________________________
dev mailing list
dev-PnctHDZWAvB/Cz2I37pSEPZ4XP/[email protected]
http://lists.binarycloud.com/mailman/listinfo/dev