PHP Класс Doctrine\OXM\Tools\XmlEntityGenerator

[php] $classes = $xem->getClassMetadataInfoFactory()->getAllMetadata(); $generator = new \Doctrine\OXM\MongoDB\Tools\XmlEntityGenerator(); $generator->setGenerateAnnotations(true); $generator->setGenerateStubMethods(true); $generator->setRegenerateXmlEntityIfExists(false); $generator->setUpdateXmlEntityIfExists(true); $generator->generate($classes, '/path/to/generate/xml-entitys');
С версии: 1.0
Автор: Igor Golovanov ([email protected])
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
generate ( array $metadatas, string $outputDirectory ) : void Generate and write xml-entity classes for the given array of ClassMetadataInfo instances
generateUpdatedXmlEntityClass ( ClassMetadataInfo $metadata, string $path ) : string Generate the updated code for the given ClassMetadataInfo and xml-entity at path
generateXmlEntityClass ( ClassMetadataInfo $metadata ) : string Generate a PHP5 Doctrine 2 xml-entity class from the given ClassMetadataInfo instance
setBackupExisting ( $bool ) Should an existing xml-entity be backed up if it already exists?
setClassToExtend ( $classToExtend ) : void Set the name of the class the generated classes should extend from
setExtension ( string $extension ) : void Set the extension to use when writing php files to disk
setGenerateAnnotations ( boolean $bool ) : void Set whether or not to generate annotations for the xml-entity
setGenerateStubMethods ( boolean $bool ) : void Set whether or not to generate stub methods for the xml-entity
setNumSpaces ( integer $numSpaces ) : void Set the number of spaces the exported class should have
setRegenerateXmlEntityIfExists ( boolean $bool ) : void Set whether or not to regenerate the xml-entity if it exists
setUpdateXmlEntityIfExists ( boolean $bool ) : void Set whether or not to try and update the xml-entity if it already exists
writeXmlEntityClass ( ClassMetadataInfo $metadata, string $outputDirectory ) : void Generated and write xml-entity class to disk for the given ClassMetadataInfo instance

Приватные методы

Метод Описание
extendsClass ( )
generateChangeTrackingPolicyAnnotation ( ClassMetadataInfo $metadata )
generateFieldMappingPropertyDocBlock ( array $fieldMapping, ClassMetadataInfo $metadata )
generateLifecycleCallbackMethod ( $name, $methodName, $metadata )
generateXmlEntityBody ( ClassMetadataInfo $metadata )
generateXmlEntityClassName ( ClassMetadataInfo $metadata )
generateXmlEntityConstructor ( ClassMetadataInfo $metadata )
generateXmlEntityDocBlock ( ClassMetadataInfo $metadata )
generateXmlEntityFieldMappingProperties ( ClassMetadataInfo $metadata )
generateXmlEntityImports ( ClassMetadataInfo $metadata )
generateXmlEntityLifecycleCallbackMethods ( ClassMetadataInfo $metadata )
generateXmlEntityNamespace ( ClassMetadataInfo $metadata )
generateXmlEntityStubMethod ( ClassMetadataInfo $metadata, $type, $fieldName, $typeHint = null )
generateXmlEntityStubMethods ( ClassMetadataInfo $metadata )
getChangeTrackingPolicyString ( $policy )
getClassName ( ClassMetadataInfo $metadata )
getClassToExtend ( )
getClassToExtendName ( )
getIdGeneratorTypeString ( $type )
getNamespace ( ClassMetadataInfo $metadata )
hasMethod ( $method, ClassMetadataInfo $metadata )
hasNamespace ( ClassMetadataInfo $metadata )
hasProperty ( $property, ClassMetadataInfo $metadata )
parseTokensInXmlEntityFile ( string $path )
prefixCodeWithSpaces ( $code, $num = 1 )

Описание методов

generate() публичный Метод

Generate and write xml-entity classes for the given array of ClassMetadataInfo instances
public generate ( array $metadatas, string $outputDirectory ) : void
$metadatas array
$outputDirectory string
Результат void

generateUpdatedXmlEntityClass() публичный Метод

Generate the updated code for the given ClassMetadataInfo and xml-entity at path
public generateUpdatedXmlEntityClass ( ClassMetadataInfo $metadata, string $path ) : string
$metadata Doctrine\OXM\Mapping\ClassMetadataInfo
$path string
Результат string $code;

generateXmlEntityClass() публичный Метод

Generate a PHP5 Doctrine 2 xml-entity class from the given ClassMetadataInfo instance
public generateXmlEntityClass ( ClassMetadataInfo $metadata ) : string
$metadata Doctrine\OXM\Mapping\ClassMetadataInfo
Результат string $code

setBackupExisting() публичный Метод

Should an existing xml-entity be backed up if it already exists?
public setBackupExisting ( $bool )

setClassToExtend() публичный Метод

Set the name of the class the generated classes should extend from
public setClassToExtend ( $classToExtend ) : void
Результат void

setExtension() публичный Метод

Set the extension to use when writing php files to disk
public setExtension ( string $extension ) : void
$extension string
Результат void

setGenerateAnnotations() публичный Метод

Set whether or not to generate annotations for the xml-entity
public setGenerateAnnotations ( boolean $bool ) : void
$bool boolean
Результат void

setGenerateStubMethods() публичный Метод

Set whether or not to generate stub methods for the xml-entity
public setGenerateStubMethods ( boolean $bool ) : void
$bool boolean
Результат void

setNumSpaces() публичный Метод

Set the number of spaces the exported class should have
public setNumSpaces ( integer $numSpaces ) : void
$numSpaces integer
Результат void

setRegenerateXmlEntityIfExists() публичный Метод

Set whether or not to regenerate the xml-entity if it exists
public setRegenerateXmlEntityIfExists ( boolean $bool ) : void
$bool boolean
Результат void

setUpdateXmlEntityIfExists() публичный Метод

Set whether or not to try and update the xml-entity if it already exists
public setUpdateXmlEntityIfExists ( boolean $bool ) : void
$bool boolean
Результат void

writeXmlEntityClass() публичный Метод

Generated and write xml-entity class to disk for the given ClassMetadataInfo instance
public writeXmlEntityClass ( ClassMetadataInfo $metadata, string $outputDirectory ) : void
$metadata Doctrine\OXM\Mapping\ClassMetadataInfo
$outputDirectory string
Результат void