Yii Framework Forum: Strange Findall Behavior - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Strange Findall Behavior Rate Topic: -----

#1 User is offline   hastenax 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 27-February 12

Posted 23 October 2012 - 01:27 AM

I have strange Yii behavior:

OS: Linux Debian 6
Browser: Any
Yii: 1.1.11

Behavior:

I have page with admin CGridView on simple column2 template layout.

In content(left column) I have the code:

<?php $this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'keywords-grid',
	'dataProvider'=>$dataProvider,
	'filter'=>$model,
	'columns'=>array(
		'id',
		array(
		    'name'=>'keywordName',
		    'value' => '$data->getKeyword()',
		),
		'count',
		array(
			'class'=>'CButtonColumn',
		),
	),
)); ?>


In column 2 (right) I have running the widget:

class KeywordsMenu extends CWidget {
	public function run() {
		$keywordLinks = WallpapersKeywords::model()
		    ->with(array('keyword.keywordName'))
		    ->findAll(
			array(
			    'select' => '*, max(added) as lastAdded, count(*) as cnt',
			    'group' => 'id_key',
			    'limit'=>Yii::app()->params['menuItems'],
			    'order'=> 'lastAdded DESC, cnt DESC', //problem line, in exception id appends here
			)
		    );


Strange behavior is when I click sort on any column of left CGridView page location appends with ?Keywords_sort=id, but I've got exception on right CWidget->Run on findAll method (SQL ERROR: No column id). For some reason left sorting parameters column id from CGridView appears in order of widget findAll.

This menu widget is fully different from this left keywords and order always must be 'order'=> 'lastAdded DESC, cnt DESC'.

Any ideas?
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users