ArrayCollection中。传递的变量不是数组或对象

时间:2015-11-29 19:02:31

标签: php symfony doctrine-orm

我已运行命令composer update,之后我收到错误:

  

InvalidArgumentException:
    传递的变量不是数组或对象,而是使用空数组

\学说\共同\类别\ ArrayCollection中:277

public function getIterator()
{
    return new ArrayIterator($this->elements);
}

旧方法如下所示:

public function getIterator()
{
    return new ArrayIterator($this->_elements);
}

我试图转储对象:

var_dump($this);

/*
object(Doctrine\Common\Collections\ArrayCollection)[1621]
  private 'elements' => null
  private '_elements' => 
    array (size=2)
      0 => string 'upload_d986a3d2395d68bf64191583da658692d895379b.png' (length=66)
      1 => string 'upload_855c4b484dfbf4bc5e77c5dbea187cf4740efba8.png' (length=66)
*/

var_dump($this->elements);

/*
null
*/

旧的工作版本:

doctrine/annotations                 v1.2.3
doctrine/cache                       v1.3.1
doctrine/collections                 v1.2
doctrine/common                      v2.4.2
doctrine/data-fixtures               v1.0.0
doctrine/dbal                        v2.5.1
doctrine/doctrine-bundle             v1.3.0
doctrine/doctrine-cache-bundle       v1.0.1
doctrine/doctrine-fixtures-bundle    v2.2.0
doctrine/inflector                   v1.0.1
doctrine/lexer                       v1.0.1
doctrine/orm                         v2.4.7 

新版本:

doctrine/annotations                 v1.2.7
doctrine/cache                       v1.5.1
doctrine/collections                 v1.3.0
doctrine/common                      v2.5.1
doctrine/data-fixtures               v1.1.1
doctrine/dbal                        v2.5.2
doctrine/doctrine-bundle             1.6.0
doctrine/doctrine-cache-bundle       1.2.2
doctrine/doctrine-fixtures-bundle    v2.2.1
doctrine/inflector                   v1.1.0
doctrine/instantiator                1.0.5
doctrine/lexer                       v1.0.1
doctrine/orm                         v2.5.2

有谁知道如何修复此错误?

1 个答案:

答案 0 :(得分:0)

Calendar不是数组或对象。这样可以解释错误。也许试着改变整个对象。