开发者

Doctrine 2 mapping - cant auto generate yml files

I'm trying to get doctrine 2 work for me (I used to work with d1)

but I can't get doctrine generate the models (like on doctrine1)

I have downloaded the lastest version of doctrine 2.1 so my directory tree looks like that :


C:\doctrine\bin - got it from the tar file

C:\doctrine\Doctrine - got it from the tar file

C:\doctrine\models - created by me for mapping info


I also edited the bin doctrine.php file and added cli-config.php file and its looking like that:

C:\doctrine\bin\doctrine.php --> http://pastebin.com/Ki62hbTX

C:\doctrine\bin\cli-config.php --> http://pastebin.com/cPv4fXX1

Now when I'm going to cmd this is the result:

c:\doctrine\bin>php doctrine orm:schema-tool:create

No Metadata Classes to process.

开发者_运维知识库

I checked the paths of files, write permissions, db login info and every thing but I can't find out how to read db and generate the class

any idea will be great, thanks


There might be several problems here, but let me start by saying that I just moved to doctrine2 from 1.2 and it is way easier to use php annotations in doctrine2. Then you're creating the class yourself....everything just seems to make sense a little more.

But, if you want to use YAML, be aware that with YAML and Doctrine2, the YAML hierarchy is completely different. So you can't just load your doctrine1 yaml into doctrine2.

Here's the guide to YAML in doctrine 2: http://www.doctrine-project.org/docs/orm/2.0/en/reference/yaml-mapping.html

The one thing that I found is that Doctrine2 wanted a specific folder for my namespace. So my entities are in entities/NAMESPACE/ rather than just entities/. Also note that you need a separate file for each class and the naming conventions are very strict.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜