【发布时间】:2015-05-13 07:54:05
【问题描述】:
我正在尝试按照食谱上的这个示例创建内容:
https://github.com/ezsystems/CookbookBundle/blob/master/Command/CreateContentCommand.php
目前我只是尝试创建“文件夹”内容,执行脚本时出现以下错误:
PHP 致命错误:在第 53 行的 /vagrant/application/ezpublish_legacy/kernel/search/plugins/ezsearchengine/ezsearchengine.php 中的非对象上调用成员函数属性()
代码如下:
foreach ($tabPreImportData as $object) {
$output->writeln('<info> Object ID: ' . $object['id_object'] . '</info>');
$objectToMigrate = eZContentObject::fetch($object['id_object']);
$contentType = $contentTypeService->loadContentTypeByIdentifier('folder');
$contentCreateStruct = $contentService->newContentCreateStruct($contentType, 'eng-US');
foreach ($objectToMigrate->dataMap() as $attrIdentifier => $attrValue) {
$contentCreateStruct->setField($attrIdentifier, $attrValue->DataText);
}
$locationCreateStruct = $locationService->newLocationCreateStruct(2);
// create a draft using the content and location create struct and publish it
$draft = $contentService->createContent($contentCreateStruct, array($locationCreateStruct));
$content = $contentService->publishVersion($draft->versionInfo);
}
最后一行:
$content = $contentService->publishVersion($draft->versionInfo);
当我检查堆栈跟踪时导致问题。
更多信息:
- 对象是从 eZ 4 数据库中获得的
- 在 eZ 5 数据库中重新创建。
谢谢。
【问题讨论】:
标签: php symfony command ezpublish