projects
/
Pman.Core
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
0c56913
)
DataObjects/Core_enum.php
author
Edward
<edward@roojs.com>
Thu, 4 Jun 2015 08:42:46 +0000
(16:42 +0800)
committer
Edward
<edward@roojs.com>
Thu, 4 Jun 2015 08:42:46 +0000
(16:42 +0800)
DataObjects/Core_enum.php
patch
|
blob
|
history
diff --git
a/DataObjects/Core_enum.php
b/DataObjects/Core_enum.php
index
8ca0f22
..
06d6488
100644
(file)
--- a/
DataObjects/Core_enum.php
+++ b/
DataObjects/Core_enum.php
@@
-338,7
+338,7
@@
class Pman_Core_DataObjects_Core_enum extends DB_DataObject
}
}
- function merge($
id
, $roo)
+ function merge($
to
, $roo)
{
$affects = array();
{
$affects = array();
@@
-361,25
+361,22
@@
class Pman_Core_DataObjects_Core_enum extends DB_DataObject
$chk = DB_DataObject::factory($ka[0]);
if (!is_a($chk,'DB_DataObject')) {
$chk = DB_DataObject::factory($ka[0]);
if (!is_a($chk,'DB_DataObject')) {
- $
this
->jerr('Unable to load referenced table, check the links config: ' .$ka[0]);
+ $
roo
->jerr('Unable to load referenced table, check the links config: ' .$ka[0]);
}
}
- // print_r(array($chk->tablename() , $ka[1] , $xx->tablename() , $this->key ));
- $chk->{$ka[1]} =
$xx->{$this->key}
;
+
+ $chk->{$ka[1]} =
$this->id
;
- if (count($chk->keys())) {
- $matches = $chk->count();
- } else {
- //DB_DataObject::DebugLevel(1);
- $matches = $chk->count($ka[1]);
+ foreach ($chk->fetchAll() as $c){
+ $cc = clone ($c);
+ $c->{$ka[1]} = $to;
+ $c->update($o);
}
}
-
- if ($matches) {
- $chk->_match_key = $ka[1];
- $match_ar[] = clone($chk);
- continue;
- }
}
}
+ $this->delete();
+
+ $roo->jok('Merged');
+
}
}