dataprovider

How to convert model data objects array to dataProvider

做~自己de王妃 提交于 2019-12-03 06:06:38
问题 Suppose I have model User which have many to many relation to itself named as friends . so $user->friends (or $model->friends in view) gives me an array of User objects. I wanted to display the friends as gridview. But CGridView data as dataProvider object. Googling for it found the way to convert array of model objects to dataProvider object as given below. $this->widget('zii.widgets.grid.CGridView', array( 'id' => 'gridUser', 'dataProvider' => new CArrayDataProvider($model->friends, array()

Yii2 : how to cache active data provider?

十年热恋 提交于 2019-12-02 23:39:34
In my PostSearch model I have this code : public function search($params) { $query = Post::find()->where(['status' => 1]); $dataProvider = new ActiveDataProvider([ 'query' => $query, 'sort'=> ['defaultOrder' => ['id' => SORT_DESC]], 'pagination' => [ 'pageSize' => 10, ] ]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere([ 'id' => $this->id, 'status' => $this->status, ]); $query->andFilterWhere(['like', 'title', $this->title]) ->andFilterWhere(['like', 'text', $this->text]); return $dataProvider; my try, instead of above line return

How to convert model data objects array to dataProvider

旧街凉风 提交于 2019-12-02 19:31:31
Suppose I have model User which have many to many relation to itself named as friends . so $user->friends (or $model->friends in view) gives me an array of User objects. I wanted to display the friends as gridview. But CGridView data as dataProvider object. Googling for it found the way to convert array of model objects to dataProvider object as given below. $this->widget('zii.widgets.grid.CGridView', array( 'id' => 'gridUser', 'dataProvider' => new CArrayDataProvider($model->friends, array()), )); Now using this I get an error Property "User.id" is not defined. UPDATE public function

Clistview in yii Undefined variable dataProvider

好久不见. 提交于 2019-12-02 08:35:42
I need a list view in my index.php . This is does not have any model so I used CSqlDataProvider for declaring the data provider and rendering it to the index from the controller. Here is my controller action... public function actionIndex() { $sql="select * from Ads"; $totalItemCount=20; $dataProvider = new CSqlDataProvider($sql, array( 'totalItemCount' => $totalItemCount, )); $this->render('index',array('dataProvider'=>$dataProvider)); } Here is my index.php code.... $this->widget('zii.widgets.CListView', array( 'dataProvider'=>$dataProvider, 'itemView'=>'index', 'id'=>'list', )); I am

phpunit dbunit @dataProvider doesn't work

喜夏-厌秋 提交于 2019-12-01 13:31:36
I spent a lot of time by searching where is the problem, but i haven't find anything. It sais "testAdd caused an ERROR: Missing argument". Simply the dataProvider isn't executed, when I run the test. I tried to put die() into the dataProvider and it hasn't died. This is my code: class LabelEntityModelTest extends PHPUnit_Extensions_Database_TestCase { private static $connection = NULL; /** * @var \CXNS\DB\Connections\Connection */ private static $appConnection; private static $table; public function __construct() { if (self::$connection) { return; } $pdo = new \PDO($GLOBALS['DB_DSN'], $GLOBALS

phpunit dbunit @dataProvider doesn't work

微笑、不失礼 提交于 2019-12-01 11:26:11
问题 I spent a lot of time by searching where is the problem, but i haven't find anything. It sais "testAdd caused an ERROR: Missing argument". Simply the dataProvider isn't executed, when I run the test. I tried to put die() into the dataProvider and it hasn't died. This is my code: class LabelEntityModelTest extends PHPUnit_Extensions_Database_TestCase { private static $connection = NULL; /** * @var \CXNS\DB\Connections\Connection */ private static $appConnection; private static $table; public

ASP.NET MVC 3 - Unable to find the requested .Net Framework Data Provider

给你一囗甜甜゛ 提交于 2019-11-29 22:03:53
Background-info: I'm using Microsoft Visual Web Developer 2010 Express. Info about my (lack of) experience: the problem occured within the first tutorial that I'm trying to work through. Some additional-info: I'm comfortable with C#, Postgres, Rails (so MVC & Web-apps are not new to me) I have no experience with ASP.NET or SQL Server Problem Description: I'm trying to following exactly the steps from the "Intro to ASP.NET MVC 3" -tutorial and I'm running into a problem at the first step from part 5 - Adding the MoviesController: When I'm trying to add the "MoviesController" with the exact

Comparison of Entity Framework compatible providers for Oracle?

久未见 提交于 2019-11-29 15:41:33
I have read similar questions and their answers, however, it seems none deal with this exact question except for one, which is out of date (from 2009 - pre EF4). Does anyone have any positive or negative experience with EF providers for Oracle, if so what is your experience? Similar questions: Entity Framework and Oracle Can you use Microsoft Entity Framework with Oracle? Entity framework with oracle database How to choose an Oracle provider for .Net application? Providers I know of: Oracle's ODP.NET: http://www.oracle.com/technetwork/topics/dotnet/index-085163.html Devart's DotConnect: http:/

TestNG parallel Execution with DataProvider

霸气de小男生 提交于 2019-11-29 03:54:07
I have a single test which receives data from data provider. I would like this test to run in parallel with different values from data provider . I tried an approach like : public class IndependentTest { @Test(dataProvider = "dp1" ,threadPoolSize=3,invocationCount=1) public void testMethod(int number) { Long id = Thread.currentThread().getId(); System.out.println("HELLO : " + id); } @DataProvider(name = "dp1",parallel=true) public Object[][] dp1() { return new Object[][] { new Object[] { 1 }, new Object[] { 2 }, new Object[] { 3 }, new Object[] { 4 }, new Object[] { 5 }, new Object[] { 6 },

ASP.NET MVC 3 - Unable to find the requested .Net Framework Data Provider

孤者浪人 提交于 2019-11-28 18:22:14
问题 Background-info: I'm using Microsoft Visual Web Developer 2010 Express. Info about my (lack of) experience: the problem occured within the first tutorial that I'm trying to work through. Some additional-info: I'm comfortable with C#, Postgres, Rails (so MVC & Web-apps are not new to me) I have no experience with ASP.NET or SQL Server Problem Description: I'm trying to following exactly the steps from the "Intro to ASP.NET MVC 3"-tutorial and I'm running into a problem at the first step from