开发者

How to change entity class names Doctrine generated

I'm using Doctrine 2 and use these functions to generate entities from existing DB:

    $cmf = new DisconnectedClassMetadataFactory();
    $cmf->setEntityManager($this->em);
    $metadata = $cmf->getAllMetadata();
    $generato开发者_运维知识库r = new EntityGenerator();

    $generator->setUpdateEntityIfExists(true);
    $generator->setGenerateStubMethods(true);
    $generator->setGenerateAnnotations(true);
    $generator->generate($metadata, APPPATH."models/entities");

but i want to change names of entity class just like these: "ActionsEntity", "UserEntity". Not want "Actions" and "User" etc.


Go to ORM/Tools/EntityGenerator.php Line 347

private function _generateEntityClassName(ClassMetadataInfo $metadata)

apply changes you want in this function.

Go to Line 584

private function _generateEntityStubMethods(ClassMetadataInfo $metadata)

apply changes you want in this function.

Go to Line 766

private function _generateAssociationMappingPropertyDocBlock

apply changes you want in this function.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜