Advertisement
Guest User

Untitled

a guest
Jan 18th, 2015
403
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.53 KB | None | 0 0
  1. PHP Warning – yii\base\ErrorException
  2. Invalid argument supplied for foreach()
  3.  
  4. 1. in C:\xampp\htdocs\advanced\vendor\yiisoft\yii2\db\BaseActiveRecord.php at line 1047
  5. 1038103910401041104210431044104510461047104810491050105110521053105410551056
  6.  
  7. * record to trigger the [[EVENT_AFTER_FIND|afterFind Event]].
  8. *
  9. * @param BaseActiveRecord $record the record to be populated. In most cases this will be an instance
  10. * created by [[instantiate()]] beforehand.
  11. * @param array $row attribute values (name => value)
  12. */
  13. public static function populateRecord($record, $row)
  14. {
  15. $columns = array_flip($record->attributes());
  16. foreach ($row as $name => $value) {
  17. if (isset($columns[$name])) {
  18. $record->_attributes[$name] = $value;
  19. } elseif ($record->canSetProperty($name)) {
  20. $record->$name = $value;
  21. }
  22. }
  23. $record->_oldAttributes = $record->_attributes;
  24. }
  25.  
  26.  
  27. 2. in C:\xampp\htdocs\advanced\vendor\yiisoft\yii2\db\BaseActiveRecord.php – yii\base\ErrorHandler::handleError(2, 'Invalid argument supplied for fo...', 'C:\xampp\htdocs\advanced\vendor\...', 1047, ...) at line 1047
  28. 3. in C:\xampp\htdocs\advanced\vendor\yiisoft\yii2\db\ActiveQueryTrait.php – yii\db\BaseActiveRecord::populateRecord(common\models\Vbpl, null) at line 132
  29. 4. in C:\xampp\htdocs\advanced\vendor\yiisoft\yii2-mongodb\ActiveQuery.php – yii\mongodb\ActiveQuery::createModels([null]) at line 215
  30. 209210211212213214215216217218219220221
  31.  
  32. public function populate($rows)
  33. {
  34. if (empty($rows)) {
  35. return [];
  36. }
  37.  
  38. $models = $this->createModels($rows);
  39. if (!empty($this->with)) {
  40. $this->findWith($this->with, $models);
  41. }
  42. if (!$this->asArray) {
  43. foreach ($models as $model) {
  44. $model->afterFind();
  45.  
  46. 5. in C:\xampp\htdocs\advanced\vendor\yiisoft\yii2-mongodb\ActiveQuery.php – yii\mongodb\ActiveQuery::populate([null]) at line 154
  47. 148149150151152153154155156157158159160
  48.  
  49. * if the query results in nothing.
  50. */
  51. public function one($db = null)
  52. {
  53. $row = parent::one($db);
  54. if ($row !== false) {
  55. $models = $this->populate([$row]);
  56. return reset($models) ?: null;
  57. } else {
  58. return null;
  59. }
  60. }
  61.  
  62.  
  63. 6. in C:\xampp\htdocs\advanced\vendor\yiisoft\yii2\db\BaseActiveRecord.php – yii\mongodb\ActiveQuery::one() at line 136
  64. 7. in C:\xampp\htdocs\advanced\vendor\yiisoft\yii2\db\BaseActiveRecord.php – yii\db\BaseActiveRecord::findByCondition('54bc6960498fb4a015000029', true) at line 101
  65. 8. in C:\xampp\htdocs\advanced\backend\modules\vbpl\controllers\VbplController.php – yii\db\BaseActiveRecord::findOne('54bc6960498fb4a015000029') at line 115
  66. 109110111112113114115116117118119120121
  67.  
  68. * @param integer $_id
  69. * @return Vbpl the loaded model
  70. * @throws NotFoundHttpException if the model cannot be found
  71. */
  72. protected function findModel($id)
  73. {
  74. if (($model = Vbpl::findOne($id)) !== null) {
  75. return $model;
  76. } else {
  77. throw new NotFoundHttpException('The requested page does not exist.');
  78. }
  79. }
  80. }
  81.  
  82. 9. in C:\xampp\htdocs\advanced\backend\modules\vbpl\controllers\VbplController.php – backend\modules\vbpl\controllers\VbplController::findModel('54bc6960498fb4a015000029') at line 52
  83. 46474849505152535455565758
  84.  
  85. * @param integer $_id
  86. * @return mixed
  87. */
  88. public function actionView($id)
  89. {
  90. return $this->render('view', [
  91. 'model' => $this->findModel($id),
  92. ]);
  93. }
  94.  
  95. /**
  96. * Creates a new Vbpl model.
  97. * If creation is successful, the browser will be redirected to the 'view' page.
  98.  
  99. 10. backend\modules\vbpl\controllers\VbplController::actionView('54bc6960498fb4a015000029')
  100. 11. in C:\xampp\htdocs\advanced\vendor\yiisoft\yii2\base\InlineAction.php – call_user_func_array([backend\modules\vbpl\controllers\VbplController, 'actionView'], ['54bc6960498fb4a015000029']) at line 55
  101. 12. in C:\xampp\htdocs\advanced\vendor\yiisoft\yii2\base\Controller.php – yii\base\InlineAction::runWithParams(['r' => 'vbpl/vbpl/view', 'id' => '54bc6960498fb4a015000029']) at line 151
  102. 13. in C:\xampp\htdocs\advanced\vendor\yiisoft\yii2\base\Module.php – yii\base\Controller::runAction('view', ['r' => 'vbpl/vbpl/view', 'id' => '54bc6960498fb4a015000029']) at line 455
  103. 14. in C:\xampp\htdocs\advanced\vendor\yiisoft\yii2\web\Application.php – yii\base\Module::runAction('vbpl/vbpl/view', ['r' => 'vbpl/vbpl/view', 'id' => '54bc6960498fb4a015000029']) at line 83
  104. 15. in C:\xampp\htdocs\advanced\vendor\yiisoft\yii2\base\Application.php – yii\web\Application::handleRequest(yii\web\Request) at line 375
  105. 16. in C:\xampp\htdocs\advanced\backend\web\index.php – yii\base\Application::run() at line 18
  106. 12131415161718
  107.  
  108. require(__DIR__ . '/../../common/config/main-local.php'),
  109. require(__DIR__ . '/../config/main.php'),
  110. require(__DIR__ . '/../config/main-local.php')
  111. );
  112.  
  113. $application = new yii\web\Application($config);
  114. $application->run();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement