合规国际互联网加速 OSASE为企业客户提供高速稳定SD-WAN国际加速解决方案。 广告
执行: php bin/console doctrine:mapping:import --force AppBundle xml * * * * * E:\phpsource\symfonys\blog>php bin/console doctrine:mapping:import --force AppBundle xml Importing mapping information from "default" entity manager > writing E:\phpsource\symfonys\blog\src\AppBundle/Resources/config/doctrine/Blog.orm.xml > writing E:\phpsource\symfonys\blog\src\AppBundle/Resources/config/doctrine/BlogConfigs.orm.xml > writing E:\phpsource\symfonys\blog\src\AppBundle/Resources/config/doctrine/Blogtag.orm.xml > writing E:\phpsource\symfonys\blog\src\AppBundle/Resources/config/doctrine/Blogtype.orm.xml > writing E:\phpsource\symfonys\blog\src\AppBundle/Resources/config/doctrine/Comment.orm.xml > writing E:\phpsource\symfonys\blog\src\AppBundle/Resources/config/doctrine/Content.orm.xml > writing E:\phpsource\symfonys\blog\src\AppBundle/Resources/config/doctrine/Link.orm.xml > writing E:\phpsource\symfonys\blog\src\AppBundle/Resources/config/doctrine/Say.orm.xml > writing E:\phpsource\symfonys\blog\src\AppBundle/Resources/config/doctrine/Tag.orm.xml > writing E:\phpsource\symfonys\blog\src\AppBundle/Resources/config/doctrine/Test.orm.xml * * * * * 我们看一看Blogtype.orm.xml * * * * * ~~~ <?xml version="1.0" encoding="utf-8"?> <doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> <entity name="AppBundle\Entity\Blogtype" table="blogtype"> <id name="id" type="integer" column="id"> <generator strategy="IDENTITY"/> </id> <field name="name" type="string" column="name" length="24" nullable="false"> <options> <option name="fixed">1</option> <option name="comment">类型名称</option> <option name="default"/> </options> </field> <field name="topid" type="integer" column="topid" nullable="false"> <options> <option name="unsigned"/> <option name="default">0</option> </options> </field> </entity> </doctrine-mapping> ~~~ * * * * * 这里生在了表的映射关系。由此看我们开发过程中最好写上字段的备注 生成实体Entity,即生成m层。对应表跟类一一对应, php bin/console doctrine:mapping:convert annotation ./src * * * * * E:\phpsource\symfonys\blog>php bin/console doctrine:mapping:convert annotation ./src Processing entity "AppBundle\Entity\Blog" Processing entity "AppBundle\Entity\BlogConfigs" Processing entity "AppBundle\Entity\Blogtag" Processing entity "AppBundle\Entity\Blogtype" Processing entity "AppBundle\Entity\Comment" Processing entity "AppBundle\Entity\Content" Processing entity "AppBundle\Entity\Link" Processing entity "AppBundle\Entity\Say" Processing entity "AppBundle\Entity\Tag" Processing entity "AppBundle\Entity\Test" * * * * * 用命令生成相关的model 或我们说的Entity 个人感觉是从ROR那里学来的。 * * * * * E:\phpsource\symfonys\blog>php bin/console doctrine:generate:entities AppBundle --no-backup Generating entities for bundle "AppBundle" > generating AppBundle\Entity\Blog > generating AppBundle\Entity\BlogConfigs > generating AppBundle\Entity\Blogtag > generating AppBundle\Entity\Blogtype > generating AppBundle\Entity\Comment > generating AppBundle\Entity\Content > generating AppBundle\Entity\Link > generating AppBundle\Entity\Say > generating AppBundle\Entity\Tag > generating AppBundle\Entity\Test 上面的命领生成了set get 这样可以用 setTagid 一类的函数操作protected的属生了。 * * * * * 到这里就卡住了,参考了: http://www.cnblogs.com/Seekr/archive/2012/06/25/2560631.html