Share » Forums » General » How to change object names if object...

How to change object names if object name pattern was cha...

How to change object names if object name pattern was cha...

Thursday 28 December 2006 7:52:45 am - 5 replies

Author Message

Kristof Coomans

Thursday 28 December 2006 8:31:57 am

Hi Andre

You need to use the CLI script update/common/scripts/updatecontentobjectname.php

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Andrey Astakhov

Saturday 30 December 2006 6:21:04 am

Thank you very much, Kristof.
It is so simple and so great.

BTW, it is not possible to download your datatypes extension from Contributions section. I've download it from pubsn. Is it still in alpha?

Kristof Coomans

Saturday 30 December 2006 6:28:40 am

Yes, it is. I recently made some big changes which I still need to commit back to the repository.

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Jens Tiedemann

Tuesday 11 December 2007 8:49:39 am

Hi - I've added a new attribute 'relation' to the user class, and updated the "object name pattern" to <first_name> <last_name>: <relation>. The relation attribute (customer, partner etc.) is determined at registration time based on the domain name in 'mailid'. By using the following code:

// store in attribute
$relation = $dataMap['relation'];
$relation->setAttribute( 'data_text', $usergroupName );
$relation->sync();

i get the 'relation' attribute updated allright. But like the original post, the full name does not show through, unless the user is "re-published". Adding the code:

// update object to update object content name
$class =& $object->contentClass();
$object->setName( $class->contentObjectName( $object ) );
$object->store();
unset( $class );

did not help. Any other way of updating the user name without running the CLI??

Jens Tiedemann

Tuesday 11 December 2007 10:10:36 am

also tried:

$newVersion =& $object->createNewVersion();
$newData =& $object->fetchDataMap( $newVersion->attribute( 'version' ) );
$relation = $newData['relation'];
$relation->setAttribute( 'data_text', $usergroupDisplayName );
$relation->sync();
include_once( 'lib/ezutils/classes/ezoperationhandler.php' );
$result = eZOperationHandler::execute( 'users', 'publish', array( 'object_id' => $object->attribute( 'id' ), 'version' => $newVersion->attribute( 'version' ) ) );

to force publication of a new version with the 'relation' attribute set right - this results in a new draft - but the draft is not actually published.... anybody knows how to force the publication of a user object?

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu