...overview of the extension...
Requirements ¶
Yii 1.1 or above
Usage ¶
Download and extract ParseYii extension and put in protected/extensions then open parse.php file there you can find code for defining constants as below
const APP_ID="";
const REST_API_ID ="";
const MASTER_ID ="";
find your parse.com application details and put in front of right constants.
then open your application's /protected/config/main.php file
there add this parse array in components array
'components'=>array(
'parse' => array(
'class' => 'application.extensions.ParseYii.Parse',
),
...........
),
I have Users class/table in parse.com which contains
{
"createdAt": "2014-08-21T09:08:17.460Z",
"email": "khajaamin@gmail.com",
"first_name": "khajaamin",
"last_name": "attar",
"objectId": "VswIdA5gWo",
"password": "123456",
"updatedAt": "2014-08-21T09:08:17.460Z"
},
in your actions or module put this simple code for usage of your class from parse.com
$p=Yii::app()->parse->setTable('Users');
$e=$p->insert(array('first_name'=>"khajaamin",'last_name'=>"attar",
'email'=>"khajaamin@gmail.com",'password'=>"123456"));
print_r($e);
Note : change array key and value whatever your class having in the parse.com's class for storing data.
Now this is working for simple operation i request to build whatever you can or you can request e to build it for you
http://ngnerd.com
coming soon with great Yii & Angular framework
Thanks
This is working .
Thank you very much for this extension.This is working successfully.
how can list user table in parase.com in yii gridview
Hi,
I am using following code for displying userdata in gridview
//controller public function actionDisplay(){ $dataProvider= Yii::app()->parse->setTable('_Users'); $this->render('parse',array('data'=>$data)); } //model public function fetchusers() { $query = new \Parse\ParseQuery("_User"); $query->equalTo('resType','HSRNZkrIBF'); $query->descending("createdAt"); $results = $query->find(); return $results; } //view $this->widget('zii.widgets.grid.CGridView', array( 'dataProvider' => $dataProvider, 'columns' => array('key', 'value'), ));
but getting error...
What error you are getting?
Hi Manoj , Please brief what error you are getting. As per my knowledge, if you are using data provider with parse you need to override all methods for dataprovider which yii implements without using parse.You need to crate your own dataprovider
And one more thing ,Write all the parse code in extension application.extensions.ParseYii.Parse .i.e (Parse.php file) and call these functions wherever required in Model/View/Controller .Don't define Parse functions in Model/View/controller
//in application.extensions.ParseYii.Parse (Parse.php) public function getAllQuestionData($qid) { $query = new ParseQuery($this->table); $query->equalTo("objectId",$qid); $results = $query->find(); //echo "<pre>";print_r($results);exit; return $results; } //in controller public function actionView($id) { $obj = Yii::app()->parse->setTable('qt_question'); $data1=$obj->getAllQuestionData($id); $data1=$data1[0]; $this->render("view",array("model"=> $this->loadModel($id),'data'=>$data, 'answer_model'=>$answer_model, 'topic'=>$topic,'type'=>$data1->question_type)); } //in view //access $data1 as type and do further processing <?php $this->widget( 'booster.widgets.TbDetailView', array( 'data' =>$model , 'attributes'=>array( 'question_text', //'question_type' ), )); ?> ;<?php echo " Question Type ".$type."<br>";
good luck
Please convert your dataprovider into arrayProvider
this is yii method please seach for that while i will create the the full code.
please read this for refrance .. http://yiiplayground.com/index.php?r=UiModule/dataview/gridViewArray
not able to filter like cgridview..
Hi khajaamin,varadk
I implemented with arrayProvider.Actually what i am looking for make a filter like cgridview..I think if i use arrayProvider there is nothing like filter, if you have any solution for arrayprovider with filter please let me know how i can implement in my project..
Thanxs
Is this compatible with Yii2
Is this extension compatible with Yii2?
Thanks...
Please check with your variable $dataprovider and $data
I think it is because only you have created
>>>>> $dataProvider= Yii::app()->parse->setTable('_Users');
variable $dataProvieder and after
using $this->render('parse',array('data'=>$data)); <<<<
$data to send it to the view please check if it is right .
and then you have to us
'dataProvider' => $dataProvider, <<<< here in grid view
new code
'dataProvider' => new CArrayDataProvider($dataProvier),
in CgridView.
good Luck
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.