From: Alexander Meteiko Date: Mon, 5 Jul 2010 10:26:29 +0000 (+0300) Subject: IPF_ORM_Record: synchronizeWithArray is changed, _synchronizeWithArrayForRelation... X-Git-Tag: 0.5~355 X-Git-Url: https://git.andy128k.dev/?a=commitdiff_plain;h=fd8411bf3679b1f2a1455c9173f2f1fffa7c06cb;p=ipf.git IPF_ORM_Record: synchronizeWithArray is changed, _synchronizeWithArrayForRelation is added --- diff --git a/ipf/orm/record.php b/ipf/orm/record.php index 295e864..402b660 100644 --- a/ipf/orm/record.php +++ b/ipf/orm/record.php @@ -854,6 +854,11 @@ abstract class IPF_ORM_Record extends IPF_ORM_Record_Abstract implements Countab } } + protected function _synchronizeWithArrayForRelation($key, $value) + { + $this->get($key)->synchronizeWithArray($value); + } + public function synchronizeWithArray(array $array, $deep = true) { $refresh = false; @@ -864,7 +869,7 @@ abstract class IPF_ORM_Record extends IPF_ORM_Record_Abstract implements Countab continue; } if ($deep && $this->getTable()->hasRelation($key)) { - $this->get($key)->synchronizeWithArray($value); + $this->_synchronizeWithArrayForRelation($key, $value); } else if ($this->getTable()->hasField($key)) { $this->set($key, $value); } @@ -1009,12 +1014,12 @@ abstract class IPF_ORM_Record extends IPF_ORM_Record_Abstract implements Countab public function pk($sep='_') { - $pk = ''; - foreach($this->_id as $val) { - if ($pk!='') - $pk .= $sep; - $pk .= $val; - } + $pk = ''; + foreach($this->_id as $val) { + if ($pk!='') + $pk .= $sep; + $pk .= $val; + } return $pk; } @@ -1287,16 +1292,16 @@ abstract class IPF_ORM_Record extends IPF_ORM_Record_Abstract implements Countab } public function SetCustom($name, $val){ - $this->_custom[$name] = $val; + $this->_custom[$name] = $val; } public function GetCustom($name){ - if (isset($this->_custom[$name])) - return $this->_custom[$name]; - return null; + if (isset($this->_custom[$name])) + return $this->_custom[$name]; + return null; } - public function _reorder($ids, $ord_field, $drop_id, $prev_ids, $ord=1){ + public function _reorder($ids, $ord_field, $drop_id, $prev_ids, $ord=1){ foreach($ids as $id){ $item = $this->getTable()->find($id); $item[$ord_field] = $ord;