나는 아래이 ERD가 : 내가 제공 엔티티 ID의 배열에 포털베이스의 목록을 검색 할 때, 내가 가진Phalcon 치명적인 오류
Relations are as follow, Entity to Host is One to One Host to Portal is One to Many (One Host to Many Portal)
class Entity extends Model
{
public function initialize()
{
$this->hasOne(
"entity_id",
"Host",
"entity_id"
);
}
}
class Host extends Model
{
public function initialize()
{
$this->belongsTo(
"entity_id",
"Host",
"entity_id"
);
$this->hasMany(
"host_id"
"Portal",
"host_id"
);
}
}
class Portal extends Model
{
public function initialize()
{
$this->belongsTo(
"portal_id",
"Host,
"portal_id"
);
}
}
을 치명적인 오류.
Fatal error: Call to undefined method Phalcon\Mvc\Model\Resultset\Simple::getHost()
이
$hostObj = Host::find(['entity_id IN ({ids:array})',
'bind' => array('ids' => $entity_id)]);
if($hostObj)
{
$portals = $hostObj->Portal;
}
는 기본적으로 목표는 제공 ENTITY_ID의 배열에 포털베이스의 목록을 검색 할 수있는 포털을 검색하기 위해 내 컨트롤러 코드입니다. 그러나 필자는 필자의 모델 관계가 치명적인 오류로 이어지는 것은 무엇이 잘못된 것인지 궁금합니다. 당신은`gethost를()를 사용하는 경우
처럼 (
Resultset
에서findFirst
선택하거나 행을 사용하거나 필요 결과 집합을 반환'? – Timothy