Zend\Db\TableGateway\TableGateway
에 대한 젠드 프레임 워크이 문서는 말한다 :(왜) Zend Db ResultSet이 TableGateway 기능입니까?
에서 [젠드 \ DB \ TableGateway \ TableGateway] 3 가지 형태의 기능을 할 수 생성자 : 하나의 기능 객체로로 FeatureSet 오브젝트 또는 Feature 오브젝트 배열입니다.
및 TableGateway
생성자는 실제로 checks 유형입니다.
그래서 TableGateway
생성자의 네 번째 인수는 Feature\AbstractFeature
또는 Feature\FeatureSet
과 호환되거나 Feature\AbstractFeature
호환 개체의 배열이어야합니다.
는 model part of the Get Started tutorial에 입력 TableGateway
의 목적은 생성하며 넷째 인수로 Zend\Db\ResultSet\ResultSet
을 얻는다 :
class Module
{
// getAutoloaderConfig() and getConfig() methods here
// Add this method:
public function getServiceConfig()
{
return array(
'factories' => array(
...
'AlbumTableGateway' => function ($sm) {
$dbAdapter = $sm->get('Zend\Db\Adapter\Adapter');
$resultSetPrototype = new ResultSet();
$resultSetPrototype->setArrayObjectPrototype(new Album());
return new TableGateway('album', $dbAdapter, null, $resultSetPrototype);
},
),
);
}
}
ResultSet
가 instanceof
AbstractFeature
아니다. 그러나 그것은 효과적이다.
어떻게 작동합니까?
와 호환 할 필요가네 번째 매개 변수. :) 고맙습니다! – automatix