protected function createRelationFromList(
        $object,
        $relation,
        $list,
        $class,
        $column,
        $create = false
    ) {
        $object->$relation()->removeAll();

        foreach ($list as $name) {
            $name = trim($name);

            if (!empty($name)) {
                $obj = $class::get()->find($column, $name);

                if (empty($obj) && $create) {
                    $obj = $class::create();
                    $obj->$column = $name;
                    $obj->write();
                }

                if (!empty($obj)) {
                    $object->$relation()->add($obj);
                }
            }
        }
    }
protected function createRelationFromList(
        $object,
        $relation,
        $list,
        $class,
        $column,
        $create = false
    ) {
        $object->$relation()->removeAll();

        foreach ($list as $name) {
            $name = trim($name);

            if (!empty($name)) {
                $obj = $class::get()->find($column, $name);

                if (empty($obj) && $create) {
                    $obj = $class::create();
                    $obj->$column = $name;
                    $obj->write();
                }

                if (!empty($obj)) {
                    $object->$relation()->add($obj);
                }
            }
        }
    }
protected function createRelationFromList ( $ object , $ relation , $ list , $ class , $ column , $ create = false ) { $ object -> $ relation ( ) -> removeAll ( ) ; foreach ( $ list as $ name ) { $ name = trim ( $ name ) ; if ( ! empty ( $ name ) ) { $ obj = $ class :: get ( ) -> find ( $ column , $ name ) ; if ( empty ( $ obj ) && $ create ) { $ obj = $ class :: create ( ) ; $ obj -> $ column = $ name ; $ obj -> write ( ) ; } if ( ! empty ( $ obj ) ) { $ object -> $ relation ( ) -> add ( $ obj ) ; } } } }
Generate the selected relation from the provided array of values

@param string $object   The current object being imported
@param string $relation The name of the relation (eg Images)
@param array  $list     The list of values
@param string $class    The source class of the relation (eg SilverStripe\Assets\Image)
@param string $column   The name of the column to search for existing records
@param string $create   Create a new object if none found

@return void
Generate the selected relation from the provided array of values