mirror of
https://github.com/dg/dibi.git
synced 2025-08-05 05:37:39 +02:00
- added DibiResult::setRowClass()
This commit is contained in:
@@ -57,6 +57,9 @@ class DibiResult extends DibiObject implements IDataSource
|
|||||||
/** @var array|FALSE Qualifiy each column name with the table name? */
|
/** @var array|FALSE Qualifiy each column name with the table name? */
|
||||||
private $withTables = FALSE;
|
private $withTables = FALSE;
|
||||||
|
|
||||||
|
/** @var string returned object class */
|
||||||
|
private $class = 'DibiRow';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -173,6 +176,29 @@ class DibiResult extends DibiObject implements IDataSource
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set fetched object class. This class should extend the DibiRow class.
|
||||||
|
* @param string
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function setRowClass($class)
|
||||||
|
{
|
||||||
|
$this->class = $class;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns fetched object class name.
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getRowClass()
|
||||||
|
{
|
||||||
|
return $this->class;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetches the row at current position, process optional type conversion.
|
* Fetches the row at current position, process optional type conversion.
|
||||||
* and moves the internal cursor to the next position
|
* and moves the internal cursor to the next position
|
||||||
@@ -201,7 +227,7 @@ class DibiResult extends DibiObject implements IDataSource
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new DibiRow($row, 2);
|
return new $this->class($row);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -626,4 +652,10 @@ class DibiResult extends DibiObject implements IDataSource
|
|||||||
*/
|
*/
|
||||||
class DibiRow extends ArrayObject
|
class DibiRow extends ArrayObject
|
||||||
{
|
{
|
||||||
|
|
||||||
|
public function __construct($arr)
|
||||||
|
{
|
||||||
|
parent::__construct($arr, 2);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -292,7 +292,7 @@ abstract class DibiTableX extends DibiObject
|
|||||||
*/
|
*/
|
||||||
public function createBlank()
|
public function createBlank()
|
||||||
{
|
{
|
||||||
$row = new DibiRow($this->blankRow, 2);
|
$row = new DibiRow($this->blankRow);
|
||||||
$row[$this->primary] = NULL;
|
$row[$this->primary] = NULL;
|
||||||
return $row;
|
return $row;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user