2011年2月9日星期三

[fw-mvc] Dojo resource feature request

In the class Zend_Application_Resource_Dojo that ships in dojo, the
following public method is exposed:

public function getDojo()
{
if (null === $this->_dojo) {
$this->getBootstrap()->bootstrap('view');
$view = $this->getBootstrap()->view;

Zend_Dojo::enableView($view);
$view->dojo()->setOptions($this->getOptions());

$this->_dojo = $view->dojo();
}

return $this->_dojo;
}

I know I can create my own dojo resource that can consume a custom view
object, but I was wondering if this method could be changed to allow setting
the view object to a custom view object in application.ini?

Something like:

resources.dojo.enable = true
resources.dojo.view = "myView"
; more config options.....

Then, in Zend_Application_Resource_Dojo, something like:

public function getDojo()
{
if (null === $this->_dojo) {
$options = $this->getOptions();
if ($options['view']) {
$this->getBootstrap()->bootstrap($options['view']);
$view = $this->getBootstrap()->$options['view'];
} else {
$this->getBootstrap()->bootstrap('view');
$view = $this->getBootstrap()->view;
}

unset($options['view']);

Zend_Dojo::enableView($view);
$view->dojo()->setOptions($options);

$this->_dojo = $view->dojo();
}

return $this->_dojo;
}

The above is just an idea. Would a change like this be in keeping with the
goals of the vanilla resources shipped with ZF, or should I just plan on
creating my own dojo resource? If this is something the devs would approve,
how do I go about submitting the idea?

--regards,
nathan

没有评论: