{"id":9,"date":"2007-10-25T02:38:11","date_gmt":"2007-10-24T18:38:11","guid":{"rendered":"http:\/\/amjet.dyndns.biz\/blog\/IT\/?p=9"},"modified":"2013-03-01T19:50:48","modified_gmt":"2013-03-01T11:50:48","slug":"propel-object-relational-mapping-orm-%e8%a7%a3%e6%b1%ba%e6%96%b9%e6%a1%88","status":"publish","type":"post","link":"https:\/\/blog.amjet.biz\/IT\/?p=9","title":{"rendered":"Propel Object-Relational Mapping (ORM) \u89e3\u6c7a\u65b9\u6848"},"content":{"rendered":"<p>Java \u5e73\u53f0\u6574\u5408 Hibernate \u9019\u500b ORM \u5957\u4ef6\u9032\u884c\u958b\u767c\u76f8\u7576\u7684\u666e\u904d\uff0c\u73fe\u5728 PHP \u4e5f\u6709 <a href=\"http:\/\/propel.phpdb.org\">Propel<\/a> \u548c\u5176\u4ed6\u985e\u4f3c\u7684\u5957\u4ef6\uff0c\u7531\u65bc Propel \u5df2\u7d93\u6574\u5408\u5230 <a href=\"http:\/\/www.symfony-project.com\/\">symfony<\/a> \u9019\u500b PHP framework\uff0c\u76f8\u4fe1\u6280\u8853\u548c\u7a69\u5b9a\u65b9\u9762\u90fd\u9054\u5230\u4e86\u4e00 \u5b9a\u7a0b\u5ea6\uff0c\u6700\u8fd1\u8a66\u8457\u6574\u5408\u7684\u78ba\u662f\u6709\u4e00\u5b9a\u7684\u56f0\u96e3\u5ea6\uff0c\u6574\u7406\u7684\u5fc3\u5f97\u5982\u4e0b\uff1a<\/p>\n<p>\u4e00 \u3001\u5b89\u88dd<\/p>\n<p>\u5728 Fedora 7 \u4e0a\u9700\u8981\u4ee5\u4e0b\u5e7e\u500b\u5957\u4ef6<\/p>\n<ol>\n<li>php-5.2.4<\/li>\n<li>php-pear-1.5.0<\/li>\n<li>php-xml-5.2.4<\/li>\n<li>php-pear-log<\/li>\n<li>php-mysql-5.2.4 (\u770b\u4f7f\u7528\u4ec0\u9ebc\u8cc7\u6599\u5b89\u88dd\u5c0d\u61c9\u7684\u5957\u4ef6)<\/li>\n<\/ol>\n<p>\u4e0a\u9762\u7684\u5957\u4ef6\u4e26\u4e0d\u5305\u542b Propel\uff0c\u4e0d\u904e PHP \u7684\u5957\u4ef6\u7ba1\u7406\u7684\u78ba\u5df2\u7d93\u76f8\u7576\u6210\u719f\uff0c\u5b89\u88dd Propel \u76f8\u7576\u65b9\u4fbf\uff0c\u9019\u88e1\u4ecb\u7d39\u5229\u7528 Pear \u5b89\u88dd\u7684\u7a0b\u5e8f\uff1a<\/p>\n<p>\u9996\u5148\u5b89\u88dd phing \u9019\u500b\u5fc5\u9700\u7684\u5957\u4ef6<\/p>\n<p>pear channel-discover pear.phing.info<br \/>\npear install phing\/phing<\/p>\n<p>\u63a5\u8457\u4ee5\u4e0b3\u500b\u6307\u4ee4\u5c31\u53ef\u4ee5\u88dd\u597d Propel<\/p>\n<p>pear channel-discover pear.phpdb.org<br \/>\npear install phpdb\/propel_generator<br \/>\npear install phpdb\/propel_runtime<\/p>\n<p>\u8acb\u6ce8\u610f\u6307\u4ee4\u9806\u5e8f\uff0c\u5728\u5b89\u88dd\u904e\u7a0b\u4e2d pear \u6703\u81ea\u52d5\u5b89\u88dd\u5176\u4ed6\u6240\u9700\u8981\u7684\u5957\u4ef6.<\/p>\n<p>\u65e2\u7136\u662f ORM  \u4e00\u5b9a\u6703\u6709\u5f8c\u7aef\u8cc7\u6599\u5eab\u6574\u5408\uff0c\u5982\u679c\u7528\u7684\u662fMySQL \u8acb\u6aa2\u67e5 php5-mysql \u5957\u4ef6\u662f\u5426\u5df2\u5b89\u88dd<\/p>\n<p>\u4e8c \u3001\u61c9\u7528<\/p>\n<p>Propel \u5728\u81ea\u52d5\u7522\u751f PHP ORM class \u6642\u5fc5\u9700\u6709\u8cc7\u6599\u5eab schema \u6a94\u6848\uff0c\u53ef\u4ee5\u53c3\u8003\u5b98\u65b9\u7db2\u7ad9\u7684\u6587\u4ef6\u4f86\u64b0\u5beb\uff0c\u6a94\u6848\u5b8c\u6210\u5f8c Propel \u53ef\u4ee5\u4f9d\u64da schema \u6a94\u6848\u81ea\u52d5\u5efa\u7acb\u76f8\u95dc table\uff0c\u9019\u88e1\u4ecb\u7d39\u53e6\u4e00\u500b\u6bd4\u8f03\u5e38\u7528\u7684\u6a21\u5f0f\uff0c\u8cc7\u6599\u5eab table \u5efa\u597d\u5f8c\uff0c\u81ea\u52d5\u7522\u751f schema \u6a94\u6848\u3002<\/p>\n<p>\u5148\u5efa\u7acb build.properties\uff0cmysql \u7bc4\u4f8b\u5982\u4e0b<\/p>\n<p>propel.project = &lt;project name&gt;<br \/>\npropel.database = mysql<br \/>\npropel.database.url = mysql:\/\/&lt;db user&gt;:&lt;db password&gt;@&lt;db host&gt;\/&lt;database&gt;<\/p>\n<p>\u63a5\u4e0b\u4f86\u7528\u4ee5\u4e0b\u6307\u4ee4\u5c31\u53ef\u4ee5\u81ea\u52d5\u4f9d\u64da table \u7522\u751f schema.xml<\/p>\n<p>phing -f \/usr\/share\/pear\/data\/propel_generator\/pear-build.xml -Dproject.dir=. creole<\/p>\n<p>* \u91cd\u9ede\u662f  pear-build.xml \u5b9a\u7fa9\u4e86\u5efa\u7acb propel \u76f8\u95dc\u6a94\u6848\u7684\u8cc7\u6599\uff0c\u4e0d\u540c\u7684 distribution \u53ef\u80fd\u5728\u4e0d\u540c\u4f4d\u7f6e<\/p>\n<p>\u6709\u4e86  build.properties\u3001schema.xml \u5f8c\u8acb\u4f9d\u7167\u5b98\u65b9\u7db2\u7ad9\u7684\u8aaa\u660e\u5efa\u7acb runtime-conf.xml\uff0c\u6709\u4e86\u90193\u500b\u6a94\u6848\uff0c\u4ee5\u4e0b\u6307\u4ee4\u5c31\u53ef\u4ee5\u81ea\u52d5\u5efa\u7acb php \u7684 class<\/p>\n<p>phing -f \/usr\/share\/pear\/data\/propel_generator\/pear-build.xml -Dproject.dir=.<\/p>\n<p><strong>[ratings]<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Java \u5e73\u53f0\u6574\u5408 Hibernate \u9019\u500b ORM \u5957\u4ef6\u9032\u884c\u958b\u767c\u76f8\u7576\u7684\u666e\u904d\uff0c\u73fe\u5728 PHP \u4e5f\u6709 Propel \u548c\u5176\u4ed6\u985e\u4f3c\u7684\u5957\u4ef6\uff0c\u7531\u65bc Propel \u5df2\u7d93\u6574\u5408\u5230 symfony \u9019\u500b PHP framework\uff0c\u76f8\u4fe1\u6280\u8853\u548c\u7a69\u5b9a\u65b9\u9762\u90fd\u9054\u5230\u4e86\u4e00 \u5b9a\u7a0b\u5ea6\uff0c\u6700\u8fd1\u8a66\u8457\u6574\u5408\u7684\u78ba\u662f\u6709\u4e00\u5b9a\u7684\u56f0\u96e3\u5ea6\uff0c\u6574\u7406\u7684\u5fc3\u5f97\u5982\u4e0b\uff1a \u4e00 \u3001\u5b89\u88dd \u5728 Fedora 7 \u4e0a\u9700\u8981\u4ee5\u4e0b\u5e7e\u500b\u5957\u4ef6 php-5.2.4 php-pear-1.5.0 php-xml-5.2.4 php-pear-log php-mysql-5.2.4 (\u770b\u4f7f\u7528\u4ec0\u9ebc\u8cc7\u6599\u5b89\u88dd\u5c0d\u61c9\u7684\u5957\u4ef6) \u4e0a\u9762\u7684\u5957\u4ef6\u4e26\u4e0d\u5305\u542b Propel\uff0c\u4e0d\u904e PHP \u7684\u5957\u4ef6\u7ba1\u7406\u7684\u78ba\u5df2\u7d93\u76f8\u7576\u6210\u719f\uff0c\u5b89\u88dd Propel \u76f8\u7576\u65b9\u4fbf\uff0c\u9019\u88e1\u4ecb\u7d39\u5229\u7528 Pear \u5b89\u88dd\u7684\u7a0b\u5e8f\uff1a \u9996\u5148\u5b89\u88dd phing \u9019\u500b\u5fc5\u9700\u7684\u5957\u4ef6 pear channel-discover pear.phing.info pear install phing\/phing \u63a5\u8457\u4ee5\u4e0b3\u500b\u6307\u4ee4\u5c31\u53ef\u4ee5\u88dd\u597d Propel pear channel-discover pear.phpdb.org pear install phpdb\/propel_generator pear [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[99,137,100],"class_list":["post-9","post","type-post","status-publish","format-standard","hentry","category-php","tag-orm","tag-php","tag-propel"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/blog.amjet.biz\/IT\/index.php?rest_route=\/wp\/v2\/posts\/9","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.amjet.biz\/IT\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.amjet.biz\/IT\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.amjet.biz\/IT\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.amjet.biz\/IT\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=9"}],"version-history":[{"count":4,"href":"https:\/\/blog.amjet.biz\/IT\/index.php?rest_route=\/wp\/v2\/posts\/9\/revisions"}],"predecessor-version":[{"id":749,"href":"https:\/\/blog.amjet.biz\/IT\/index.php?rest_route=\/wp\/v2\/posts\/9\/revisions\/749"}],"wp:attachment":[{"href":"https:\/\/blog.amjet.biz\/IT\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=9"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.amjet.biz\/IT\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=9"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.amjet.biz\/IT\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=9"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}