Tavovb wrote:Fatal error: Declaration of CustomActiveDataProvider::getPagination() must be compatible with CDataProvider::getPagination($className = 'CPaginatio...')
diff -r a978217813de -r 76c99dd78990 protected/modules/messages/controllers/MainController.php
--- a/protected/modules/messages/controllers/MainController.php Thu Feb 22 20:11:39 2018 +0300
+++ b/protected/modules/messages/controllers/MainController.php Thu Feb 22 20:32:16 2018 +0300
@@ -115,7 +115,7 @@
$allUsers = $return['allUsers'];
$pages = $return['pages'];
- if (count($allUsers)) {
+ if (is_array($allUsers) && !empty($allUsers)) {
$itemsProvider = new CArrayDataProvider(
$allUsers, array(
'pagination' => array(
diff -r a978217813de -r 76c99dd78990 protected/modules/messages/controllers/backend/MainController.php
--- a/protected/modules/messages/controllers/backend/MainController.php Thu Feb 22 20:11:39 2018 +0300
+++ b/protected/modules/messages/controllers/backend/MainController.php Thu Feb 22 20:32:16 2018 +0300
@@ -60,7 +60,7 @@
$allUsers = $return['allUsers'];
$pages = $return['pages'];
- if (count($allUsers)) {
+ if (is_array($allUsers) && !empty($allUsers)) {
$itemsProvider = new CArrayDataProvider(
$allUsers, array(
'pagination' => array(
diff -r 481644ae5d0d -r a978217813de protected/components/CustomActiveDataProvider.php
--- a/protected/components/CustomActiveDataProvider.php Thu Feb 22 20:02:52 2018 +0300
+++ b/protected/components/CustomActiveDataProvider.php Thu Feb 22 20:11:39 2018 +0300
@@ -24,7 +24,7 @@
private $_pagination;
// override to create instance of CustomPagination
- public function getPagination()
+ public function getPagination($className='CPagination')
{
if ($this->_pagination === null) {
diff -r a111b4626c86 -r 481644ae5d0d framework/db/ar/CActiveFinder.php
--- a/framework/db/ar/CActiveFinder.php Wed Feb 21 09:01:03 2018 +0300
+++ b/framework/db/ar/CActiveFinder.php Thu Feb 22 20:02:52 2018 +0300
@@ -588,9 +588,10 @@
$childCondition=array();
$count=0;
$params=array();
+ $pkCount=is_array($parent->_table->primaryKey)?count($parent->_table->primaryKey):1;
foreach($fks as $i=>$fk)
{
- if($i<count($parent->_table->primaryKey))
+ if($i<$pkCount)
{
$pk=is_array($parent->_table->primaryKey) ? $parent->_table->primaryKey[$i] : $parent->_table->primaryKey;
$parentCondition[$pk]=$joinAlias.'.'.$schema->quoteColumnName($fk).'=:ypl'.$count;
@@ -599,7 +600,7 @@
}
else
{
- $j=$i-count($parent->_table->primaryKey);
+ $j=$i-$pkCount;
$pk=is_array($this->_table->primaryKey) ? $this->_table->primaryKey[$j] : $this->_table->primaryKey;
$childCondition[$pk]=$this->getColumnPrefix().$schema->quoteColumnName($pk).'='.$joinAlias.'.'.$schema->quoteColumnName($fk);
}
@@ -1173,16 +1174,17 @@
{
$parentCondition=array();
$childCondition=array();
+ $pkCount=is_array($parent->_table->primaryKey)?count($parent->_table->primaryKey):1;
foreach($fks as $i=>$fk)
{
- if($i<count($parent->_table->primaryKey))
+ if($i<$pkCount)
{
$pk=is_array($parent->_table->primaryKey) ? $parent->_table->primaryKey[$i] : $parent->_table->primaryKey;
$parentCondition[$pk]=$parent->getColumnPrefix().$schema->quoteColumnName($pk).'='.$joinAlias.'.'.$schema->quoteColumnName($fk);
}
else
{
- $j=$i-count($parent->_table->primaryKey);
+ $j=$i-$pkCount;
$pk=is_array($this->_table->primaryKey) ? $this->_table->primaryKey[$j] : $this->_table->primaryKey;
$childCondition[$pk]=$this->getColumnPrefix().$schema->quoteColumnName($pk).'='.$joinAlias.'.'.$schema->quoteColumnName($fk);
}
@@ -1426,9 +1428,10 @@
$table=$model->getTableSchema();
$parent=$this->_parent;
$pkTable=$parent->model->getTableSchema();
+ $pkCount=is_array($pkTable->primaryKey)?count($pkTable->primaryKey):1;
$fks=preg_split('/\s*,\s*/',$relation->foreignKey,-1,PREG_SPLIT_NO_EMPTY);
- if(count($fks)!==count($pkTable->primaryKey))
+ if(count($fks)!==$pkCount)
throw new CDbException(Yii::t('yii','The relation "{relation}" in active record class "{class}" is specified with an invalid foreign key. The columns in the key must match the primary keys of the table "{table}".',
array('{class}'=>get_class($parent->model), '{relation}'=>$relation->name, '{table}'=>$pkTable->name)));
@@ -1534,9 +1537,11 @@
$relation=$this->relation;
$model=$this->_finder->getModel($relation->className);
$table=$model->getTableSchema();
+ $pkCount=is_array($table->primaryKey)?count($table->primaryKey):1;
$builder=$model->getCommandBuilder();
$schema=$builder->getSchema();
$pkTable=$this->_parent->model->getTableSchema();
+ $pkCountPk=is_array($pkTable->primaryKey)?count($pkTable->primaryKey):1;
$tableAlias=$model->getTableAlias(true);
@@ -1545,7 +1550,7 @@
array('{class}'=>get_class($this->_parent->model), '{relation}'=>$relation->name, '{joinTable}'=>$joinTableName)));
$fks=preg_split('/\s*,\s*/',$keys,-1,PREG_SPLIT_NO_EMPTY);
- if(count($fks)!==count($table->primaryKey)+count($pkTable->primaryKey))
+ if(count($fks)!==$pkCount+$pkCountPk)
throw new CDbException(Yii::t('yii','The relation "{relation}" in active record class "{class}" is specified with an incomplete foreign key. The foreign key must consist of columns referencing both joining tables.',
array('{class}'=>get_class($this->_parent->model), '{relation}'=>$relation->name)));
@@ -1585,14 +1590,14 @@
$map=array();
foreach($fks as $i=>$fk)
{
- if($i<count($pkTable->primaryKey))
+ if($i<$pkCountPk)
{
$pk=is_array($pkTable->primaryKey) ? $pkTable->primaryKey[$i] : $pkTable->primaryKey;
$map[$pk]=$fk;
}
else
{
- $j=$i-count($pkTable->primaryKey);
+ $j=$i-$pkCountPk;
$pk=is_array($table->primaryKey) ? $table->primaryKey[$j] : $table->primaryKey;
$joinCondition[$pk]=$tableAlias.'.'.$schema->quoteColumnName($pk).'='.$joinTable->rawName.'.'.$schema->quoteColumnName($fk);
}
Users browsing this forum: No registered users and 18 guests