txtony / arrowdb-connector
A way to connect to appcelerator MBaaS platform
Installs: 1 064
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:symfony-bundle
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
Communicate with arrowDB from symfony app using LibCurl, minimalistic functions works
#First step : Installation
Get the bundle with :
composer require txtony/arrowdb-connector dev-master
Add in AppKernel.php :
'new TxTony\ArrowDBConnectorBundle\TxTonyArrowDBConnectorBundle()'
#Second step : Configuration
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"
#Example
auth method will authentify you to ArrowDB, it is required to create update delete entities
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); }
All model and method + queries can be seen here :
http://docs.appcelerator.com/arrowdb/latest/#!/api/Events
#Planned features
- Connect to appcelerator ArrowDb sources OK
- Rest Request to arrowDb sources GET and POST OK
- migrate data from myApp database to arowDb
- migrate data from arrowDb to myDatabase
- should work with Orm and Odm
- other stuff later too early to speak about that