XmlExporter
extends AbstractExporter
in package
ClassMetadata exporter for Doctrine XML mapping files.
Tags
Table of Contents
Properties
- $_extension : string
- $_metadata : array<string|int, ClassMetadata>
- $_outputDir : string|null
- $_overwriteExistingFiles : bool
Methods
- __construct() : mixed
- export() : void
- Exports each ClassMetadata instance to a single Doctrine Mapping file named after the entity.
- exportClassMetadata() : string
- Converts a single ClassMetadata instance to the exported format and returns it.
- getExtension() : string|null
- Gets the extension used to generated the path to a class.
- setExtension() : void
- Sets the directory to output the mapping files to.
- setMetadata() : void
- Sets the array of ClassMetadata instances to export.
- setOutputDir() : void
- Sets the directory to output the mapping files to.
- setOverwriteExistingFiles() : void
- _generateOutputPath() : string
- Generates the path to write the class for the given ClassMetadataInfo instance.
- _getChangeTrackingPolicyString() : string
- _getFetchModeString() : string
- _getIdGeneratorTypeString() : string
- _getInheritanceTypeString() : string
- addClassToMapIfExists() : SimpleXMLElement
- asXml() : string
- exportSequenceInformation() : void
- Export sequence information (if available/configured) into the current identifier XML node
- exportTableOptions() : void
- Exports (nested) option elements.
- generateEntityListenerXml() : void
- processEntityListeners() : void
Properties
$_extension
protected
string
$_extension
= '.dcm.xml'
$_metadata
protected
array<string|int, ClassMetadata>
$_metadata
= []
$_outputDir
protected
string|null
$_outputDir
$_overwriteExistingFiles
protected
bool
$_overwriteExistingFiles
= false
Methods
__construct()
public
__construct([string|null $dir = null ]) : mixed
Parameters
- $dir : string|null = null
export()
Exports each ClassMetadata instance to a single Doctrine Mapping file named after the entity.
public
export() : void
Tags
exportClassMetadata()
Converts a single ClassMetadata instance to the exported format and returns it.
public
exportClassMetadata(ClassMetadataInfo $metadata) : string
Parameters
- $metadata : ClassMetadataInfo
Return values
stringgetExtension()
Gets the extension used to generated the path to a class.
public
getExtension() : string|null
Return values
string|nullsetExtension()
Sets the directory to output the mapping files to.
public
setExtension(string $extension) : void
[php] $exporter = new YamlExporter($metadata, DIR . '/yaml'); $exporter->setExtension('.yml'); $exporter->export();
Parameters
- $extension : string
setMetadata()
Sets the array of ClassMetadata instances to export.
public
setMetadata(array<string|int, mixed> $metadata) : void
Parameters
- $metadata : array<string|int, mixed>
Tags
setOutputDir()
Sets the directory to output the mapping files to.
public
setOutputDir(string $dir) : void
[php] $exporter = new YamlExporter($metadata); $exporter->setOutputDir(DIR . '/yaml'); $exporter->export();
Parameters
- $dir : string
setOverwriteExistingFiles()
public
setOverwriteExistingFiles(bool $overwrite) : void
Parameters
- $overwrite : bool
_generateOutputPath()
Generates the path to write the class for the given ClassMetadataInfo instance.
protected
_generateOutputPath(ClassMetadataInfo $metadata) : string
Parameters
- $metadata : ClassMetadataInfo
Return values
string_getChangeTrackingPolicyString()
protected
_getChangeTrackingPolicyString(int $policy) : string
Parameters
- $policy : int
Tags
Return values
string_getFetchModeString()
protected
_getFetchModeString(int $mode) : string
Parameters
- $mode : int
Tags
Return values
string_getIdGeneratorTypeString()
protected
_getIdGeneratorTypeString(int $type) : string
Parameters
- $type : int
Tags
Return values
string_getInheritanceTypeString()
protected
_getInheritanceTypeString(int $type) : string
Parameters
- $type : int
Tags
Return values
stringaddClassToMapIfExists()
private
addClassToMapIfExists(array<string|int, mixed> $entityListenersXmlMap, array<string|int, mixed> $entityListener, SimpleXMLElement $entityListenersXml) : SimpleXMLElement
Parameters
- $entityListenersXmlMap : array<string|int, mixed>
- $entityListener : array<string|int, mixed>
- $entityListenersXml : SimpleXMLElement
Return values
SimpleXMLElementasXml()
private
asXml(SimpleXMLElement $simpleXml) : string
Parameters
- $simpleXml : SimpleXMLElement
Return values
stringexportSequenceInformation()
Export sequence information (if available/configured) into the current identifier XML node
private
exportSequenceInformation(SimpleXMLElement $identifierXmlNode, ClassMetadataInfo $metadata) : void
Parameters
- $identifierXmlNode : SimpleXMLElement
- $metadata : ClassMetadataInfo
exportTableOptions()
Exports (nested) option elements.
private
exportTableOptions(SimpleXMLElement $parentXml, array<string|int, mixed> $options) : void
Parameters
- $parentXml : SimpleXMLElement
- $options : array<string|int, mixed>
generateEntityListenerXml()
private
generateEntityListenerXml(ClassMetadataInfo $metadata, array<string|int, mixed> $entityListenersXmlMap, SimpleXMLElement $entityListenersXml) : void
Parameters
- $metadata : ClassMetadataInfo
- $entityListenersXmlMap : array<string|int, mixed>
- $entityListenersXml : SimpleXMLElement
processEntityListeners()
private
processEntityListeners(ClassMetadataInfo $metadata, SimpleXMLElement $root) : void
Parameters
- $metadata : ClassMetadataInfo
- $root : SimpleXMLElement