这个问题与上面的说明完全一样。我的代码如下所示:
// These attributes are getting deleted for some reason
$this->session->set('userProfiles',new ArrayCollection($uniqueList));
// Get array filter and save it in session
$this->session->set('filter',$filter);
// Save session
$this->session->save();
// The code bellow effects my attributes above. I don't know why that is.
$this->session->set('center',$center);
// If I comment the line bellow then attributes 'userProfile' and 'filter' do not get deleted
$this->session->save();
我非常困惑为什么 $this->session->save(); 设置我的中心属性后实际上是在删除我的数据。Symfony 没有这样的记录。它可能与垃圾收集有关,但我真的不知道。