Rovak / KJSencha

Ext-JS / Sencha Touch Integration Module for Zend Framework 2
Other
24 stars 15 forks source link

[DO NOT MERGE] Feature: #4, services as rpc api #8

Closed Ocramius closed 11 years ago

Ocramius commented 11 years ago

Services as RPC services

This is a PoC for #4

Usage

  1. Define your own service (Your\Module#getServiceConfig()):

    return array(
        'factories' => array(
            'my_cool_test_service' => function ($sm) {
               return new \My\Awesome\Service($sm->get('cool_stuff'));
            },
        ),
    );
  2. Ma your service in the kjsencha config (Your\Module#getConfig()): `php return array( 'kjsencha' => array( 'direct' => array( 'modules' => array( // to be removed? ), 'services' => array( // mapping FQCN (JS-side) to the services that provide the API 'My.test.service' => 'my_cool_test_service', 'Grid' => 'my_cool_test_service', 'Application.direct.Grid' => 'my_cool_test_service', ), ), 'bootstrap' => array( 'default' => array( 'modules' => array( // hack to produce some actual output. output isn't yet valid though (TBD) '' => array( 'namespace' => '', ), ), ), ), ), ); ``
Ocramius commented 11 years ago

Relevant commit for this PR is only 7817008. All the rest is just because it is currently based on #7

This is just a test to see if my idea works. I am still cleaning up my mind about scanning method names & co :)

Ocramius commented 11 years ago

Am currently working on this one to make it a decent PR