ezContentObject::version() returns nothing...

Author Message

Jim Reverend

Tuesday 03 February 2004 8:42:01 pm

I have the following code that I will use to import my existing CMS data into EZPUBLISH:
-----
$ezdir = '/path/2/ez/publish/';

$path = ini_get('include_path');
ini_set('include_path', $path . ':' . $ezdir);

$ezobjtype = 23;
$ezauth = 15;
$ezsection = 13;
$ezparent = 50;


require_once 'DB.php';
require_once 'lib/ezutils/classes/ezdebug.php';
require_once 'kernel/classes/ezcontentclass.php';
require_once 'kernel/classes/eznodeassignment.php';
include_once( 'lib/ezutils/classes/ezcli.php' );
include_once( 'kernel/classes/ezscript.php' );
include_once 'kernel/common/i18n.php';


$bbdb = DB::connect('mysql://someuser:somepass@localhost/somedb');

$stmt = "SELECT * FROM sometable LIMIT 1";

$res = $bbdb->query($stmt);

while($data = $res->fetchrow(DB_FETCHMODE_ASSOC)) {
print "DATA:\n";
print_r($data);
$contentclass =& ezcontentclass::fetch($ezobjtype);
print "EZCONTENTCLASS:\n";
print_r($contentclass);
$contentobject =& $contentclass->instantiate($ezauth,$ezsection);
print "EZCONTENTOBJECT:\n";
print_r($contentobject);
$blah = array(
'contentobject_id' => $contentobject->attribute('id'),
'contentobject_version' => $contentobject->attribute('current_version'),
'parent_node' => $ezparent,
'is_main' => 0
);
print "BLAH:\n";
print_r($blah);
$nodeassignment =& eznodeassignment::create($blah);
print "EZNODEASSIGNMENT:\n";
print_r($nodeassignment);

// ERROR FROM STATEMENT BELOW
$version =& $contentobject->version( 1 );
print "VERSION:\n";
print_r($version);
$contentobjectattributes =& $version->contentObjectAttributes();

}

-----

When run via the command line, I get the following error:
Fatal error: Call to a member function on a non-object in /home/revjim/bin/bblogtoez.php on line 52

(Line 52 is the line that calls contentObjectAttributes())...

It is also interesting to note that $nodeassignment and $version are both empty when "print_r"ed.

I'm sure I'm missing something simple. Please help.

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.