Quantcast
Channel: Yii Framework Forum
Viewing all articles
Browse latest Browse all 18717

Cactivedataprovider Is Not Returning All The Items On The Db

$
0
0
Hello, I am having the following problem: I have 2 controllers PersonController and SiteController, both have the same CActiveDataProvider
$dataProvider = new CActiveDataProvider ('Person');


but the site controller is returning me less results than the person.


PersonController.php
public function actionIndex($id_category)
	{
									
		if ($id_category!=='*')
		{
		    $dataProvider = new CActiveDataProvider ('Person', array ( 
		    'criteria' => array ( 
		    'condition' => '(id_category = '.$id_category.') AND (id_state IN(1,3,4))' ,
		    ),
				));
		
		}else
		{
			$dataProvider = new CActiveDataProvider ('Person');
			
			}
			
			$dataProvider->pagination->pageSize=50;
			
			
		$this->render('index',array(
			'dataProvider'=>$dataProvider,
		));
	}


SiteController.php
public function actionIndex()
	{
		// renders the view file 'protected/views/site/index.php'
		// using the default layout 'protected/views/layouts/main.php'
		
		$category = Category::model()->findAll();
		
		$dataProvider = new CActiveDataProvider ('Person');
				
		$this->render('index',array(
			'dataProvider'=>$dataProvider,
			'category'=>$category,
		));
		
	}


Im checking in the index view using this command:
echo'Cuenta provider: '. count($dataProvider->data).'</br>';

i am getting 10 items and in the other index view i am getting 19. any clue ? I will appreciate it.

Viewing all articles
Browse latest Browse all 18717

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>