From f7cdc41945a14b1877791ec2f414cdb5e8a6a9ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Noco=C5=84?= Date: Mon, 15 Jul 2024 10:23:23 +0200 Subject: [PATCH] Update code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Paweł Niedzielski --- .../src/Command/ViewContentMetaDataCommand.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php b/code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php index 2d3cdf92d5..d0ba939dde 100644 --- a/code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php +++ b/code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php @@ -86,7 +86,10 @@ protected function execute(InputInterface $input, OutputInterface $output): int $output->writeln(' in ' . $versionInfo->getInitialLanguage()->name); } - $versionInfoArray = iterator_to_array($this->contentService->loadVersions($contentInfo, VersionInfo::STATUS_ARCHIVED)); + $versionInfoArray = $this->contentService->loadVersions($contentInfo, VersionInfo::STATUS_ARCHIVED); + if ($versionInfoArray instanceof \Traversable) { + $versionInfoArray = iterator_to_array($versionInfoArray); + } if (count($versionInfoArray)) { $output->writeln('Archived versions:'); foreach ($versionInfoArray as $versionInfo) {