src/Dev/BulkLoader.php
public function getImportSpec()
    {
        $singleton = DataObject::singleton($this->objectClass);

        // get database columns (fieldlabels include fieldname as a key)
        // using $$includerelations flag as false, so that it only contain $db fields
        $fields = (array)$singleton->fieldLabels(false);

        // Merge relations
        $relations = array_merge(
            $singleton->hasOne(),
            $singleton->hasMany(),
            $singleton->manyMany()
        );

        // Ensure description is string (e.g. many_many through)
        foreach ($relations as $name => $desc) {
            if (!is_string($desc)) {
                $relations[$name] = $name;
            }
        }

        return [
            'fields' => $fields,
            'relations' => $relations,
        ];
    }
public function getImportSpec()
    {
        $singleton = DataObject::singleton($this->objectClass);

        // get database columns (fieldlabels include fieldname as a key)
        // using $$includerelations flag as false, so that it only contain $db fields
        $fields = (array)$singleton->fieldLabels(false);

        // Merge relations
        $relations = array_merge(
            $singleton->hasOne(),
            $singleton->hasMany(),
            $singleton->manyMany()
        );

        // Ensure description is string (e.g. many_many through)
        foreach ($relations as $name => $desc) {
            if (!is_string($desc)) {
                $relations[$name] = $name;
            }
        }

        return [
            'fields' => $fields,
            'relations' => $relations,
        ];
    }
public function getImportSpec ( ) { $ singleton = DataObject :: singleton ( $ this -> objectClass ) ; // get database columns (fieldlabels include fieldname as a key) // using $$includerelations flag as false, so that it only contain $db fields $ fields = ( array ) $ singleton -> fieldLabels ( false ) ; // Merge relations $ relations = array_merge ( $ singleton -> hasOne ( ) , $ singleton -> hasMany ( ) , $ singleton -> manyMany ( ) ) ; // Ensure description is string (e.g. many_many through) foreach ( $ relations as $ name => $ desc ) { if ( ! is_string ( $ desc ) ) { $ relations [ $ name ] = $ name ; } } return [ 'fields' => $ fields , 'relations' => $ relations , ] ; }
Get a specification of all available columns and relations on the used model.
Useful for generation of spec documents for technical end users.

Return Format:
<code>
array(
'fields' => array('myFieldName'=>'myDescription'),
'relations' => array('myRelationName'=>'myDescription'),
)
</code>

@todo Mix in custom column mappings

@return array
Get a specification of all available columns and relations on the used model . Useful for generation of spec documents for technical end users .