나는 cakephp에 새로운 문제가있다. 나는 mysql에 2 개의 테이블을 만들었습니다. 내가 만들고자하는 관계는 'category_products'에 많은 'products'가 있습니다.CakePHP 도움말 : 나는 구울 수 없다.
CREATE TABLE category_products (
id int NOT NULL PRIMARY KEY,
name varchar(30) NOT NULL
) ENGINE=InnoDB;
CREATE TABLE products (
id int NOT NULL PRIMARY KEY,
name varchar(30) NOT NULL,
category_product_id int NOT NULL,
FOREIGN KEY (category_product_id) REFERENCES category_products(id)
) ENGINE=InnoDB;
내가 'category_products'를 구워 모든 괜찮지 만, 내가 콘솔에서 '제품'을 구울 때, 나는이 얻을 :
이=============================================================
Possible Models based on your current database:
1. CategoryProduct
2. Product
Enter a number from the list above,type in the name of another model, or 'q' to exit
[q] > 2
Baking model class for Product...
Creating file /opt/lampp/htdocs/caketest/app/models/product.php
Wrote `/opt/lampp/htdocs/caketest/app/models/product.php`
Product Model was baked.
SimpleTest is not installed. Do you want to bake unit test files anyway? (y/n) [y] > n
**Error: Missing database table 'categories' for model 'Category'**
============================================================
Cakephp **doesn't create the view** and when i open the **model** for product.php and i see this at then end.
var $belongsTo = array(
'CategoryProduct' => array(
'className' => 'CategoryProduct',
'foreignKey' => 'category_product_id',
'conditions' => '',
'fields' => '',
'order' => ''
)
);
var $hasAndBelongsToMany = array(
'Category' => array(
'className' => 'Category',
'joinTable' => 'category_products',
'foreignKey' => 'product_id',
'associationForeignKey' => 'category_id',
'unique' => true,
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'finderQuery' => '',
'deleteQuery' => '',
'insertQuery' => ''
)
);
내 문제는 내가 무슨 일을하고 있어요된다 ??? 분명히 cakephp는 내가 관계 HABTM을 만들려고한다고 생각합니다. cakephp를 사용하고 있습니다. 1.3.7
도와주세요. 감사!