mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
ENHANCEMENT Added support for $relationCallbacks on the importer class (in addition to methods on the model class)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@66312 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
76f15e47bf
commit
3a220c9e38
@ -73,7 +73,11 @@ class CsvBulkLoader extends BulkLoader {
|
||||
// trigger custom search method for finding a relation based on the given value
|
||||
// and write it back to the relation (or create a new object)
|
||||
$relationName = $this->relationCallbacks[$fieldName]['relationname'];
|
||||
$relationObj = $obj->{$this->relationCallbacks[$fieldName]['callback']}($val, $record);
|
||||
if($this->hasMethod($this->relationCallbacks[$fieldName]['callback'])) {
|
||||
$relationObj = $this->{$this->relationCallbacks[$fieldName]['callback']}(&$obj, $val, $record);
|
||||
} elseif($obj->hasMethod($this->relationCallbacks[$fieldName]['callback'])) {
|
||||
$relationObj = $obj->{$this->relationCallbacks[$fieldName]['callback']}($val, $record);
|
||||
}
|
||||
if(!$relationObj || !$relationObj->exists()) {
|
||||
$relationClass = $obj->has_one($relationName);
|
||||
$relationObj = new $relationClass();
|
||||
|
Loading…
Reference in New Issue
Block a user