typo3 - TYPO3 ObjectStorage + 瞬态域对象
问题描述
ObjectStorage 通常可以用于存储(瞬态,此模型没有数据库表)域对象吗?似乎不应该这样做。至少我在这个例子中遇到了麻烦:
$storage = new ObjectStorage();
// Add 10 items (transient domain objects) to storage
for($i=0; $i<10; $i++) {
$item = GeneralUtility::makeInstance(TransientDomainObjectWithoutDatabaseTable::class);
$storage->attach($item);
}
// Remove all items
foreach($storage as $item) {
$storage->detach($item);
}
// Storage still contains 5 items
DebuggerUtility::var_dump($storage);
解决方案
推荐阅读
- web-services - Sabre Webservice 使用 SoapUI 5.2.0 创建会话
- payload - 如何在 Botium 中将 UPDATE_CUSTOM 逻辑挂钩作为全局变量
- python - 从 Asyncio 事件循环部署 Celery 任务
- javascript - 即使特定复选框更改其索引,如何保持选中状态?
- javascript - 我无法使用 javascript 永久更改简单 html 页面的背景颜色
- python - 具有滚动时间的日期时间熊猫列
- git - 如何在 git 中创建多个分支作为孤儿并同时使用不同的分支?
- node.js - React - 尝试将获取的数据保存在变量中,但变量返回空
- wordpress - Wordpress Contentberg 主题拉丁文扩展 - 缺少波兰语字符 - 问题
- automated-tests - 空手道 - 如何正确设置驱动程序的路径(可执行文件)