0

この質問は、上記のとおりです。次のようなコードがあります。

// 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 には、このようなドキュメントはありません。ガベージコレクションと関係があるのか​​もしれませんが、よくわかりません。

4

1 に答える 1

1

セッションに入れるものはシリアライズ可能でなければなりません。インターフェイスArrayCollectionを実装していないようです。\Serializable

PHP セッション処理の詳細については、次のドキュメントを参照してください。

PHP がシャットダウンすると、自動的に $_SESSION スーパーグローバルの内容が取得され、シリアル化され、セッション保存ハンドラーを使用してストレージに送信されます。

于 2013-08-24T05:49:42.907 に答える