| @@ 31-44 (lines=14) @@ | ||
| 28 | case'selfMethod': |
|
| 29 | $type = $this->model->{$col['selfMethod']}(); |
|
| 30 | if (is_array($type)) { |
|
| 31 | if (strpos($type['relation'], ':')) { |
|
| 32 | $relationPath = explode(':', $type['relation']); |
|
| 33 | $relationName = array_pop($relationPath); |
|
| 34 | $item = $this->model; |
|
| 35 | foreach ($relationPath as $path) { |
|
| 36 | $item = $item->$path; |
|
| 37 | } |
|
| 38 | $itemModel = get_class($item); |
|
| 39 | $relation = $itemModel::getRelation($relationName); |
|
| 40 | $sourceModel = $relation['model']; |
|
| 41 | } else { |
|
| 42 | $relation = $modelName::getRelation($type['relation']); |
|
| 43 | $sourceModel = $relation['model']; |
|
| 44 | } |
|
| 45 | $objectId = \App::$cur->migrations->findObject((string) $value, $sourceModel); |
|
| 46 | if ($objectId) { |
|
| 47 | $value = $objectId->object_id; |
|
| @@ 238-251 (lines=14) @@ | ||
| 235 | case'selfMethod': |
|
| 236 | $type = $item->{$colInfo['colParams']['selfMethod']}(); |
|
| 237 | if (is_array($type)) { |
|
| 238 | if (strpos($type['relation'], ':')) { |
|
| 239 | $relationPath = explode(':', $type['relation']); |
|
| 240 | $relationName = array_pop($relationPath); |
|
| 241 | $curItem = $item; |
|
| 242 | foreach ($relationPath as $path) { |
|
| 243 | $curItem = $curItem->$path; |
|
| 244 | } |
|
| 245 | $itemModel = get_class($curItem); |
|
| 246 | $relation = $itemModel::getRelation($relationName); |
|
| 247 | $sourceModel = $relation['model']; |
|
| 248 | } else { |
|
| 249 | $relation = static::getRelation($type['relation']); |
|
| 250 | $sourceModel = $relation['model']; |
|
| 251 | } |
|
| 252 | $inputType = 'select'; |
|
| 253 | $value = $sourceModel::get($item->$colName); |
|
| 254 | if ($value) { |
|