txtony / arrowdb-connector
此包已被弃用,不再维护。未建议替代包。
此包最新版本(dev-master)无可用许可信息。
连接到appcelerator MBaaS平台的途径
dev-master
2017-07-27 08:06 UTC
Requires
- php: >=5.5.0
- doctrine/doctrine-bundle: *
- symfony/framework-bundle: >=2.5.6
- twig/twig: *
This package is not auto-updated.
Last update: 2018-06-29 19:20:31 UTC
README
使用LibCurl从symfony应用与arrowDB通信,最小化函数工作
#第一步:安装
使用以下命令获取扩展包: composer require txtony/arrowdb-connector dev-master
在AppKernel.php中添加
'new TxTony\ArrowDBConnectorBundle\TxTonyArrowDBConnectorBundle()'
#第二步:配置
tx_tony_arrow_db_connector: db_driver: "orm" host: "https://api.cloud.appcelerator.com/v1" credential: oauth_consumer_key: "ArrowKey" adm_username: "userLogin" adm_password: "userPassword"
#示例
认证方法将认证您访问ArrowDB,这是创建、更新、删除实体所必需的
public function tryIt() { $adb = $this->container->get('tx_tony_arrow_db_connector.adbc'); $adb->auth(); //post an event sample $this->postAdbSample($adb); //get all events sample $content = $this->getAdbSample($adb); var_dump($content);exit; } private function postAdbSample($adb){ $model = "events"; // model name from ArrowDB sources $method = "create"; // method to appy to the given model $query = ""; // add custom filter or other $postFields = "name=arrowTest&start_time=2015-12-25T20:59:50+0000&duration=3600"; //for a POST request $postField must be populate or you'll get an error $curlOptions = array( CURLOPT_HEADER => true, CURLOPT_POSTFIELDS=>$postFields ); // this bundle use curl, so you can add all CURLOPT_ you need $adb->postAdbDatas($model,$method,$query,$curlOptions); //method to call post Request to arrowDB MBaaS } private function getAdbSample($adb){ $model = "events"; $method = "query"; $query = ""; // can be a filter like where{id="niahniah",foo="niahniah"}&userId=oO ... see arrow db doc $curlOptions = array( CURLOPT_HEADER => true ); return $adb->getAdbDatas($model,$method,$query,$curlOptions); }
所有模型和函数以及查询都可以在这里看到
http://docs.appcelerator.com/arrowdb/latest/#!/api/Events
#计划功能
- 连接到appcelerator ArrowDb数据源OK
- 对arrowDb数据源的REST请求GET和POST OK
- 从myApp数据库迁移数据到arrowDb
- 从arrowDb迁移数据到myDatabase
- 应与Orm和Odm兼容
- 其他功能稍后讨论