Hi,

I am working on a project where I used Zend DB table for database access and
ZEND JSON Server for handling JSON RPC requests from client. every thing was
working fine with ZF2 2.1 release. With help of JSON RPC, I was downloading
some data from server and loading some drop downs on the web page.

Later on, I replaced ZEND DB table with Doctrine 2 and removed the
references to Zend DB table from project. To my surprise the JSON RPC
functionality got broken because of this. The same dropdown is not getting
populated as the JSON RPC call is taking lot of time to complete the request
and many times JSON RPC call fails.

I did some quick rollback to ZEND DB Table(removed Doctroine and its calling
from controllers,model) then everything started working fine. I thought it
might be failing due to some dependency with ZEND DB left by somewhere in
code and I found below module.config

With doctrine in place, If I remove 'di' => array() then again system breaks
as to get the doctroine access to models, I have used invokable classes
'MOCAPI\Model\MOCGuestSL' and which fails on creating instance through
serviceLocator with message that no class name MOCAPI\Model\MOCGuestSL found
i.e.
$api= $this->getServiceLocator()->get('MOCAPI\Model\MOCGuestSL');

I cannot reach to scenario where dropdowns are getting populated with JSON
RPC call due to this issue.

If I keep the "di" array then it works but JSON RPC not. Earlier also I
identified a bug in the ZEND JSON RPC call where it was throwing error if
data items count was greater then 100 records. It got fixed then higher
release. Below one I am not sure but to me it seem to be an issue and
probable bug.

module.config
<?php
// module/MOCAPI/config/module.config.php:
return array(

'controllers' => array(
'invokables' => array(
'MOCAPI\Controller\MOCAPI' => 'MOCAPI\Controller\MOCAPIController',
'MOCAPI\Model\MOCGuestSL'=>'MOCAPI\Model\MOCGuestSL',
),
),
'router' => array(
'routes' => array(
'mocapi' => array(
'type' => 'segment',
'options' => array(
'route' => '/mocapi[/:action]',
'constraints' => array(
'action' => '[a-zA-Z]*',
),
'defaults' => array(
'controller' => 'MOCAPI\Controller\MOCAPI',
'action' => 'index',
),
),
),
),
),
'view_manager' => array(
'template_path_stack' => array(
'MOCAPI' => __DIR__ . '/../view',
),
),
'di' => array(
'definition' => array(
//teaching DI to use the factory
'class' => array(
'Zend\Db\Db' => array(
'methods' => array(
'factory' => array(
'adapter' => array(
'type' => false,
'required' => true,
),
'config' => array(
'type' => false,
'required' => false,
),
),
),
),
'Zend\Db\Adapter\AbstractAdapter' => array(
'instantiator' => array(
'Zend\Db\Db',
'factory',
),
),
),
),
'instance' => array(
'alias' => array(
//we just know it's an abstract adapter
'my-db-adapter' => 'Zend\Db\Adapter\AbstractAdapter',
),
//documentmanager
'my-db-adapter' => array(
'parameters' => array(
'adapter' => array(
// same db factory parameters you used in 1.x (I suppose)
),
),
),
),
),
);

composer.json is below:
{
"name": "myofficeinthecloud/cloudapp",
"description": "MyOffice in the Cloud webapp using ZF2",
"license": "BSD-3-Clause",
"keywords": [
"framework",
"zf2"
],

"require": {
"php": ">=5.3.3",
"zendframework/zendframework": "2.2.0",
"doctrine/doctrine-orm-module": "0.7.*",
"zendframework/zend-developer-tools":"dev-master",
"zendframework/zftool": "dev-master"
}

}



--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/doctorine-issue-with-JSON-RPC-tp4660797.html
Sent from the Zend Framework mailing list archive at Nabble.com.

-- 
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]


Reply via email to