AnsweredAssumed Answered

Creating a Node of a custom type in PHP

Question asked by dallinns on Apr 4, 2011
Latest reply on Apr 6, 2011 by ddanninger
I want to create a node that has a custom type but when I call the createChild function with the type specified I get an error with anything other than "cm_content". The following works fine:
$upload = $home->createChild('cm_content', 'cm_contains', $file_name);
But for example, when I try the following:
$upload = $home->createChild('ls_document', 'cm_contains', $file_name);
it gives me an error when $session->save() is called.

I edited the namespace map to include ls and using ls for the namespace works in other instances e.g.:
$upload->ls_classID = "ENGL316001";
works fine and is defined in a model file as
<type name="ls:document">
            <property name="ls:filename">
               <title>File Name</title>
            <property name="ls:classID">
               <title>Section Number</title>
            <property name="ls:description">
            <property name="ls:custom">
               <title>Custom data</title>
the ls:[property] properties here can be successfully applied to a document of type cm:content (which confuses me, but I guess it works) but I can't figure out how to give a node a type of ls:document. Any tips?