{"id":368,"date":"2012-01-24T09:50:28","date_gmt":"2012-01-24T08:50:28","guid":{"rendered":"http:\/\/webpiraten.de\/?p=368"},"modified":"2012-01-24T09:50:28","modified_gmt":"2012-01-24T08:50:28","slug":"doctrine-create-and-drop-table-on-the-fly-by-orm","status":"publish","type":"post","link":"https:\/\/webpiraten.de\/index.php\/php\/doctrine-create-and-drop-table-on-the-fly-by-orm\/","title":{"rendered":"doctrine create and drop table on the fly by orm"},"content":{"rendered":"<p>um in doctrine erst in der app tables anzulegen oder auch zu droppen kannst du ein yaml schema<\/p>\n<pre class=\"brush: css; title: ; notranslate\" title=\"\">\r\nMyTestOrm:\r\n  tableName: my_test_table\r\n  columns:\r\n    id:\r\n      type: integer(8)\r\n      primary: true\r\n      autoincrement: true\r\n      unsigned: true\r\n    title:\r\n      type: string(255)\r\n      notnull: true\r\n    created_at:\r\n      type: timestamp\r\n      notnull: true\r\n  indexes:\r\n    id:\r\n      fields: &#x5B;id]\r\n    title:\r\n      fields: &#x5B;title]\r\n<\/pre>\n<p>anlegen und die orms daraus generieren.<br \/>\ndann kannst du in deiner app die table f\u00fcr die orm anlegen<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\nDoctrine::createTablesFromArray(\r\n    array(\r\n        'MyTestOrm'\r\n    )\r\n);\r\n<\/pre>\n<p>bzw. auch wieder droppen<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n$table = Doctrine_Core::getTable('MyTestOrm');\r\n$export = new Doctrine_Export();\r\n$export-&gt;dropTable($table-&gt;getTableName());\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>um in doctrine erst in der app tables anzulegen oder auch zu droppen kannst du ein yaml schema MyTestOrm: tableName: my_test_table columns: id: type: integer(8) primary: true autoincrement: true unsigned: true title: type: string(255) notnull: true created_at: type: timestamp notnull: true indexes: id: fields: &#x5B;id] title: fields: &#x5B;title] anlegen und die orms daraus generieren. dann [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[53,11,5],"tags":[297,296,298,633,299,300],"class_list":["post-368","post","type-post","status-publish","format-standard","hentry","category-doctrine-orm","category-mysql","category-php","tag-create","tag-doctrine","tag-drop","tag-php","tag-table","tag-yaml"],"_links":{"self":[{"href":"https:\/\/webpiraten.de\/index.php\/wp-json\/wp\/v2\/posts\/368","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webpiraten.de\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webpiraten.de\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webpiraten.de\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/webpiraten.de\/index.php\/wp-json\/wp\/v2\/comments?post=368"}],"version-history":[{"count":4,"href":"https:\/\/webpiraten.de\/index.php\/wp-json\/wp\/v2\/posts\/368\/revisions"}],"predecessor-version":[{"id":372,"href":"https:\/\/webpiraten.de\/index.php\/wp-json\/wp\/v2\/posts\/368\/revisions\/372"}],"wp:attachment":[{"href":"https:\/\/webpiraten.de\/index.php\/wp-json\/wp\/v2\/media?parent=368"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webpiraten.de\/index.php\/wp-json\/wp\/v2\/categories?post=368"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webpiraten.de\/index.php\/wp-json\/wp\/v2\/tags?post=368"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}