zf2 db表关系模式

时间:2014-02-27 14:16:30

标签: design-patterns zend-framework2 zend-db

我在zf2中创建一个表关系模型,并希望以正确的方式创建它(没有doctrine模块)。 我有树桌

| Tables_in_zf2_a  |
+------------------+
| article          |
| article_language |
| article_text     |
+------------------+

+-----------+-----------+------+-----+---------------------+-----------------------------+
| Field     | Type      | Null | Key | Default             | Extra                            |
+-----------+-----------+------+-----+---------------------+-----------------------------+
| id        | int(11)   | NO   | PRI | NULL                | auto_increment                  |
| parent_id | int(11)   | NO   | MUL | NULL                |                             |
| added     | timestamp | NO   |     | 0000-00-00 00:00:00 | on update CURRENT_TIMESTAMP     |
+-----------+-----------+------+-----+---------------------+-----------------------------+

+-------+-------------+------+-----+---------+----------------+
| Field | Type        | Null | Key | Default | Extra          |
+-------+-------------+------+-----+---------+----------------+
| id    | int(11)     | NO   | PRI | NULL    | auto_increment |
| code  | varchar(6)  | YES  |     | NULL    |                |
| title | varchar(32) | YES  |     | NULL    |                |
+-------+-------------+------+-----+---------+----------------+

+-----------------+---------+------+-----+---------+-------+
| Field           | Type    | Null | Key | Default | Extra |
+-----------------+---------+------+-----+---------+-------+
| article_id      | int(11) | NO   | PRI | NULL    |       |
| language_id     | int(11) | NO   | PRI | NULL    |       |
| title           | text    | YES  |     | NULL    |       |
| announce        | text    | YES  |     | NULL    |       |
| text            | text    | YES  |     | NULL    |       |
| seo_title       | text    | YES  |     | NULL    |       |
| seo_keywords    | text    | YES  |     | NULL    |       |
| seo_description | text    | YES  |     | NULL    |       |
| href            | text    | YES  |     | NULL    |       |
+-----------------+---------+------+-----+---------+-------+

article_text表与article表相关,article_id是article表的主要唯一索引。并且与language_id的article_language表有关,这是主要的 问题是与zend框架2 db模块建立关系的最佳实践是什么? 谢谢!

0 个答案:

没有答案