모듈 개발 시 item 클래스를 다중상속 으로 구현하려고 합니다.
aa.item.class
aaItem extends Object
{
var $target_srl = 0;
function __construct($target_srl = 0)
{
$this->target_srl = $target_srl;
$this->_loadFromDB();
}
/**
* Get data from database, and set the value to item object
*
* this method is protected
* @return void
*/
protected function _loadFromDB()
{
}
}
bb.item.class
bb.item.class extends aaItem
{
function _loadFromDB()
{
}
}
위와 같이 다중상속으로 클래스 선언하여 구현 시 class not found 오류가 발생하네요.
별도의 파일 생성 룰이 있는지요?
정상
new aaItem($target_srl);
Class not found 오류
new bbItem($target_srl)
파일명과 클래스명이 매치되지 않아서 오토로딩이 작동하지 않는 것 같습니다.
aa 모듈 폴더 내에 aa.item.php라는 파일이 있다면 aaitem 클래스를 처음 사용하는 시점에 오토로딩 됩니다.
bbitem 클래스는 당연히 bb 모듈 폴더 내에 bb.item.php라는 파일을 찾게 되고요.
어떤 형태로든 aaitem을 먼저 한 번 사용한 후에 new bbitem을 호출해 보세요.
아니면 수동으로 include_once를 써주셔도 되고요.