젠드 (Zend) 또는이 전체 프레임 워크 개념은 저에게 새로운 것입니다. 몇 가지 예는 Modulegateway 형식을 기반으로합니다.이 형식에서는 Module.php에서 해당 컨트롤러와 관련된 테이블의 이름을 정의합니다.테이블 게이트 웨이 및 어댑터를 사용하는시기
/* 'MYMODULE\Model\CompanyTable' => function($sm) {
$tableGateway = $sm->get('CompanyTableGateway');
$table = new CompanyTable($tableGateway);
return $table;
},
'CompanyTableGateway' => function ($sm) {
$dbAdapter = $sm->get('Zend\Db\Adapter\Adapter');
$resultSetPrototype = new ResultSet();
$resultSetPrototype->setArrayObjectPrototype(new Company());
return new TableGateway('rs_company', $dbAdapter, null, $resultSetPrototype);
},*/
그리고 다른 예에서 __constuct을 통해 intializing 만 3 어댑터에 대해 이야기 Module.php 코드의 라인()
'MYMODULE\Model\CompanyTable' => function($sm) {
$dbAdapter = $sm->get('Zend\Db\Adapter\Adapter');
$table = new CompanyTable($dbAdapter);
return $table;
},
및
public function __construct(Adapter $adapter) {
$this->adapter = $adapter;
$this->resultSetPrototype = new ResultSet();
$this->resultSetPrototype->setArrayObjectPrototype(new Company());
$this->initialize();
}
클래스 __construc()에있다
내가 이해할 수없는 것은 두 가지 방법 중에서 선택하는 방법입니다.