Forums / General / Bad obj name when directly echo name after import

Bad obj name when directly echo name after import

Author Message

Bin LIU

Tuesday 07 April 2009 2:28:23 am

Hi,
I do a ez import script.

function createObj(xxx)
{
    ......
    $object->store();
    $operationResult = eZOperationHandler :: execute('content', 'publish', array ('object_id' =>     $object->attribute('id'), 'version' => 1 ) );
    eZContentObject::clearCache();
    return $object;
}

And when I insert a new object class name TEST

$o = createObj(xxx);
echo $o->attribute('name'); 
echo $o->name();

it output "New TEST"

But if I do

$o = createObj(xxx);
$o1 = eZContentObject::fetch($o->attribute("id"));
echo $o1->attribute('name'); 
echo $o1->name();

It output the good name

Why ??
tks

 

=== Lagardère Active ===

Fetch random
http://projects.ez.no/la_fetch_random
LA Static Cache
http://projects.ez.no/lastaticcache
LA Bookmarks (jquery)
http://projects.ez.no/labookmark
LA Calendar (jquery)
http://projects.ez.no/lacalendar

My site ez
http://lingping.info