XMLDataFormatter
class XMLDataFormatter extends DataFormatter (View source)
Formats a DataObject's member fields into an XML string
Traits
Provides extensions to this object to integrate it with standard config API methods.
Config options
| priority | int | Set priority from 0-100.  | 
                from DataFormatter | 
| api_base | 
Properties
| public | int | $relationDepth | Follow relations for the DataObject instances ($has_one, $has_many, $many_many).  | 
                from DataFormatter | 
| protected | array | $customFields | Allows overriding of the fields which are rendered for the processed dataobjects. By default, this includes all fields in DataObject::inheritedDatabaseFields().  | 
                from DataFormatter | 
| protected | array | $customAddFields | Allows addition of fields (e.g. custom getters on a DataObject)  | 
                from DataFormatter | 
| protected | array | $customRelations | Allows to limit or add relations.  | 
                from DataFormatter | 
| protected | array | $removeFields | Fields which should be expicitly excluded from the export.  | 
                from DataFormatter | 
| protected | $outputContentType | |||
| protected | int | $totalSize | Used to set totalSize properties on the output of convertDataObjectSet(), shows the total number of records without the "limit" and "offset" GET parameters. Useful to implement pagination.  | 
                from DataFormatter | 
Methods
Get a configuration accessor for this class. Short hand for Config::inst()->get($this->class, .....).
Gets the uninherited value for the given config option
Backslashes in fully qualified class names (e.g. NameSpaced\ClassName) kills both requests (i.e. URIs) and XML (invalid character in a tag name) So we'll replace them with a hyphen (-), as it's also unambiguious in both cases (invalid in a php class name, and safe in an xml tag name)
Get a DataFormatter object suitable for handling the given file extension.
Get formatter for the first matching extension.
Get a DataFormatter object suitable for handling the given mimetype.
Get formatter for the first matching mimetype.
Returns all fields on the object which should be shown in the output. Can be customised through self::setCustomFields().
Generate an XML representation of the given DataObject.
Generate an XML representation of the given SS_List.
Convert an array of aliased field names to their Dataobject field name
Get the DataObject field name from its alias
Get a DataObject Field's Alias defaults to the fieldname
Get the 'api_field_mapping' config value for a class or return an empty array
Helper function to get mapped field names
No description
Details
        
                static            Config_ForClass
    config()
        
    
    Get a configuration accessor for this class. Short hand for Config::inst()->get($this->class, .....).
        
                            mixed
    stat(string $name)
        deprecated
    
    deprecated
Get inherited config value
        
                            mixed
    uninherited(string $name)
        
    
    Gets the uninherited value for the given config option
        
                            $this
    set_stat(string $name, mixed $value)
        deprecated
    
    deprecated
Update the config value for a given property
        
                    protected        string
    sanitiseClassName($className)
        
    
    Backslashes in fully qualified class names (e.g. NameSpaced\ClassName) kills both requests (i.e. URIs) and XML (invalid character in a tag name) So we'll replace them with a hyphen (-), as it's also unambiguious in both cases (invalid in a php class name, and safe in an xml tag name)
        
                static            DataFormatter
    for_extension(string $extension)
        
    
    Get a DataFormatter object suitable for handling the given file extension.
        
                static            DataFormatter
    for_extensions(array $extensions)
        
    
    Get formatter for the first matching extension.
        
                static            DataFormatter
    for_mimetype(string $mimeType)
        
    
    Get a DataFormatter object suitable for handling the given mimetype.
        
                static            DataFormatter
    for_mimetypes(array $mimetypes)
        
    
    Get formatter for the first matching mimetype.
Useful for HTTP Accept headers which can contain multiple comma-separated mimetypes.
        
                            $this
    setCustomFields(array $fields)
        
    
    No description
        
                            array
    getCustomFields()
        
    
    No description
        
                            $this
    setCustomAddFields(array $fields)
        
    
    No description
        
                            $this
    setCustomRelations(array $relations)
        
    
    No description
        
                            array
    getCustomRelations()
        
    
    No description
        
                            array
    getCustomAddFields()
        
    
    No description
        
                            $this
    setRemoveFields(array $fields)
        
    
    No description
        
                            array
    getRemoveFields()
        
    
    No description
        
                            string
    getOutputContentType()
        
    
    No description
        
                            $this
    setTotalSize(int $size)
        
    
    No description
        
                            int
    getTotalSize()
        
    
    No description
        
                    protected        array
    getFieldsForObj(DataObject $obj)
        
    
    Returns all fields on the object which should be shown in the output. Can be customised through self::setCustomFields().
        
                            
    supportedExtensions()
        
    
    No description
        
                            
    supportedMimeTypes()
        
    
    No description
        
                            mixed
    convertDataObject(DataObjectInterface $obj, $fields = null)
        
    
    Generate an XML representation of the given DataObject.
        
                            string
    convertDataObjectSet(SS_List $set, $fields = null)
        
    
    Generate an XML representation of the given SS_List.
        
                            string
    convertArray($array)
        
    
    No description
        
                            
    convertStringToArray(string $strData)
        
    
    No description
        
                            string[]
    getRealFields(string $className, string[] $fields)
        
    
    Convert an array of aliased field names to their Dataobject field name
        
                            string
    getRealFieldName(string $className, string $field)
        
    
    Get the DataObject field name from its alias
        
                            string
    getFieldAlias(string $className, string $field)
        
    
    Get a DataObject Field's Alias defaults to the fieldname
        
                    protected        string[]|array
    getApiMapping(string $className)
        
    
    Get the 'api_field_mapping' config value for a class or return an empty array
        
                    protected        string
    getMappedKey(array $map, string $key)
        
    
    Helper function to get mapped field names
        
                            string
    convertArrayWithoutHeader($array)
        
    
    No description
        
                            string
    convertDataObjectWithoutHeader(DataObject $obj, null $fields = null, null $relations = null)
        
    
    No description