Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CDataProvider bugfix #1547

Merged
merged 3 commits into from Oct 9, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions framework/web/CActiveDataProvider.php
Expand Up @@ -106,11 +106,12 @@ public function setCriteria($value)


/** /**
* Returns the sorting object. * Returns the sorting object.
* @param string $className the sorting object class name. Parameter is available since version 1.1.13.
* @return CSort the sorting object. If this is false, it means the sorting is disabled. * @return CSort the sorting object. If this is false, it means the sorting is disabled.
*/ */
public function getSort() public function getSort($className='CSort')
{ {
if(($sort=parent::getSort())!==false) if(($sort=parent::getSort($className))!==false)
$sort->modelClass=$this->modelClass; $sort->modelClass=$this->modelClass;
return $sort; return $sort;
} }
Expand Down
22 changes: 18 additions & 4 deletions framework/web/CDataProvider.php
Expand Up @@ -82,7 +82,7 @@ public function getPagination($className='CPagination')
* @param mixed $value the pagination to be used by this data provider. This could be a {@link CPagination} object * @param mixed $value the pagination to be used by this data provider. This could be a {@link CPagination} object
* or an array used to configure the pagination object. If this is false, it means the pagination should be disabled. * or an array used to configure the pagination object. If this is false, it means the pagination should be disabled.
* *
* You can configre this property same way as a component: * You can configure this property same way as a component:
* <pre> * <pre>
* array( * array(
* 'class' => 'MyPagination', * 'class' => 'MyPagination',
Expand All @@ -94,7 +94,14 @@ public function setPagination($value)
{ {
if(is_array($value)) if(is_array($value))
{ {
$pagination=isset($value['class']) ? $this->getPagination($value['class']) : $this->getPagination(); if(isset($value['class']))
{
$pagination=$this->getPagination($value['class']);
unset($value['class']);
}
else
$pagination=$this->getPagination();

foreach($value as $k=>$v) foreach($value as $k=>$v)
$pagination->$k=$v; $pagination->$k=$v;
} }
Expand Down Expand Up @@ -123,7 +130,7 @@ public function getSort($className='CSort')
* @param mixed $value the sorting to be used by this data provider. This could be a {@link CSort} object * @param mixed $value the sorting to be used by this data provider. This could be a {@link CSort} object
* or an array used to configure the sorting object. If this is false, it means the sorting should be disabled. * or an array used to configure the sorting object. If this is false, it means the sorting should be disabled.
* *
* You can configre this property same way as a component: * You can configure this property same way as a component:
* <pre> * <pre>
* array( * array(
* 'class' => 'MySort', * 'class' => 'MySort',
Expand All @@ -135,7 +142,14 @@ public function setSort($value)
{ {
if(is_array($value)) if(is_array($value))
{ {
$sort=isset($value['class']) ? $this->getSort($value['class']) : $this->getSort(); if(isset($value['class']))
{
$sort=$this->getSort($value['class']);
unset($value['class']);
}
else
$sort=$this->getSort();

foreach($value as $k=>$v) foreach($value as $k=>$v)
$sort->$k=$v; $sort->$k=$v;
} }
Expand Down