Content Importer, adding a block results in error
Permalink 1 user found helpful
Hi
I am using the new Content Importer to import an XML document into my site.
This fails with the following error:
The XML is as follows:
The XML looks good but I am unsure why the error is occurring. Any ideas?
Jake
I am using the new Content Importer to import an XML document into my site.
This fails with the following error:
Fatal error: Call to a member function getVersionID() on a non-object in concrete5/concrete/models/collection.php on line 795
The XML is as follows:
<concrete5-cif version="1.0"> <pages> <page name="Short" path="/news/Short" filename="" pagetype="inner_page" description="Short" package=""> <area name="Main Content"> <block type="content" name=""> <data table="btContentLocal"> <record> <content><![CDATA[<p>Sidebar Content</p>]]></content> </record> </data> </block> </area> </page> </pages> </concrete5-cif>
The XML looks good but I am unsure why the error is occurring. Any ideas?
Jake
It appears that once the page is added and blocks are then created the path/handle (rather than the cID) is used to identify the page further down the line for these areas and blocks. The issue is that if you enter an incorrect path/handle for the page e.g. "my--page" or "wibble wobble" or "this-page-exists-already" this is not flagged with an error but is parsed and used to create the page - which is fine.
The issue comes when the incorrect, not the newly parsed path/handle is then used when creating the blocks. A block is created and the Importer attempts to link the block to the page with the incorrect path/handle, but, oh no, the path isn't there because the handle is not the same. Thus resulting in no page being there for the new block and the error I posted earlier appearing.
This has only come about because I am parsing RSS feeds into pages and so the RSS Title is often poor which results in a poor path and therefore I have this issue. I have fixed it now by using the text helper handle() function.
Jake