딩이 당신을 돕고있어서 기쁩니다. 이 프로젝트에 참여하고 Zend Framework 응용 프로그램과 통합해야했습니다. 이를 위해 Zend의 애플리케이션 리소스와 플러그인 시스템을 사용했습니다.
응용 프로그램 자원
<?php
class Application_Resource_Ding extends Zend_Application_Resource_ResourceAbstract
{
protected $_options = array(
'factory' => array(
'bdef' => array(
'xml' => array(
'filename' => array('beans.xml')
),
),
),
'cache' => array(
'proxy' => array('impl' => 'dummy'),
'bdef' => array('impl' => 'dummy'),
'beans' => array('impl' => 'dummy')
)
);
public function init()
{
// set default config dir before mergin options (cant be set statically)
$this->_options['factory']['bdef']['xml']['directories'] = array(APPLICATION_PATH .'/configs');
$options = $this->getOptions();
// parse factory properties (if set)
if (isset($options['factory']['properties'])) {
$options['factory']['properties'] = parse_ini_file(
$options['factory']['properties']
);
}
// change log4php_properties for log4php.properties (if exists)
if (isset($options['log4php_properties'])) {
$options['log4php.properties'] = $options['log4php_properties'];
unset($options['log4php_properties']);
}
$properties = array(
'ding' => $options
);
return Ding\Container\Impl\ContainerImpl::getInstance($properties);
}
}
액션 도우미는 컨트롤러 내부에서 사용하는 (당신이 프로젝트 사이에서 다시 사용할 수 있습니다)에서
<?php
class Application_Action_Helper_Ding extends Zend_Controller_Action_Helper_Abstract
{
protected $ding = null;
public function init()
{
// just once...
if (null !== $this->ding) {
return;
}
// get ding bootstrapped resource
$bootstrap = $this->getActionController()->getInvokeArg('bootstrap');
$ding = $bootstrap->getResource('ding');
if (!$ding) {
throw new Zend_Controller_Action_Exception(
'Ding resource not bootstrapped'
);
}
$this->ding = $ding;
}
public function getBean($bean)
{
return $this->ding->getBean($bean);
}
public function direct($bean)
{
return $this->getBean($bean);
}
}
당신의 application.ini
이 같은 (플러스 여분을 추가해야합니다 구성이 필요합니다)
resources.frontController.actionHelperPaths.Application_Action_Helper = "Application/Action/Helper"
resources.ding.factory.properties = APPLICATION_PATH "/configs/ding.properties"
resources.ding.log4php_properties = APPLICATION_PATH "/configs/log4php.properties"
그런 다음 컨트롤 rs, 빈을 요청하는 경우 :
$service = $this->_helper->ding('someService');
희망이 있습니다.
오늘 새 Ding 프레임 워크를 발표했으며 홍보를 찾고 있습니까? –
감사합니다.하지만 저자가 아니란 것을 확인할 수 있습니다. – laurac
Ding Framework이란 무엇입니까? 링크, 제발? – curtisdf