symfony - API driven symfony2 project -
im trying create api driven project in symfony2 using fosrestbundle.
i have apicontroller action getdataaction().
this works when send requests external application.i json encoded data expected.
but i'll needing data in same application well(i.e. other controller within same application).
which appropriate method of doing this?
- creating object of
apicontroller, calling required action on it. or - or sending curl request other controller
getdataaction()ofapicontrollerdata.
you can data apicontroller using route forwarding . using can use action in controller. no need curl or separate controller object. thing :
$details = $this->forward('acmerestbundle:api:getdata',array('_format'=>'json')); that return result-set action.may :
content":protected]=> string(107181) "{}" ["version":protected]=> string(3) "1.0" ["statuscode":protected]=> int(200) ["statustext":protected]=> string(2) "ok" ["charset":protected]=> null
Comments
Post a Comment