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

Author Message

Andrey Astakhov

Thursday 28 December 2006 7:52:45 am

It was a necessity to change object name pattern for a class. Howewer it didn't change names of my objects.
I can change object names only after resaving them: just open and send for publish.
But it is not possible to manually resave about 1 thousand objects.

I tried updateniceurls.php script - it didn't help.
I've emptied ezurlalias table and run updateniceurls.php again. It works.

I had no custom url translation but obviously i'd loose all url translations after such procedure.
How to do in a right way? How to update object names according to changed object name pattern.

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?

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

eZ debug

Timing: Jan 31 2025 01:21:26
Script start
Timing: Jan 31 2025 01:21:26
Module start 'layout'
Timing: Jan 31 2025 01:21:26
Module start 'content'
Timing: Jan 31 2025 01:21:26
Module end 'content'
Timing: Jan 31 2025 01:21:26
Script end

Main resources:

Total runtime0.0513 sec
Peak memory usage4,096.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0092 588.3906151.2422
Module start 'layout' 0.00920.0057 739.6328220.7500
Module start 'content' 0.01490.0343 960.38281,001.8359
Module end 'content' 0.04920.0020 1,962.218837.9922
Script end 0.0512  2,000.2109 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00356.8775140.0003
Check MTime0.00163.1126140.0001
Mysql Total
Database connection0.00173.295810.0017
Mysqli_queries0.00326.284830.0011
Looping result0.00000.050710.0000
Template Total0.00142.810.0014
Template load0.00112.176310.0011
Template processing0.00030.581110.0003
Override
Cache load0.00071.363110.0007
General
dbfile0.014728.659880.0018
String conversion0.00000.021940.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs