私はLaravelで書かれたAPIを持っています。クラスの例:ExtJS RPCは正確なクラスでは機能しません
/**
* Class MRoleController
* @package App\Http\Controllers\API
*/
class MRoleAPIController extends BaseApiController
{
/** @var MRoleRepository */
private $mRoleRepository;
public function __construct(MRoleRepository $mRoleRepo)
{
$this->mRoleRepository = $mRoleRepo;
}
/**
* @param Request $request
* @return Response
*
* @SWG\Get(
* path="/m_roles",
* summary="Get a listing of the MRoles.",
* tags={"MRole"},
* description="#Get all MRoles",
* produces={"application/json"},
* @SWG\Response(
* response=200,
* description="successful operation",
* @SWG\Schema(
* type="object",
* @SWG\Property(
* property="success",
* type="boolean"
* ),
* @SWG\Property(
* property="data",
* type="array",
* @SWG\Items(ref="#/definitions/MRole")
* ),
* @SWG\Property(
* property="message",
* type="string"
* )
* )
* )
*)
*
* @direct
*/
public function index($request = false)
{
return parent::getAll($request, $this->mRoleRepository);
}
私はメソッドで別のクラスを持っており、RPCは正しく動作します。
Ext.define('AIS.model.role', {
extend: 'Ext.data.Model',
alias: 'model.role',
requires: [
'Project.DirectAPI',
'Ext.data.field.Integer',
'Ext.data.field.String',
'Ext.data.proxy.Direct',
'Ext.data.reader.Json'
],
idProperty: 'Role_id',
fields: [
{
type: 'int',
name: 'RoleId'
},
{
type: 'string',
name: 'RoleName_RU'
},
{
type: 'string',
name: 'RoleName_UZ'
},
{
type: 'string',
name: 'RoleName_EN'
}
],
proxy: {
type: 'direct',
api: {
read: 'API.MRole.index',
create: 'API.MRole.store',
update: 'API.MRole.update',
destroy: 'API.MRole.destroy'
},
reader: {
type: 'json',
rootProperty: 'data',
totalProperty: 'totalCount'
}
}
});
ありがとう:私はこのクラスを使用しようと
-
Ext.direct.Manager.resolveApi(): Cannot resolve Direct API method 'API.MRole.index' for read action in Ext.data.proxy.Direct instance with id: unknown
-
Uncaught Error: Cannot resolve Direct API method 'API.MRole.index' for read action in Ext.data.proxy.Direct instance with id: unknown
ExtJSのモデル、:
ブラウザコンソールで、私は2つのエラーを取得しますあなたの答え。
UPD:ExtJSバージョン - 6.2 – TheWorldNode