Two issues, both which I thought should be straight forward.
1. I'm trying to create an import data function.
I've added a field in the CMS where the user can enter data. On saving the page, the onBeforeWrite function finds that data and attempts to create sub pages based on what was entered.
However, it seems that writing a page in the onBeforeWrite of another page stops the rest of the page creations, and stops and javascript execution.
Anyone have an idea why this is happening, or have a better method?
2. This one is really dumb, but in the same script, I'm trying to add other objects to the pages that I'm creating. The new page is a subclassed object with two has_one relationships. How can I add these objects while I'm saving these generated pages?
Eg:
$newPage->Title = "New Page 1";
$newPage->someObject = new customDataObject();
$newPage->write();
But the 'someObjectID' in the generated page is always zero.
Clues?
Cheers.