Updates to ORM sub records and change Sort::MAsort, sortby is now an array
This commit is contained in:
@@ -125,8 +125,11 @@ abstract class lnApp_ORM extends Kohana_ORM {
|
||||
protected function _load_values(array $values) {
|
||||
parent::_load_values($values);
|
||||
|
||||
$sort = FALSE;
|
||||
if ($this->_loaded AND $this->_sub_items_load AND count($this->_sub_items_load) == 1)
|
||||
if ($this->_sub_items_load AND count($this->_sub_items_load) > 1)
|
||||
throw HTTP_Exception::factory('501','Sub Items doesnt support more than 1 load');
|
||||
|
||||
$sort = array();
|
||||
if ($this->_loaded AND $this->_sub_items_load)
|
||||
foreach ($this->_sub_items_load as $item => $sort)
|
||||
$this->_sub_items = $this->$item->find_all()->as_array();
|
||||
|
||||
@@ -337,6 +340,21 @@ abstract class lnApp_ORM extends Kohana_ORM {
|
||||
array_push($this->_sub_items,$item);
|
||||
}
|
||||
|
||||
public function subitem_get($key,$value) {
|
||||
foreach ($this->_sub_items as $o)
|
||||
if ($o->{$key} == $value)
|
||||
return $o;
|
||||
}
|
||||
|
||||
/**
|
||||
* Since DB records are stored as strings, this function enables us to convert
|
||||
* values back to strings, primarily so they dont trigger being changed if they
|
||||
* havent.
|
||||
*/
|
||||
public static function tostring($value) {
|
||||
return (string)$value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Override the Kohana processing so we can null values if required.
|
||||
* We override this function, because we do set our own primary key value
|
||||
|
Reference in New Issue
Block a user