PHP warning

count(): Parameter must be an array or an object that implements Countable

/var/www/u1302250/data/home/wb/waysbook/server/vendor/yiisoft/yii/framework/db/ar/CActiveFinder.php(1408)

1396 
1397     private function queryOneMany()
1398     {
1399         $relation=$this->relation;
1400         $model=$this->_finder->getModel($relation->className);
1401         $builder=$model->getCommandBuilder();
1402         $schema=$builder->getSchema();
1403         $table=$model->getTableSchema();
1404         $parent=$this->_parent;
1405         $pkTable=$parent->model->getTableSchema();
1406 
1407         $fks=preg_split('/\s*,\s*/',$relation->foreignKey,-1,PREG_SPLIT_NO_EMPTY);
1408         if(count($fks)!==count($pkTable->primaryKey))
1409             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}".',
1410                         array('{class}'=>get_class($parent->model), '{relation}'=>$relation->name, '{table}'=>$pkTable->name)));
1411 
1412         // set up mapping between fk and pk columns
1413         $map=array();  // pk=>fk
1414         foreach($fks as $i=>$fk)
1415         {
1416             if(!isset($table->columns[$fk]))
1417                 throw new CDbException(Yii::t('yii','The relation "{relation}" in active record class "{class}" is specified with an invalid foreign key "{key}". There is no such column in the table "{table}".',
1418                     array('{class}'=>get_class($parent->model), '{relation}'=>$relation->name, '{key}'=>$fk, '{table}'=>$table->name)));
1419 
1420             if(isset($table->foreignKeys[$fk]))

Stack Trace

#6
+
 /var/www/u1302250/data/home/wb/waysbook/server/vendor/twig/twig/lib/Twig/Template.php(358): CActiveRecord->offsetExists("commentsCount")
353         // array
354         if (Twig_Template::METHOD_CALL !== $type) {
355             $arrayItem = is_bool($item) || is_float($item) ? (int) $item : $item;
356 
357             if ((is_array($object) && array_key_exists($arrayItem, $object))
358                 || ($object instanceof ArrayAccess && isset($object[$arrayItem]))
359             ) {
360                 if ($isDefinedTest) {
361                     return true;
362                 }
363 
#7
+
 /var/www/u1302250/data/home/wb/waysbook/server/protected/runtime/twigCache/24/92/8e99abb83a2145410a1b3fcdfe12ff93026654060843982ea943bdee329c.php(168): Twig_Template->getAttribute(Journal, "commentsCount")
163         }
164         // line 105
165         echo "            <div class=\"view\">
166                 <span class=\"comments\">";
167         // line 106
168         echo twig_escape_filter($this->env, $this->getAttribute((isset($context["model"]) ? $context["model"] : null), "commentsCount"), "html", null, true);
169         echo "</span>
170                 <span class=\"views\">";
171         // line 107
172         echo twig_escape_filter($this->env, $this->getAttribute($this->getAttribute((isset($context["model"]) ? $context["model"] : null), "views"), "amount"), "html", null, true);
173         echo "</span>
#8
+
 /var/www/u1302250/data/home/wb/waysbook/server/vendor/twig/twig/lib/Twig/Template.php(144): __TwigTemplate_24928e99abb83a2145410a1b3fcdfe12ff93026654060843982ea943bdee329c->block_bodyContent(array("model" => Journal, "comment" => Comment, "this" => JournalController, "app" => Application, ...), array("title" => array(__TwigTemplate_24928e99abb83a2145410a1b3fcdfe12ff93026654060843982ea943bdee329c, "block_title"), "endScripts" => array(__TwigTemplate_5e3ccd319cf6cf077b17acd482874f356017fda2d52fd626aa81b04fa6b06b80, "block_endScripts")))
139             $block = null;
140         }
141 
142         if (null !== $template) {
143             try {
144                 $template->$block($context, $blocks);
145             } catch (Twig_Error $e) {
146                 throw $e;
147             } catch (Exception $e) {
148                 throw new Twig_Error_Runtime(sprintf('An exception has been thrown during the rendering of a template ("%s").', $e->getMessage()), -1, $template->getTemplateName(), $e);
149             }
2024-03-28 22:45:50 Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips mod_fcgid/2.3.9 Phusion_Passenger/5.3.7 Yii Framework/1.1.14