Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue when adding content to import batch #44

Open
martbase opened this issue Nov 8, 2017 · 1 comment
Open

Issue when adding content to import batch #44

martbase opened this issue Nov 8, 2017 · 1 comment

Comments

@martbase
Copy link
Contributor

martbase commented Nov 8, 2017

When adding content to an import batch an error dialog pops up before the process is completed.

Using concrete5 ver 8.2.1 and migration_tool ver 0.8.0

Error details
Error
$stack->setPosition($position); if ($node->area->blocks->block) { $blocks = $node->area->blocks->block; } elseif ($node->area->block) { // 5.6 $blocks = $node->area->block; } if (isset($blocks)) { $i = 0; foreach ($blocks as $blockNode) { if ($blockNode['type']) { $block = new StackBlock(); $block->setType((string) $blockNode['type']); $block->setName((string) $blockNode['name']); $bFilename = (string) $blockNode['custom-template']; if ($bFilename) { $block->setCustomTemplate($bFilename); } $value = $this->blockImporter->driver('unmapped')->parse($blockNode); if (isset($blockNode->style)) { $styleSet = $this->styleSetImporter->import($blockNode->style); $block->setStyleSet($styleSet); } $block->setBlockValue($value); $block->setPosition($i); $block->setStack($stack); $stack->getBlocks()->add($block); ++$i; } } } ++$position; $collection->getStacks()->add($stack); $stack->setCollection($collection); } } return $collection; }}

Possibly triggered in
.\packages\migration_tool\src\PortlandLabs\Concrete5\MigrationTool\Importer\CIF\Element\Stack.php

class Stack implements ElementParserInterface
{
    public function getObjectCollection(\SimpleXMLElement $element, Batch $batch)
    { // Bug likely triggered in this method   
        $this->simplexml = $element;
        $collection = new StackObjectCollection();
        if ($element->stacks) {
            $position = 0;
            foreach ($element->stacks->children() as $node) {
                $stack = $this->parseStack($node);
                $stack->setPosition($position); ```

@martbase
Copy link
Contributor Author

martbase commented Jan 17, 2018

Error still being encountered while importing a batch - using Concrete5 v8.3.1 and migration tool v0.8.6

With error detail in message mode concrete5 reports:- An unexpected error occurred. Call to a member function import() on null

With error detail in debug mode concrete5 outputs:-
$stack->setPosition($position); if ($node->area->blocks->block) { $blocks = $node->area->blocks->block; } elseif ($node->area->block) { // 5.6 $blocks = $node->area->block; } if (isset($blocks)) { $i = 0; foreach ($blocks as $blockNode) { if ($blockNode['type']) { $block = new StackBlock(); $block->setType((string) $blockNode['type']); $block->setName((string) $blockNode['name']); $bFilename = (string) $blockNode['custom-template']; if ($bFilename) { $block->setCustomTemplate($bFilename); } $value = $this->blockImporter->driver('unmapped')->parse($blockNode); if (isset($blockNode->style)) { $styleSet = $this->styleSetImporter->import($blockNode->style); $block->setStyleSet($styleSet); } $block->setBlockValue($value); $block->setPosition($i); $block->setStack($stack); $stack->getBlocks()->add($block); ++$i; } } } ++$position; $collection->getStacks()->add($stack); $stack->setCollection($collection); } } return $collection; }}
c5modernl8st.zip

I have traced the error to the following file
packages\migration_tool\src\PortlandLabs\Concrete5\MigrationTool\Importer\CIF\Element\Stack.php

Adding return $collection; in function getObjectCollection on line 45 just after $stack->setPosition($position); allows the import to continue.

I have attached the import content file for trouble-shooting

Steps to reproduce:
Install Concrete5 v8.3.1 with empty content
install a custom theme
install migration tool (v0.8.6)
create import batch
add content to batch (c5modernl8st.xml)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant