Skip to content
This repository has been archived by the owner on Jan 16, 2019. It is now read-only.

Docs IOC Integration

Frank Kleine edited this page Apr 7, 2012 · 1 revision

Inversion of Control: Integration into Stubbles MVC

Stubbles provides an class named net::stubbles::ioc::stubApp that you can use in your Stubbles MVC application, which will create a stubFrontController using given bindings.

stubApp::createFrontController(new stubPropertiesBindingModule($projectPath),
                               'net::stubbles::ipo::ioc::stubIpoBindingModule',
                               stubWebsiteBindingModule::createWithXmlProcessorAsDefault('interceptors')
                                                       ->enableRss('interceptors')
                                                       ->enableJsonRpc('interceptors')
         )
       ->process();

To add your own bindings you may implement the net::stubbles::ioc::module::stubBindingModule interface.

#php
<?php
/**
*Application specific bindings
*/
stubClassLoader::load('net::stubbles::ioc::module::stubBindingModule');
/**
*Application specific bindings
*/
class MyBindingModule extends stubBindingModule
{
    /**
***Configure the bindings
     *
***@param  stubBinder    $binder    the binder to configure
***/
    public function configure(stubBinder $binder)
    {
        $binder->bind('Foo')->to('FooImpl');
        // more bindings should follow here
    }
}
?>
Clone this wiki locally