상속을 구현하고 싶습니다. this article에 따라 데이터베이스를 만들지 못했지만 다음과 같이 모델을 만들 수만 있었고 모델/동작 아래에 파일/모델로 InheritBehavior.php를 만들었습니다. 조. 어떻게 상속이에 대한 데이터베이스 설계 (여러 테이블 상속를) 무엇Cakephp에서 상속을 구현하는 방법
class Animal extends AppModel{
var $name='Animal';
}
App::import('Model', 'Animal');
class Mammal extends Animal{
public $actsAs = array('Inherit');
} var $name= 'Mammal';
}
App::import('Model', 'Animal');
class Insect extends Animal{
var $name='Insect';
}
Animal: id, age
Mammal: id, no_of_legs ('age' is common)
Insect: id, no_of_wings ('age' is common)
을 지원하기 위해이 모델에 대한 데이터베이스를 설계합니다.
이 유형에 대해 연관 대신에 상속을 사용하는 것이 좋습니다 (hasOne 및 belongsTo 사용). 이는 cakephp에서 잘 지원됩니까?
+1 덤 다운 버전 이미지 : D – Deadlock